update examples scripts, replacing add_to_server() with two-line statement

note that due to the usage of the 'server' global, it will not work to add a
Session.add_to_server() or core.misc.utils.add_to_server() function
(Boeing r1828)
This commit is contained in:
ahrenholz 2014-03-12 21:38:07 +00:00
parent 5aef9cddbd
commit 481daf4c0d
4 changed files with 8 additions and 48 deletions

View file

@ -23,17 +23,6 @@ from core.constants import *
# node list (count from 1)
n = [None]
def add_to_server(session):
''' Add this session to the server's list if this script is executed from
the core-daemon server.
'''
global server
try:
server.addsession(session)
return True
except NameError:
return False
def main():
usagestr = "usage: %prog [-h] [options] [args]"
parser = optparse.OptionParser(usage = usagestr)
@ -64,7 +53,8 @@ def main():
start = datetime.datetime.now()
session = pycore.Session(persistent=True)
add_to_server(session)
if 'server' in globals():
server.addsession(session)
print "creating %d nodes" % options.numnodes
left = None
prefix = None