def __init__(self): self.daemon = True vmms = None if Config.VMMS_NAME == "tashiSSH": from vmms.tashiSSH import TashiSSH vmms = TashiSSH() elif Config.VMMS_NAME == "ec2SSH": from vmms.ec2SSH import Ec2SSH vmms = Ec2SSH() elif Config.VMMS_NAME == "localDocker": from vmms.localDocker import LocalDocker vmms = LocalDocker() elif Config.VMMS_NAME == "distDocker": from vmms.distDocker import DistDocker vmms = DistDocker() self.preallocator = Preallocator({Config.VMMS_NAME: vmms}) self.jobQueue = JobQueue(self.preallocator) if not Config.USE_REDIS: # creates a local Job Manager if there is no persistent # memory between processes. Otherwise, JobManager will # be initiated separately JobManager(self.jobQueue).start() logging.basicConfig( filename=Config.LOGFILE, format="%(levelname)s|%(asctime)s|%(name)s|%(message)s", level=Config.LOGLEVEL, ) self.start_time = time.time() self.log = logging.getLogger("TangoServer") self.log.info("Starting Tango server")
def __init__(self): logging.basicConfig( filename = self.LOGFILE, format = "%(levelname)s|%(asctime)s|%(name)s|%(message)s", level = Config.LOGLEVEL ) vmms = None if Config.VMMS_NAME == "localSSH": from vmms.localSSH import LocalSSH vmms = LocalSSH() elif Config.VMMS_NAME == "tashiSSH": from vmms.tashiSSH import TashiSSH vmms = TashiSSH() elif Config.VMMS_NAME == "ec2SSH": from vmms.ec2SSH import Ec2SSH vmms = Ec2SSH() elif Config.VMMS_NAME == "localDocker": from vmms.localDocker import LocalDocker vmms = LocalDocker() self.vmms = {Config.VMMS_NAME: vmms} self.preallocator = Preallocator(self.vmms) self.queue = JobQueue(self.preallocator) if not Config.USE_REDIS: # creates a local Job Manager if there is no persistent # memory between processes. Otherwise, JobManager will # be initiated separately JobManager(self.queue, self.vmms, self.preallocator) self.tango = TangoServer(self.queue, self.preallocator, self.vmms) logging.basicConfig( filename=self.LOGFILE, format="%(levelname)s|%(asctime)s|%(name)s|%(message)s", level=Config.LOGLEVEL ) logging.getLogger('boto').setLevel(logging.INFO) self.log = logging.getLogger("TangoREST") self.log.info("Starting RESTful Tango server") self.status = Status()
if __name__ == "__main__": if not Config.USE_REDIS: print( "You need to have Redis running to be able to initiate stand-alone\ JobManager") else: vmms = None if Config.VMMS_NAME == "localSSH": from vmms.localSSH import LocalSSH vmms = LocalSSH() elif Config.VMMS_NAME == "tashiSSH": from vmms.tashiSSH import TashiSSH vmms = TashiSSH() elif Config.VMMS_NAME == "ec2SSH": from vmms.ec2SSH import Ec2SSH vmms = Ec2SSH() elif Config.VMMS_NAME == "localDocker": from vmms.localDocker import LocalDocker vmms = LocalDocker() vmms = {Config.VMMS_NAME: vmms} preallocator = Preallocator(vmms) queue = JobQueue(preallocator) JobManager(queue, vmms, preallocator) print("Starting the stand-alone Tango JobManager")