예제 #1
0
 def __init__(self, manager, name, target=targetName, standalone=None):
     self.manager = manager
     self.name = name
     self.lines = CMD_QUIT
     self.incremental = True
     self.reader = self.manager.devReader()
     self.dp = PVSS.DataPoint(self.manager,
                              PVSS.DataPoint.original(target(self)))
     self.reader.add(self.dp)
     log('Starting display for slice:' + self.name + ' on system:' +
         self.manager.name(),
         timestamp=mk_timestamps)
     upi.Interactor.__init__(self, self)
     self.mid = len(menus) + 1
     menus[self.mid] = self
     upi.open_window()
     upi.open_menu(self.mid, 0, 0, timeStamp(), name, self.manager.name())
     upi.add_command(CMD_UPDATE, 'Update')
     upi.add_command(CMD_INCREMENTAL, 'Show full status')
     upi.add_command(CMD_QUIT, 'Close')
     upi.close_menu()
     self.updateDisplay()
     upi.set_cursor(self.mid, CMD_UPDATE, 0)
     upi.sensor().add(self, self.mid)
     self.isAlive = 1
     self.standalone = standalone
예제 #2
0
 def _fsmLookup(self,dp,typ1,typ2):
   nam = self.matchName(self)
   obj = PVSS.DpVectorActor(self.manager)
   obj.lookupOriginal(nam+'_*.'+dp,typ2)
   obj.lookupOriginal(nam+'_*.'+dp,typ1)
   v = PVSS.DataPointVector()
   cfg = 'blabla'
   for i in obj.container:
     if i.name().find(nam+'_Config')>0:
       cfg = i.name()
       v.push_back(PVSS.DataPoint(self.manager,i.name()))
       break
   for i in obj.container:
     if i.name().find('_FWM') > 0: continue
     if i.name().find('_FWDM') > 0: continue
     if i.name().find('_FWCNM') > 0: continue
     if i.name() != cfg:
       v.push_back(PVSS.DataPoint(self.manager,i.name()))
   # print nam+'_*.'+dp,v.size()
   return v
예제 #3
0
  def _init(self):
    typ1          = self.manager.typeMgr().type('_FwFsmDevice')
    typ2          = self.manager.typeMgr().type('_FwFsmObject')
    self.actions  = self._fsmLookup('fsm.executingAction',typ1,typ2)
    self.states   = self._fsmLookup('fsm.currentState',typ1,typ2)
    self.commands = self._fsmLookup('fsm.sendCommand',typ1,typ2)
    self.enabled  = self._fsmLookup('mode.enabled',typ1,typ2)
    self.labels   = self._fsmLookup('ui.label',typ1,typ2)
    self.tnodes   = self._fsmLookup('tnode',typ1,typ2)
    self.fsmtypes = self._fsmLookup('type',typ1,typ2)

    self.writer = self.manager.devWriter()
    nam = self.targetName(self)
    self.taskData = PVSS.DataPoint(self.manager,PVSS.DataPoint.original(nam))
    self.writer.add(self.taskData)
    self.sensor = PVSS.DeviceSensor(self.manager,self.actions)
    self.taskData.data = PVSS.StringVector()
예제 #4
0
import socket
import Online.PVSS as PVSS
import Online.PVSSSystems as Systems

mgr = Systems.controlsMgr('ECS')
dp = PVSS.DataPoint(
    mgr, PVSS.DataPoint.original('ECS:LHCb_RunInfo.SubDetectors.tell1List'))
rd = mgr.devReader()
rd.add(dp)
rd.execute()
tell1_ips = {}

for i in dp.data:
    ip = socket.gethostbyname(i)
    print '%-13s %-13s' % (i, ip)
    if tell1_ips.has_key(ip):
        print 'Tell1 board ', i, ip, ' is already known:', tell1_ips[ip]
    tell1_ips[ip] = i

