コード例 #1
0
ファイル: FSMTree.py プロジェクト: hackerlank/lhcb-software
 def show(self, devices=0):
     mgr = self.manager
     actor1 = PVSS.DpVectorActor(mgr)
     actor2 = PVSS.DpVectorActor(mgr)
     if devices:
         typ = self.manager.typeMgr().type('_FwFsmDevice')
     else:
         typ = self.manager.typeMgr().type('_FwFsmObject')
     actor1.lookup(
         DataPoint.original(self.name + '|' + self.name +
                            '*.fsm.currentState'), typ)
     actor2.lookup(
         DataPoint.original(self.name + '|' + self.name + '*.mode.enabled'),
         typ)
     print typ.name(), actor1.container.size()
     for i in actor1.container:
         self.reader.add(i)
     for i in actor2.container:
         self.reader.add(i)
     if self.reader.execute(0, 1):
         for num in xrange(actor1.container.size()):
             i = actor1.container[num]
             j = actor2.container[num]
             n = i.name()
             n = n[n.find('|') + 1:]
             n = n[:n.find('.fsm.currentState:')]
             if j.data < 0: continue
             if n[len(n) - 4:] == "_FWM": continue
             if n[len(n) - 5:] == "_FWDM": continue
             if n[len(n) - 6:] == "_FWCNM": continue
             print "%-100s %-16s %d" % (n, i.data, j.data)
コード例 #2
0
 def _connectItem(self, itm, pf=''):
     match = '*'
     actor = PVSS.DpVectorActor(mgr)
     lookup = self.partition + itm + match + itm + match + itm[:-1] + pf + '.fsm.currentState'
     actor.lookup(DP.original(lookup), self.typ)
     if s_debug: print 'Size:', lookup, actor.container.size()
     return actor
コード例 #3
0
 def slices(self):
     rdr = self.manager.devReader()
     actor = PVSS.DpVectorActor(self.manager)
     names = PVSS.DpVectorActor(self.manager)
     typ = self.manager.typeMgr().type('RecoFarmSlice')
     actor.lookupOriginal(self.dpName + '_Slice*.InUse', typ)
     names.lookupOriginal(self.dpName + '_Slice*.Name', typ)
     rdr.add(actor.container)
     rdr.add(names.container)
     if rdr.execute():
         slices = []
         num = len(actor.container)
         for j in xrange(num):
             slices.append(
                 (names.container[j].data, actor.container[j].data))
         return slices
     return None
コード例 #4
0
ファイル: Allocator.py プロジェクト: hackerlank/lhcb-software
 def _collectScriptPath(self, mgr):
     typ = mgr.typeMgr().type('JobOptionsTaskType')
     scripts = []
     if typ:
         o1 = PVSS.DpVectorActor(mgr)
         o2 = PVSS.DpVectorActor(mgr)
         o3 = PVSS.DpVectorActor(mgr)
         o1.lookupOriginal('JobOptionsTaskType_*.ScriptPath', typ)
         o2.lookupOriginal('JobOptionsTaskType_*.RunAs', typ)
         o3.lookupOriginal('JobOptionsTaskType_*.Detector', typ)
         w = mgr.devReader()
         w.add(o1.container)
         w.add(o2.container)
         w.add(o3.container)
         w.execute()
         for idx in xrange(len(o1.container)):
             i = o1.container[idx]
             j = o2.container[idx]
             k = o3.container[idx]
             n = i.name()[i.name().find('_') + 1:]
             scripts.append((n[:n.find('.')], i.data, j.data, k.data))
     return scripts
コード例 #5
0
def make_run_info(match):
    actor = PVSS.DpVectorActor(mgr)
    lookup = partition + '_RunInfo.'
    start = len(lookup)
    lookup = lookup + match
    type = mgr.typeMgr().type('RunInfo')
    actor.lookup(DP.original(lookup), type)
    rd.add(actor.container)
    rd.execute()
    look = lookup[:start]
    for i in actor.container:
        nam = i.name()
        nam = nam[nam.find(look) + len(look):nam.find(':_original..')]
        print '%-24s %s' % (nam, i.data)
コード例 #6
0
 def __init__(self,manager):
   self.manager = manager
   typ = self.manager.typeMgr().type('StreamPartition')
   self.slices = PVSS.DpVectorActor(self.manager)
   self.slices.lookupOriginal('*_Slice??.InUse',typ)
   self.sensor = PVSS.DeviceSensor(self.manager,self.slices.container)
   PVSS.PyDeviceListener.__init__(self,self,manager)
   log('Starting display server on system:'+self.manager.name(),timestamp=1)
   self.servers = {}
   for i in self.slices.container:
     self.servers[i.name()] = None
   rdr = self.manager.devReader()
   rdr.add(self.slices.container)
   rdr.execute()
   self.handleDevices()
