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()
Beispiel #2
0
    def defineTasks(self, partition):
        """
    Define all tasks in the storage layer for a given partition.
    The result is storen in runInfo datapoints for further processing.
    
    """
        recv_slots = partition.recvSlices()
        streams = []
        #
        # Need to change order in this loop to better distribute the tasks
        # in the storage layers:
        #
        num_streams = 0
        for j in xrange(len(self.streams.data)):
            for i in xrange(self.strMult.data[j]):
                streams.append([self.streams.data[j], i])
                num_streams = num_streams + 1

        recvNodes = partition.recvNodesFromSlots()
        dimDns = self.manager.hostName()
        streamers = []
        dataSources = []
        recvWriters = []
        recvReceivers = []
        recvInfrastructure = []
        opt = '/' + dimDns + '/' + partition.manager.name(
        ) + '/' + partition.name + '/'
        cl0 = '/Class0' + opt
        cl1 = '/Class1' + opt
        cl2 = '/Class2' + opt
        for i in xrange(len(recv_slots)):
            slot = recv_slots[i]
            node = slot[:slot.find(':')]
            sub_farm = 'SF%02d' % (i, )
            short_name = sub_farm + '_HLT'
            task = self.name + '_' + node + '_' + short_name
            recvReceivers.append(node + '/' + task + '/' + short_name +
                                 '/HLTRec' + cl1 + '("' + sub_farm + '",)')
            dataSources.append(sub_farm + '/' + self.name + '_' + sub_farm +
                               '_Sender/' + sub_farm + '_Sender/HLTSend' +
                               cl2 + '("' + node + ',' + task + '",)')

        for j in recvNodes:
            for i in streams:
                type = i[0]
                ident = str(i[1])
                short_name = type + '_' + ident
                sender = self.name + '_' + j + '_WRT' + short_name
                recvWriters.append(j + '/' + sender + '/WRT' + short_name +
                                   '/WRT' + type + cl1 + '[("' + j + '-d1")]')
            for i in self.rcvInfra.data:
                recvInfrastructure.append(j + '/' + self.name + '_' + j + '_' +
                                          i + '/' + i + '/' + i + cl0 + '("' +
                                          i + '",)')

        if self.storeFlag.data == 0:
            # If we do not store the data, the streaming layer does not have to be instrumented.
            recvWriters = PVSS.StringVector()
        empty = PVSS.StringVector()
        partition.setDataSources(dataSources)
        partition.setRecvInfrastructure(recvInfrastructure)
        partition.setRecvReceivers(recvReceivers)
        partition.setRecvSenders(recvWriters)
        partition.setStreamInfrastructure(empty)
        partition.setStreamReceivers(empty)
        partition.setStreamSenders(empty)
        if partition.saveTasks():
            tasks = partition.collectTasks(tasks={}, with_data_sources=0)
            return tasks
        return None