def _mgr(name): "Access PVSS controls manager by name" import Online.PVSS as PVSS; import Online.PVSSSystems as Systems if name is None: return PVSS.controlsMgr() return Systems.controlsMgr(name)
def controlsMgr(name): "Access controls manager of known PVSS systems by name" if name is not None: #if name != 'LBECS': if _systems.has_key(name): return _systems[name][1] # Hack for now .... if name[:3] == 'ECS': if name[:3] != name: print 'PVSS System switch:', name[:3], name, '--> LBECS' name = 'LBECS' id, nam = PVSS.system(name) if _sysIds.has_key(id): ctrl = _sysIds[id][1] else: ctrl = PVSS.controlsMgr(id, nam) if not _systems.has_key(name): _systems[name] = (id, ctrl) if not _systems.has_key(nam): _systems[nam] = (id, ctrl) if not _sysIds.has_key(id): _sysIds[id] = (name, ctrl) return _systems[nam][1] #raise Exception,'Invalid system name specified:'+name raise Exception, 'Invalid system name specified!'
def runHLT(with_server=1): import Online.Streaming.DisplayServer as Srv upi.attach_terminal() Online.Utils.makePrint = upi.write_message mgr = PVSS.controlsMgr() servers = [Display(mgr, mgr.name() + '_FSMDisplay', target=targetHLT)] if with_server: servers.append(Srv.BaseDisplayServerManager(mgr)) else: cont = PVSS.DataPointVector() sensor = PVSS.DeviceSensor(mgr, cont) sensor.run(1) sleep(servers)
def resetTaskStates(manager=None, match=None, state='UNKNOWN'): "Change the state pf FSM_DImTask objects." if manager is None: manager = PVSS.controlsMgr() if match: actor = PVSS.DpVectorActor(manager) typ = manager.typeMgr().type('FSM_DimTask') wr = manager.devWriter() actor.lookup(DataPoint.original(match + '.State'), typ) for i in actor.container: i.data = state wr.add(actor.container) if wr.execute(): log('Resetted the state of %d tasks to %s.' % (len(actor.container), state), timestamp=1) return 1 log('Failed to write task states...', timestamp=1) return None log('You need to supply a match variable', timestamp=1) return None
self.servers[nam] = srv log('Started display server:'+self.servers[nam].name,timestamp=1) elif i.data<=0 and self.servers[nam] is not None: log('Stop display server:'+self.servers[nam].name,timestamp=1) self.servers[nam].stop() self.servers[nam] = None return 1 # =========================================================================== 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) except: print 'Unknown Exception' if __name__=="__main__": mgr = PVSS.controlsMgr() if PVSS.defaultSystemName()[:3]=='HLT': mgr = BaseDisplayServerManager(mgr) else: mgr = DisplayServerManager(mgr) mgr.run() sleep()
def show(mgr=None, name='TestStorage_Slice00', devices=0): m = mgr if m is None: m = PVSS.controlsMgr() dmp = Dump(mgr, name) dmp.show(devices)