コード例 #7
0
ファイル: Allocator.py プロジェクト: hackerlank/lhcb-software
 def showSummary(self, extended=None):
     actor = PVSS.DpVectorActor(self.manager)
     typ = self.manager.typeMgr().type('StreamPartition')
     actor.lookupOriginal(self.name + '_Slice*.Name', typ)
     partitions = []
     log('Stream Control contains a total of ' + str(len(actor.container)) +
         ' partitions',
         timestamp=1)
     for i in xrange(len(actor.container)):
         nam = actor.container[i].name()
         nam = nam[nam.find(':') + 1:nam.find('.')]
         partitions.append(PartitionInfo.PartitionInfo(self.manager, nam))
     for i in partitions:
         self.reader.add(i.datapoints)
     self.load()
     StreamingDescriptor.show(self, extended)
     return partitions
コード例 #8
0
def findPartition(manager, name, partition):
    "Select partition by allocation name."
    actor = PVSS.DpVectorActor(manager)
    typ = manager.typeMgr().type('StreamPartition')
    rdr = manager.devReader()
    actor.lookupOriginal(name + '_Slice??.Name', typ)
    for i in actor.container:
        rdr.add(i)
    if rdr.execute():
        for i in actor.container:
            nam = i.name()
            nam = nam[nam.find(':') + 1:nam.find('.')]
            id = int(nam[len(nam) - 2:], 16)
            # print i.data,partition
            if i.data == partition:
                return (i.name(), nam, id)
        return None
    return None
コード例 #9
0
def installPartitions():
    actor = PVSS.DpVectorActor(mgr)
    actor = JobOptions._getDevices('RunInfo', '', mgr, 0)
    actor.lookup('*_RunInfo', mgr.typeMgr().type('RunInfo'))
    for i in actor.container:
        name = i.name()
        name = name[name.find(':') + 1:]
        name = name[:name.find('_')]
        log('Partition:' + name, timestamp=1)
        run = StorageInfo.StorageInfo(mgr, name)
        run.load()
        p = JobOptions.Partition(mgr, name)
        if not p.exists():
            p.create()
            p.load()
        p.activity.data = run.runTyp.id()
        p.partID.data = run.partID.id()
        p.Tell1.data = run.tell1Boards.id()
        p.save()
コード例 #10
0
 def __init__(self, manager):
     self.manager = manager
     self.do_sleep = 1
     typ = self.manager.typeMgr().type('StreamPartition')
     self.slices = PVSS.DpVectorActor(self.manager)
     self.slices.lookupOriginal('*_Slice??.InUse', typ)
     self.sensor = PVSS.DeviceSensor(self.manager, self.slices.container)
     PVSS.PyDeviceListener.__init__(self, self, manager)
     log('Starting display server on system:' + self.manager.name(),
         timestamp=mk_timestamps)
     self.servers = {}
     for i in self.slices.container:
         self.servers[i.name()] = None
     rdr = self.manager.devReader()
     rdr.add(self.slices.container)
     rdr.execute()
     upi.attach_terminal()
     Online.Utils.makePrint = upi.write_message
     self.menu = ManagerMenu(self.manager, self)
コード例 #11
0
ファイル: Simulator.py プロジェクト: hackerlank/lhcb-software
 def run(self):
     mgr = self.manager
     actor = PVSS.DpVectorActor(mgr)
     typ = self.manager.typeMgr().type('FSM_DimTask')
     actor.lookup(self.name + '*', typ)
     #actor.lookup(DataPoint.original(self.name+'_Slice*.Name'),typ)
     print typ.name(), actor.container.size()
     for i in actor.container:
         print i.name()
         item = []
         cmd = DataPoint.original(i.name() + '.Command')
         item.append(i.name())
         item.append(DataPoint(mgr,
                               DataPoint.original(i.name() + '.State')))
         item.append(DataPoint(mgr, cmd))
         item.append(PVSS.DeviceSensor(mgr, item[2]))
         item[3].addListener(self)
         item[3].run(1)
         self.tasks[cmd] = item
