def setUp(self): nshost, nsport = 'localhost', 5000 # 2000+i: ssh forwarder (forwards to localhost:3000+i); username testuser-2001 (number is port number), password is always mmp-secret-key # 3000+i: mupif application server # 4000+i: natport # 5000: nameserver # setup nameserver self.nsloop = multiprocessing.Process(target=Pyro4.naming.startNSloop, kwargs=dict(host=nshost, port=nsport, hmac=self.hkey)) self.nsloop.start() time.sleep(2) # some time for nameserver to start # setup apps self.apps = LocalApp( "/dev/null" ), # CelsianApp("/dev/null"),MicressApp("/dev/null"),MmpraytracerApp("/dev/null") for i, app in enumerate(self.apps): # start "remote" servers (locally) print('Starting', app) PyroUtil.runAppServer(server='localhost', port=3000 + i, nathost='localhost', natport=4000 + i, nshost=nshost, nsport=nsport, nsname=PyroUtil.getNSAppName( self.jobname, app.__class__.__name__), hkey=self.hkey, app=app)
def setUp(self): nshost, nsport = "localhost", 5000 # 2000+i: ssh forwarder (forwards to localhost:3000+i); username testuser-2001 (number is port number), password is always mmp-secret-key # 3000+i: mupif application server # 4000+i: natport # 5000: nameserver # setup nameserver self.nsloop = multiprocessing.Process( target=Pyro4.naming.startNSloop, kwargs=dict(host=nshost, port=nsport, hmac=self.hkey) ) self.nsloop.start() time.sleep(2) # some time for nameserver to start # setup apps self.apps = ( LocalApp("/dev/null"), ) # CelsianApp("/dev/null"),MicressApp("/dev/null"),MmpraytracerApp("/dev/null") for i, app in enumerate(self.apps): # start "remote" servers (locally) print("Starting", app) PyroUtil.runAppServer( server="localhost", port=3000 + i, nathost="localhost", natport=4000 + i, nshost=nshost, nsport=nsport, nsname=PyroUtil.getNSAppName(self.jobname, app.__class__.__name__), hkey=self.hkey, app=app, )
def runSingleServerInstance(): """ Run a single instance of the Tracer server. The configuration file given in args must include the following: server, serverPort, serverNathost, serverNatport, nshost, nsport, appName, hkey """ # Parse arguments args = parser.parse_args() sys.path.append(os.getcwd()) # Load config conf = args.configFile if conf[-3:] == ".py": conf = conf[:-3] print(conf) cfg = importlib.import_module(conf) app = MMPRaytracer("localhost") PyroUtil.runAppServer( cfg.server, cfg.serverPort, cfg.serverNathost, cfg.serverNatport, cfg.nshost, cfg.nsport, cfg.appName, cfg.hkey, app=app, )
def runSingleServerInstance(): ''' Run a single instance of the Tracer server. The configuration file given in args must include the following: server, serverPort, serverNathost, serverNatport, nshost, nsport, appName, hkey ''' # Parse arguments args = parser.parse_args() sys.path.append(os.getcwd()) # Load config conf = args.configFile if conf[-3:] == '.py': conf = conf[:-3] print(conf) cfg = importlib.import_module(conf) app = MMPRaytracer('localhost') PyroUtil.runAppServer(cfg.server, cfg.serverPort, cfg.serverNathost, cfg.serverNatport, cfg.nshost, cfg.nsport, cfg.appName, cfg.hkey, app=app)
from mupif import WorkflowMonitor from mupif import Util from mupif import PyroUtil import argparse # Read int for mode as number behind '-m' argument: 0-local (default), 1-ssh, 2-VPN mode = argparse.ArgumentParser(parents=[Util.getParentParser()]).parse_args().mode from Config import config cfg = config(mode) Util.changeRootLogger('monitor.log') # bp stuff # cfg.monitorServer='172.30.0.3' # locate nameserver ns = PyroUtil.connectNameServer(nshost=cfg.nshost, nsport=cfg.nsport, hkey=cfg.hkey) monitor = WorkflowMonitor.WorkflowMonitor() print(monitor.getAllMetadata()) PyroUtil.runAppServer( server=cfg.monitorServer, port=cfg.monitorPort, nathost=None, natport=None, nshost=cfg.nshost, nsport=cfg.nsport, appName=cfg.monitorName, hkey=cfg.hkey, app=monitor )
import conf from mupif import Application from mupif import PyroUtil #nameserver app name appname='local' class local(Application.Application): """ Mupif interface to Local dummy task """ def __init__(self, file): super(local, self).__init__(file) #call basereturn def getApplicationSignature(self): return "local@"+ socket.gethostbyaddr(socket.gethostname())[0]+" version 1.0" #create application app = local("/dev/null") # run the application server appRecord = [item for item in conf.apps if item[0] == appname][0] PyroUtil.runAppServer(server=appRecord[conf.appIndx_ServerName], port=appRecord[conf.appIndx_RemotePort], nathost=conf.nathost, natport=appRecord[conf.appIndx_NATPort], nshost=conf.nshost, nsport=conf.nsport, nsname=PyroUtil.getNSAppName(conf.jobname, appname), hkey=conf.hkey, app=app)
appname = 'micress' class micress(Application.Application): """ Mupif interface to micress (microstructure evolution simulation tool) """ def __init__(self, file): super(micress, self).__init__(file) #call base return def getApplicationSignature(self): return "Micress@" + socket.gethostbyaddr( socket.gethostname())[0] + " version 1.0" #create application app = micress("/dev/null") # run the application server appRecord = conf.apps['micress'] PyroUtil.runAppServer(server=appRecord.serverName, port=appRecord.remotePort, nathost=conf.nathost, natport=appRecord.natPort, nshost=conf.nshost, nsport=conf.nsport, appName=PyroUtil.getNSAppName(conf.jobname, appname), hkey=conf.hkey, app=app)
from mupif import Application from mupif import PyroUtil # import basic definitions -> need to be customized import conf #set application name (used also as an index to apps dictionary defined in conf.py) appname='micress' class micress(Application.Application): """ Mupif interface to micress (microstructure evolution simulation tool) """ def __init__(self, file): super(micress, self).__init__(file) #call base return def getApplicationSignature(self): return "Micress@"+ socket.gethostbyaddr(socket.gethostname())[0]+" version 1.0" #create application app = micress("/dev/null") # run the application server appRecord = conf.apps['micress'] PyroUtil.runAppServer(server=appRecord.serverName, port=appRecord.remotePort, nathost=conf.nathost, natport=appRecord.natPort, nshost=conf.nshost, nsport=conf.nsport, nsname=PyroUtil.getNSAppName(conf.jobname, appname), hkey=conf.hkey, app=app)
#nameserver app name appname = 'ctu-server' class local(Application.Application): """ Mupif interface to Local dummy task """ def __init__(self, file): super(local, self).__init__(file) #call basereturn def getApplicationSignature(self): return "CTU-server@" + socket.gethostbyaddr( socket.gethostname())[0] + " version 1.0" #create application app = local("/dev/null") # run the application server appRecord = [item for item in conf.apps if item[0] == appname][0] PyroUtil.runAppServer(server=appRecord[conf.appIndx_ServerName], port=appRecord[conf.appIndx_RemotePort], nathost=conf.nathost, natport=appRecord[conf.appIndx_NATPort], nshost=conf.nshost, nsport=conf.nsport, appName=PyroUtil.getNSAppName(conf.jobname, appname), hkey=conf.hkey, app=app)