print 'Checked IP addresses of ', dp.data.size(), ' tell 1 boards'
예제 #5
0
 def handleDevice(self):
   "Callback once per item in the device sensor list on datapoint change."
   import traceback
   cmd = ''
   try:
     print "Callback once per item in the device sensor list on datapoint change."
     nam = self.dp().name()
     cmd = self.dp().value().data()
     itms = cmd.split('/')
     print nam,cmd
     if len(itms) >= 5:
       command   = itms[0]
       storage   = itms[1][:-len(self.postfix)]
       partition = itms[2]
       partID    = itms[3]
       runDpName = itms[4]
       Online.Utils.setPartition(partition)
       answer = '/'+itms[1]+'/'+partition+"/"+str(partID)
       result = None
       if storage == self.name:
         if command == "CONFIGURE":
           dp = itms[5]
           ok = itms[6]
           err = itms[7]
           data = PVSS.DataPoint(self.manager,PVSS.DataPoint.original(dp))
           data.data = ok
           try:
             result = self.doExecute('configure',runDpName,partition)
             if result is None: data.data = err
           except Exception, X:
             PVSS.error('The command:"'+cmd+'" failed:'+str(X),timestamp=1,type=PVSS.ILLEGAL_ARG)
             traceback.print_exc()
             data.data = err
           self.writer.add(data)
           Online.Utils.log('The command:"'+cmd+'" finished.',timestamp=1)
           self.writer.execute()
           Online.Utils.log('---> Wrote answer '+data.data+' to datapoint:'+dp,timestamp=1)
           return self
         elif command == "RECOVER_SLICE":
           dp = itms[5]
           ok = itms[6]
           err = itms[7]
           data = PVSS.DataPoint(self.manager,PVSS.DataPoint.original(dp))
           data.data = ok
           try:
             result = self.doExecute('recover_slice',runDpName,partition)
             if result is None: data.data = err
           except Exception, X:
             PVSS.error('The command:"'+cmd+'" failed:'+str(X),timestamp=1,type=PVSS.ILLEGAL_ARG)
             traceback.print_exc()
             data.data = err
           self.writer.add(data)
           self.writer.execute()
           return self
         try:
           if command == "ALLOCATE":
             result = self.doExecute('allocate',runDpName,partition)
             if result is not None:
               return self.makeAnswer(command,answer+'/'+result)
           elif command == "REALLOCATE":
             result = self.doExecute('free',runDpName,partition)
             if result is None:
               PVSS.error('The command:"free" failed.',timestamp=1,type=PVSS.ILLEGAL_ARG)
             result = self.doExecute('allocate',runDpName,partition)
             if result is not None:
               return self.makeAnswer(command,answer+'/'+result)
           elif command == "DEALLOCATE":
             result = self.doExecute('free',runDpName,partition)
             PVSS.info('Result ('+command+')',timestamp=1,type=PVSS.UNEXPECTEDSTATE)
             if result == "WAS_NOT_ALLOCATED":
               msg = '[WAS_NOT_ALLOCATED] Ignore Error on deallocate on request from Clara'
               PVSS.error(msg,timestamp=1,type=PVSS.UNEXPECTEDSTATE)
               #result=None
             if result is not None:
               return self.makeAnswer(command,answer+'/'+result)
           elif command == "RECOVER":
             result = self.doExecute('recover',runDpName,partition)
           if result is not None:
             #print answer+'/'+result
             return self.makeAnswer('READY',answer+'/'+result)
           msg = 'The command:"'+cmd+'" failed. [Internal Error] '
           PVSS.error(msg,timestamp=1,type=PVSS.UNEXPECTEDSTATE)
           return self.makeAnswer('ERROR',answer)
         except Exception,X:
           PVSS.error('The command:"'+cmd+'" failed:'+str(X),timestamp=1,type=PVSS.ILLEGAL_ARG)
           traceback.print_exc()
           return self.makeAnswer('ERROR',answer)
         except:
           PVSS.error('The command:"'+cmd+'" failed (Unknown exception)',timestamp=1,type=PVSS.ILLEGAL_ARG)
           traceback.print_exc()
           return self.makeAnswer('ERROR',answer)