コード例 #12
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
コード例 #13
0
def load_det_sub_item(itm, match):
    actor = PVSS.DpVectorActor(mgr)
    lookup = partition + itm + match + itm + match + itm[:-1] + '.fsm.currentState'
    #print 'Lookup:',lookup
    actor.lookup(DP.original(lookup), typ)
    rd.add(actor.container)
    rd.execute()
    state = {}
    c = actor.container
    for i in xrange(c.size()):
        print i, c.at(i).name(), c.at(i).data
    for i in actor.container:
        n = i.name()
        n = n[n.find('|') + 1:n.find('.fsm.currentState:')]
        n = n[:n.find(itm)]
        #print n, i.name(),i.data
        if not state.has_key(n):
            state[n] = []
        state[n].append(i.data)
    return state
コード例 #14
0
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
コード例 #15
0
def runFarm(project,name):
  """
   Arguments:
   @param name        System name
   @author M.Frank
  """
  import Online.PVSS as PVSS;
  import Online.AllocatorControl as Control
  import Online.ProcessorFarm.FarmDescriptor as Farm
  mgr  = _mgr(project)
  if name=='Unknown':
    rdr = mgr.devReader()
    actor = PVSS.DpVectorActor(mgr)
    typ   = mgr.typeMgr().type('FarmInfo')
    actor.lookupOriginal('*.Name',typ)
    if len(actor.container)>0:
      rdr.add(actor.container)
      if rdr.execute():
        name = actor.container[0].data
  print '---> Starting controller for farm:',name

  farm = Farm.FarmConfigurator(mgr,name)
  ctrl = Control.Control(mgr,name,'Alloc',[farm]).run()
  return (ctrl,mgr)
コード例 #16
0
    def createModifyDelete(self):
        nam = 'test_device_01'
        actor = PVSS.DpVectorActor(self.mgr)
        typ = self.typeMgr.type('ExampleDP_BarTrend')
        device = self.devMgr.createDevice(nam, typ, 1)
        if device.get() is None:
            print '--> Failed to create device "' + nam + '" of type ', typ.name(
            )
            return None
        print '--> Successfully created datapoint:', nam, ' of type ', typ.name(
        )

        actor.lookupOriginal(nam + '.*', typ)
        print 'Found %d datapoints of type %s' % (actor.container.size(), nam)
        self.reader.add(actor.container)
        if not self.reader.execute():
            print '--> Could not access datapoint:', DataPoint.original(nam)
            return None
        actor.container[0].data = std.vector('float')()
        actor.container[1].data = std.vector('float')()
        actor.container[2].data = std.vector('float')()
        actor.container[3].data = std.vector('float')()
        actor.container[4].data = std.vector('float')()
        actor.container[5].data = std.vector('float')()
        actor.container[6].data = std.vector('float')()
        actor.container[7].data = std.vector('float')()
        actor.container[8].data = std.vector('int')()
        actor.container[9].data = std.vector('int')()
        for i in xrange(10):
            f = float(i)
            actor.container[0].data.push_back(f)
            actor.container[1].data.push_back(2 * f)
            actor.container[2].data.push_back(3 * f)
            actor.container[3].data.push_back(4 * f)
            actor.container[4].data.push_back(5 * f)
            actor.container[5].data.push_back(6 * f)
            actor.container[6].data.push_back(7 * f)
            actor.container[7].data.push_back(8 * f)
            actor.container[8].data.push_back(9 * i)
            actor.container[9].data.push_back(10 * i)

        wr = self.mgr.devWriter()
        wr.add(actor.container)
        if not wr.execute():
            print '--> Could not access datapoint:', DataPoint.original(nam)
            return None

        self.reader.add(actor.container)
        if self.reader.execute():
            f = 0
            for i in actor.container:
                f = f + 1
                bad = False
                for j in xrange(i.data.size()):
                    if i.data[j] != f * j:
                        print '--> Bad data: found', i.data[j], 'in', i.name(
                        ), '[', j, ']  Expected:', f * j
                        bad = True
                if bad:
                    print '--> %-12s Datapoint:%-48s %d  ##Elem:%d Data BAD' % (
                        nam, i.name(), i.value().type(), i.data.size())
                else:
                    print '--> %-12s Datapoint:%-48s %d  ##Elem:%d Data OK' % (
                        nam, i.name(), i.value().type(), i.data.size())
        else:
            print '--> Could not access datapoint:', DataPoint.original(nam)
            return None
        if not self.devMgr.deleteDevice(nam, 1):
            print '--> Failed to delete datapoint:', nam, ' of type ', typ.name(
            )
            return None
        print '--> Successfully deleted datapoint:', nam, ' of type ', typ.name(
        )
        return self
コード例 #17
0
ファイル: Allocator.py プロジェクト: hackerlank/lhcb-software
 def _tskLookup(self, dp, type):
     obj = PVSS.DpVectorActor(self.manager)
     obj.lookupOriginal(self.name + '_' + self.match + '.' + dp, type)
     return obj