Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

adding in all the new files

  • Loading branch information...
commit cf0535c0d0fa4bd816825d9c96cfe35bf0193562 1 parent 818becc
@buzztroll buzztroll authored
View
7 lantorrent/etc/exe.in
@@ -0,0 +1,7 @@
+#!/bin/bash
+
+dir=`dirname $0`
+cd $dir/..
+export LANTORRENT_HOME=`pwd`
+
+exec @PGMNAME@ "${@}"
View
76 lantorrent/pylantorrent/db.py
@@ -0,0 +1,76 @@
+#### right now this is just used to create the db
+
+import sqlalchemy
+from sqlalchemy.orm import mapper
+from sqlalchemy.orm import sessionmaker
+from sqlalchemy import Table
+from sqlalchemy import Integer
+from sqlalchemy import String, MetaData, Sequence
+from sqlalchemy import Column
+from sqlalchemy import types
+from datetime import datetime
+import sqlite3
+
+metadata = MetaData()
+
+request_table = Table('requests', metadata,
+ Column('id', Integer, Sequence('event_id_seq')),
+ Column('rid', String(36), nullable=False, unique=True),
+ Column('src_filename', String(1024), nullable=False),
+ Column('dst_filename', String(1024), nullable=False, primary_key = True),
+ Column('xfer_id', String(64)),
+ Column('hostname', String(1024), nullable=False, primary_key = True),
+ Column('port', Integer, nullable=False, default=2893, primary_key = True),
+ Column('state', Integer, nullable=False, default=0),
+ Column('message', String(4096), nullable=True),
+ Column('entry_time', types.TIMESTAMP(), default=datetime.now()),
+ Column('attempt_count', Integer, nullable=False, default=0),
+ )
+
+class RequestTable(object):
+ def __init__(self):
+ self.id = None
+ self.rid = None
+ self.src_filename = None
+ self.dst_filename = None
+ self.xfer_id = None
+ self.hostname = None
+ self.port = None
+ self.state = None
+ self.message = None
+ self.entry_time = None
+ self.attempt_count = None
+
+mapper(RequestTable, request_table)
+
+class LantorrentDB(object):
+
+ def __init__(self, dburl):
+
+ # this is raw sql deal that i used
+ self._engine = sqlalchemy.create_engine(dburl,
+ connect_args={'detect_types': sqlite3.PARSE_DECLTYPES|sqlite3.PARSE_COLNAMES},
+ native_datetime=True
+ )
+
+ metadata.create_all(self._engine)
+ self._Session = sessionmaker(bind=self._engine)
+ self._session = self._Session()
+
+
+ def db_obj_add(self, obj):
+ self._session.add(obj)
+
+ def db_commit(self):
+ self._session.commit()
+
+ def db_rollback(self):
+ self._session.rollback()
+
+ def raw_sql(self, sql):
+ con = self._session.connection()
+ res = con.execute(sql)
+ return list(res)
+
+ def close(self):
+ self._session.close()
View
101 lantorrent/setup-vmm.py
@@ -0,0 +1,101 @@
+__author__ = 'bresnaha'
+
+import os
+from setuptools import setup, find_packages
+import sys
+
+Version = "0.2"
+
+if float("%d.%d" % sys.version_info[:2]) < 2.4:
+ sys.stderr.write("Your Python version %d.%d.%d is not supported.\n" % sys.version_info[:3])
+ sys.stderr.write("lantorrent requires Python 2.5 or newer.\n")
+ sys.exit(1)
+
+setup(name='lantorrent',
+ version=Version,
+ description='An Open Source network protocol for broadcasting large files.',
+ author='Nimbus Development Team',
+ author_email='workspace-user@globus.org',
+ url='http://www.nimbusproject.org/',
+ packages=[ 'pylantorrent', 'pylantorrent.nosetests'],
+ entry_points = {
+ 'console_scripts': [
+ 'ltserver = pylantorrent.server:main',
+ 'ltclient = pylantorrent.client:main',
+ ],
+
+ },
+ download_url ="http://www.nimbusproject.org/downloads/lantorrent-%s.tar.gz" % (Version),
+ keywords = "multicast broadcast network protocol transfer",
+ long_description="""
+Fast multicast of large files (designed for VM images)
+""",
+ license="Apache2",
+ install_requires = ["simplejson == 2.1"],
+
+ include_package_data = True,
+# data_files = test_plans,
+ package_data = {},
+
+ classifiers=[
+ 'Development Status :: 4 - Beta',
+ 'Environment :: Console',
+ 'Intended Audience :: End Users/Desktop',
+ 'Intended Audience :: Developers',
+ 'Intended Audience :: System Administrators',
+ 'License :: OSI Approved :: Apache Software License',
+ 'Operating System :: MacOS :: MacOS X',
+ 'Operating System :: Microsoft :: Windows',
+ 'Operating System :: POSIX',
+ 'Operating System :: POSIX :: Linux',
+ 'Programming Language :: Python',
+ 'Topic :: System :: Clustering',
+ 'Topic :: System :: Distributed Computing',
+ ],
+ )
+
+# generate the xinitd file and setup messages
+print ""
+
+lt_home = os.path.expanduser("~/.lantorrent")
+if 'LANTORRENT_HOME' in os.environ:
+ lt_home = os.environ['LANTORRENT_HOME']
+
+ini_template = "etc/lt.ini"
+dir = os.path.dirname(__file__)
+if dir:
+ ini_template = dir + "/" + ini_template
+ini_template = os.path.abspath(ini_template)
+dst = os.path.abspath(lt_home + "/etc/lt.ini")
+
+print ""
+print "======================="
+print "Copying the configuration file %s to %s" % (ini_template, dst)
+cp_cmd = "cp %s %s" % (ini_template, dst)
+rc = os.system(cp_cmd)
+if rc != 0:
+ raise Exception('Failed to copy the config file %s' % (cp_cmd))
+
+print "===================================="
+print "Generating the xinetd file"
+
+import getpass
+who = getpass.getuser()
+server = sys.prefix + "/bin/ltserver"
+
+xinetd_template = "etc/lantorrent.inet.in"
+dir = os.path.dirname(__file__)
+if dir:
+ xinetd_template = dir + "/" + xinetd_template
+
+f = open(xinetd_template, "r")
+
+sed_list = [("@PORT@", "2893"), ("@SERVICENAME@", "lantorrent"), ("@WHO@", who), ("@SERVER@", server)]
+print "please place the following in /etc/xinetd.d/lantorrent"
+print "============== START WITH THE NEXT LINE =================="
+for line in f:
+ for (old, new) in sed_list:
+ line = line.replace(old, new)
+ sys.stdout.write(line)
+
+print "=============== END WITH THE PREVIOUS LINE ================="
View
80 lantorrent/setup.py
@@ -0,0 +1,80 @@
+__author__ = 'bresnaha'
+
+import os
+from setuptools import setup, find_packages
+import sys
+
+
+Version = "0.2"
+
+if float("%d.%d" % sys.version_info[:2]) < 2.5:
+ sys.stderr.write("Your Python version %d.%d.%d is not supported.\n" % sys.version_info[:3])
+ sys.stderr.write("lantorrent requires Python 2.5 or newer.\n")
+ sys.exit(1)
+
+setup(name='lantorrent',
+ version=Version,
+ description='An Open Source network protocol for broadcasting large files.',
+ author='Nimbus Development Team',
+ author_email='workspace-user@globus.org',
+ url='http://www.nimbusproject.org/',
+ packages=[ 'pylantorrent', 'pylantorrent.nosetests'],
+ entry_points = {
+ 'console_scripts': [
+ 'ltdaemon = pylantorrent.daemon:main',
+ 'ltserver = pylantorrent.server:main',
+ 'ltrequest = pylantorrent.request:main',
+ 'ltclient = pylantorrent.client:main',
+ ],
+
+ },
+ download_url ="http://www.nimbusproject.org/downloads/lantorrent-%s.tar.gz" % (Version),
+ keywords = "multicast broadcast network protocol transfer",
+ long_description="""
+Fast multicast of large files (designed for VM images)
+""",
+ license="Apache2",
+ install_requires = ["simplejson == 2.1", "sqlalchemy == 0.6"],
+
+ include_package_data = True,
+# data_files = test_plans,
+ package_data = {},
+
+ classifiers=[
+ 'Development Status :: 4 - Beta',
+ 'Environment :: Console',
+ 'Intended Audience :: End Users/Desktop',
+ 'Intended Audience :: Developers',
+ 'Intended Audience :: System Administrators',
+ 'License :: OSI Approved :: Apache Software License',
+ 'Operating System :: MacOS :: MacOS X',
+ 'Operating System :: Microsoft :: Windows',
+ 'Operating System :: POSIX',
+ 'Operating System :: POSIX :: Linux',
+ 'Programming Language :: Python',
+ 'Topic :: System :: Clustering',
+ 'Topic :: System :: Distributed Computing',
+ ],
+ )
+
+lt_home = os.path.expanduser("~/.lantorrent")
+if 'LANTORRENT_HOME' in os.environ:
+ lt_home = os.environ['LANTORRENT_HOME']
+
+ini_template = "etc/lt.ini"
+dir = os.path.dirname(__file__)
+if dir:
+ ini_template = dir + "/" + ini_template
+ini_template = os.path.abspath(ini_template)
+dst = os.path.abspath(lt_home + "/etc/lt.ini")
+
+print ""
+print "======================="
+print "Copying the configuration file %s to %s" % (ini_template, dst)
+cp_cmd = "cp %s %s" % (ini_template, dst)
+rc = os.system(cp_cmd)
+if rc != 0:
+ raise Exception('Failed to copy the config file %s' % (cp_cmd))
+
+
+print "Lantorrent is now installed into your python environment. We recommend using the LANTORRENT_HOME environment variable to specify the location of configuration and log files. If this env is not set then ~/.lantorrent is used."
View
51 lantorrent/tests/make_lt_server.sh
@@ -0,0 +1,51 @@
+#!/bin/bash
+
+if [ "X$LANTORRENT_HOME" == "X" ]; then
+ echo "Please set the env LANTORRENT_HOME"
+ exit 1
+fi
+
+count=$1
+if [ "X$1" == "X" ]; then
+ count=1
+fi
+pidfile=$2
+
+
+who=`whoami`
+delim=""
+ports_str=""
+rm -f $LANTORRENT_HOME/tests/xinetd.d/*
+for i in `seq 1 $count`
+do
+
+ PORT=$RANDOM
+ while [ $PORT -lt 2048 ];
+ do
+ PORT=$RANDOM
+ x=`netstat -l --tcp --numeric-ports | grep $PORT`
+ if [ "X$x" != "X" ]; then
+ $PORT=0
+ fi
+ done
+
+ SERVNAME="lantorrent$PORT"
+
+ ports_str="$ports_str$delim$PORT"
+ delim=","
+ echo "s/@PORT@/$PORT/"
+ echo "s/@SERVICENAME@/$SERVNAME/"
+ echo "s^@LANTORRENT_HOME@^$LANTORRENT_HOME^"
+ sed -e "s/@WHO@/$who/" -e "s/@PORT@/$PORT/" -e "s/@SERVICENAME@/$SERVNAME/" -e "s^@LANTORRENT_HOME@^$LANTORRENT_HOME^" $LANTORRENT_HOME/etc/lantorrent.inet.in | tee $LANTORRENT_HOME/tests/xinetd.d/$SERVNAME
+
+done
+
+echo "export LANTORRENT_TEST_PORTS=$ports_str" > $LANTORRENT_HOME/tests/ports_env.sh
+
+ls -l $LANTORRENT_HOME/tests/xinetd.d/
+echo "s^@LANTORRENT_HOME@^$LANTORRENT_HOME^"
+sed "s^@LANTORRENT_HOME@^$LANTORRENT_HOME^" $LANTORRENT_HOME/etc/xinetd.conf.in | tee $LANTORRENT_HOME/tests/xinetd.conf
+
+
+pidfile=$2
+exec xinetd -f $LANTORRENT_HOME/tests/xinetd.conf -pidfile $pidfile
View
26 lantorrent/tests/test.sh
@@ -0,0 +1,26 @@
+#!/bin/bash
+
+if [ "X$LANTORRENT_HOME" == "X" ]; then
+ echo "Please set the env LANTORRENT_HOME"
+ exit 1
+fi
+if [ "X$NIMBUS_HOME" == "X" ]; then
+ echo "Please set the env NIMBUS_HOME"
+ exit 1
+fi
+cd $LANTORRENT_HOME
+
+# most users will not have xinetd in their path even if it is installed
+export PATH=/usr/sbin/:$PATH
+
+pidfile=`mktemp`
+$LANTORRENT_HOME/bin/make_lt_server.sh 4 $pidfile
+xinet_pid=`cat $pidfile`
+echo "xinet on $xinet_pid"
+
+ltdaemon &
+ltd_pid=$!
+
+trap "kill $xinet_pid $ltd_pid; sleep 10; kill -9 $xinet_pid $ltd_pid" EXIT
+source $LANTORRENT_HOME/tests/ports_env.sh
+nosetests tests/*_test.py
Please sign in to comment.
Something went wrong with that request. Please try again.