def create(self):
        recvNodes = std.vector('std::string')()
        strmNodes = std.vector('std::string')()
        for i in self.recvNodes:
            recvNodes.push_back(i)
        for i in self.strmNodes:
            strmNodes.push_back(i)
        dm = self.manager.deviceMgr()
        typ = self.manager.typeMgr().type('StreamControl')
        device = dm.createDevice(self.name, typ, 1)
        if device.get() is None:
            Utils.warning('Failed to create device "' + self.name + '"',
                          timestamp=1)
        partitions = PVSS.DpIDVector()
        errs = 0
        self.dps.clear()
        infos = []
        for i in xrange(self.numPartition):
            slice = '_Slice%02X' % (i, )
            p = PartitionInfo.create(self.manager, self.system + slice,
                                     self.system + 'Config' + slice)
            if p:
                partitions.push_back(p[0].id())
                infos.append(p)
            else:
                Utils.error("Errors occurred during device creation.",
                            timestamp=1)
                return

        self.set('Command', '')
        self.set('State', 'UNKNOWN')
        self.set('PartitionDesc', partitions)
        self.set('InUse', std.vector('int')(16, 0))
        self.set('ActivePartitions', std.vector('std::string')())
        slices = std.vector('std::string')(self.numRecvSlices, '')
        nodes = {}
        for i in xrange(self.numRecvSlices):
            node = self.recvNodes[i % len(self.recvNodes)]
            if not nodes.has_key(node): nodes[node] = 0
            nodes[node] = nodes[node] + 1
            slices[i] = node + ":%02d" % nodes[node]
        self.set('RecvNodes', recvNodes)
        self.set('RecvSlices', slices)
        slices.resize(self.numStreamSlices, '')
        nodes = {}
        for i in xrange(self.numStreamSlices):
            node = self.strmNodes[i % len(self.strmNodes)]
            if not nodes.has_key(node): nodes[node] = 0
            nodes[node] = nodes[node] + 1
            slices[i] = node + ":%02d" % nodes[node]
        self.set('StreamNodes', strmNodes)
        self.set('StreamSlices', slices)
        self.set('Setup.NumRecvNodes', len(self.recvNodes))
        self.set('Setup.NumRecvSlices',
                 self.numRecvSlices / len(self.recvNodes))
        self.set('Setup.NumStrmNodes', len(self.strmNodes))
        self.set('Setup.NumStrmSlices',
                 self.numStreamSlices / len(self.strmNodes))
        return self.write(prefix='StreamControl(' + self.name + '): ')
Beispiel #2
0
    def create(self):
        relayNodes = std.vector('std::string')()
        monNodes = std.vector('std::string')()
        for i in self.relayNodes:
            relayNodes.push_back(i)
        for i in self.monNodes:
            monNodes.push_back(i)
        dm = self.manager.deviceMgr()
        typ = self.manager.typeMgr().type('StreamControl')
        device = dm.createDevice(self.name, typ, 1)
        if device.get() is None:
            Utils.warning('Failed to create device "' + self.name + '"')
        partitions = PVSS.DpIDVector()
        errs = 0
        self.dps.clear()
        infos = []
        for i in xrange(self.numPartition):
            slice = '_Slice%02X' % (i, )
            p = PartitionInfo.create(self.manager, self.system + slice,
                                     self.system + slice + '_Config')
            if p:
                partitions.push_back(p[0].id())
                infos.append(p)
            else:
                Utils.error("Errors occurred during device creation.")
                return
        self.set('Command', 'unload')
        self.set('State', 'NOT_READY')
        self.set('PartitionDesc', partitions)
        self.set('InUse', std.vector('int')(16, 0))
        self.set('ActivePartitions', std.vector('std::string')())
        length = len(self.monNodes) * self.numStreams
        relay_slices = std.vector('std::string')(length, '')
        nodes = {}
        for i in xrange(length):
            node = self.relayNodes[i % len(self.relayNodes)]
            if not nodes.has_key(node): nodes[node] = 0
            nodes[node] = nodes[node] + 1
            relay_slices[i] = node + ":%02d" % nodes[node]
        self.set('RecvNodes', relayNodes)
        self.set('RecvSlices', relay_slices)

        length = len(self.monNodes) * self.numWorkersPerNode
        worker_slices = std.vector('std::string')(length, '')
        nodes = {}
        for i in xrange(length):
            node = self.monNodes[i % len(self.monNodes)]
            if not nodes.has_key(node): nodes[node] = 0
            nodes[node] = nodes[node] + 1
            worker_slices[i] = node + ":%02d" % nodes[node]
        self.set('StreamNodes', monNodes)
        self.set('StreamSlices', worker_slices)
        self.set('Setup.NumRecvNodes', len(self.relayNodes))
        self.set('Setup.NumRecvSlices', self.numStreams)
        self.set('Setup.NumStrmNodes', len(self.monNodes))
        self.set('Setup.NumStrmSlices', self.numWorkersPerNode)
        return self.write(prefix='StreamControl(' + self.name + '): ')
Beispiel #3
0
def error(message, timestamp=None, type=default_error_type):
    "Sever error printout to logger window"
    Utils.error(message, timestamp=timestamp)
    logger.error(type, message)