def sleep(): "Serve controls requests in daemon mode" if PVSS.batchMode(): Online.Utils.log('Sleeping ....',timestamp=1) else: print 'Sleeping ....' sys.stdout.flush() try: while(1): time.sleep(1) except Exception,X: print 'Exception:',str(X)
def execute(args): "Argument dispatcher to start various streaming/option writers from the command line." wait = 0 typ = 'Storage' nam = None res = None pro = None function = None i = -1 while((i+1)<len(args)): i = i + 1 if args[i] == "-type": typ = args[i+1] i = i + 1 elif args[i] == "-debug": _dbg(int(args[i+1])) i = i + 1 elif args[i] == "-name": nam = args[i+1] i = i + 1 elif args[i] == "-project": pro = args[i+1] i = i + 1 elif args[i] == "-function": function = args[i+1] i = i + 1 elif args[i] == "-wait": wait = 1 else: print 'Ignored option ',args[i] if typ == 'Storage': if nam is None: nam = 'Storage' function = runStorage elif typ == 'Subfarm': if nam is None: nam = 'Unknown' function = runSubfarm elif typ == 'Farm': if nam is None: nam = 'Unknown' function = runFarm elif function is None: print 'Unknown action requested.' return None if function and nam: res = function(project=pro,name=nam) if res and wait != 0: import Online.PVSS as PVSS if not PVSS.batchMode(): print 'Hit CTRL-C to quit!' res[0].sleep() print '\n\nDone...\n\n' return 1
def runCheckpointManager(name='CHKPT'): """ Execute job options writer for the HLT farm. Arguments: @param name System name @param sim (Dummy) @author M.Frank """ mgr = _mgr(Params.storage_system_name) chkpt = CheckpointManager(mgr, 'CheckpointSvc') ctrl = Control.Control(mgr, 'Storage', 'Alloc', [chkpt]) ctrl.run() wait = 1 if wait != 0: if not PVSS.batchMode(): print 'Hit CTRL-C to quit!' ctrl.sleep() print '\n\nDone...\n\n' return 1 return None
def execute(args): "Argument dispatcher to start various streaming/option writers from the command line." sim = [] wait = 0 typ = 'Storage' nam = None res = None function = None for i in xrange(len(args)): if args[i] == "-sim": sim.append(args[i + 1]) i = i + 1 elif args[i] == "-type": typ = args[i + 1] i = i + 1 elif args[i] == "-debug": _dbg(int(args[i + 1])) i = i + 1 elif args[i] == "-name": nam = args[i + 1] i = i + 1 elif args[i] == "-function": function = args[i + 1] i = i + 1 elif args[i] == "-wait": wait = 1 else: print 'Ignored option ', args[i + 1] if len(sim) == 0: sim = None if typ == 'RecStorage': function = runRecStorage elif typ == 'Storage': function = runStorage #res = runStorage(sim=sim) elif typ == 'Monitoring': function = runMonitoring #res = runMonitoring(sim=sim) elif typ == 'Reconstruction': function = runReconstruction elif typ == 'HLTOptions': function = runHLTopts elif typ == 'InjectorOptions': function = runInjectoropts elif function is None: print 'Unknown action requested.' return None else: print 'Wrong action option set:', typ return None if function and nam: res = function(name=nam, sim=sim) elif function: res = function(sim=sim) if res and wait != 0: import Online.PVSS as PVSS if not PVSS.batchMode(): print 'Hit CTRL-C to quit!' res[0].sleep() print '\n\nDone...\n\n' if res[1] and len(res[1]) > 0: for i in res[1][1]: del (i) return 1
import os, sys, time, socket import Online.PVSS as PVSS import Online.Utils import UPI as upi log = Online.Utils.log timeStamp = Online.Utils.timeStamp menus = {} CMD_UPDATE = 2 CMD_INCREMENTAL = 3 CMD_QUIT = 4 _timeSensor = upi.gbl.TimeSensor.instance() _iocSensor = upi.gbl.IocSensor.instance() mk_timestamps = not PVSS.batchMode() def targetName(self): return self.name.replace('_Slice', 'Display_Slice') + '.Tasks' def targetHLT(self): return PVSS.defaultSystemName() + '_FSMDisplay.Tasks' class ReallyClose(upi.Interactor): # =========================================================================== def __init__(self, parent): upi.Interactor.__init__(self, self) self.id = 12345 + upi.sensor().newID() self.parent = parent