Ejemplo n.º 1
0
    def __checkCluster(self, clusterName, cfgName, expNodes, spadeDir,
                       logCopyDir):
        cfg = DAQConfigParser.load(cfgName, RunClusterTest.CONFIG_DIR)

        cluster = RunCluster(cfg, clusterName, RunClusterTest.CONFIG_DIR)

        self.assertEquals(cluster.configName(), cfgName,
                          'Expected config name %s, not %s' %
                          (cfgName, cluster.configName()))

        for node in cluster.nodes():
            for comp in node.components():
                found = False
                for en in expNodes:
                    if en.matches(node.hostName(), comp.name(), comp.id()):
                        found = True
                        en.markFound()
                        break
                if not found:
                    self.fail('Did not expect %s component %s' %
                              (node.hostName(), str(comp)))

        for en in expNodes:
            if not en.isFound():
                self.fail('Did not find expected component %s' % str(en))

        hubList = cluster.getHubNodes()

        self.assertEqual(cluster.logDirForSpade(), spadeDir,
                         'SPADE log directory is "%s", not "%s"' %
                         (cluster.logDirForSpade(), spadeDir))
        self.assertEqual(cluster.logDirCopies(), logCopyDir,
                         'Log copy directory is "%s", not "%s"' %
                         (cluster.logDirCopies(), logCopyDir))
Ejemplo n.º 2
0
    def testLookupSim5(self):
        metaDir = self.initPDAQHome()
        cfg = DAQConfigParser.load("simpleConfig", metaDir + "/config")

        dataList = (('53494d550101', 'Nicholson_Baker', 1001,
                     1), ('53494d550120', 'SIM0020', 1001,
                          20), ('53494d550140', 'SIM0040', 1001,
                                40), ('53494d550160', 'SIM0060', 1001, 60),
                    ('53494d550201', 'SIM0065', 1002,
                     1), ('53494d550220', 'SIM0084', 1002,
                          20), ('53494d550240', 'SIM0104', 1002,
                                40), ('53494d550260', 'SIM0124', 1002, 60),
                    ('53494d550301', 'SIM0129', 1003,
                     1), ('53494d550320', 'SIM0148', 1003,
                          20), ('53494d550340', 'SIM0168', 1003,
                                40), ('53494d550360', 'SIM0188', 1003, 60),
                    ('53494d550401', 'SIM0193', 1004,
                     1), ('53494d550420', 'SIM0212', 1004,
                          20), ('53494d550440', 'SIM0232', 1004,
                                40), ('53494d550460', 'SIM0252', 1004, 60),
                    ('53494d550501', 'SIM0257', 1005,
                     1), ('53494d550520', 'SIM0276', 1005,
                          20), ('53494d550540', 'SIM0296', 1005,
                                40), ('53494d550560', 'SIM0316', 1005, 60))

        self.lookup(cfg, dataList)
Ejemplo n.º 3
0
    def testListsSpsIC40IT6(self):
        metaDir = self.initPDAQHome()
        cfg = DAQConfigParser.load("sps-IC40-IT6-AM-Revert-IceTop-V029",
                                   metaDir + "/config")

        expected = [
            'amandaTrigger', 'eventBuilder', 'globalTrigger', 'iceTopTrigger',
            'inIceTrigger', 'secondaryBuilders', 'stringHub#0', 'stringHub#21',
            'stringHub#29', 'stringHub#30', 'stringHub#38', 'stringHub#39',
            'stringHub#40', 'stringHub#44', 'stringHub#45', 'stringHub#46',
            'stringHub#47', 'stringHub#48', 'stringHub#49', 'stringHub#50',
            'stringHub#52', 'stringHub#53', 'stringHub#54', 'stringHub#55',
            'stringHub#56', 'stringHub#57', 'stringHub#58', 'stringHub#59',
            'stringHub#60', 'stringHub#61', 'stringHub#62', 'stringHub#63',
            'stringHub#64', 'stringHub#65', 'stringHub#66', 'stringHub#67',
            'stringHub#68', 'stringHub#69', 'stringHub#70', 'stringHub#71',
            'stringHub#72', 'stringHub#73', 'stringHub#74', 'stringHub#75',
            'stringHub#76', 'stringHub#77', 'stringHub#78', 'stringHub#201',
            'stringHub#202', 'stringHub#203', 'stringHub#206'
        ]

        comps = cfg.components()

        self.assertEqual(
            len(expected), len(comps),
            "Expected %d components (%s), not %d (%s)" %
            (len(expected), str(expected), len(comps), str(comps)))

        for c in comps:
            try:
                expected.index(c.fullName())
            except:
                self.fail('Unexpected component "%s"' % c)
Ejemplo n.º 4
0
    def testReplay(self):
        metaDir = self.initPDAQHome()
        cfg = DAQConfigParser.load("replay-ic22-it4", metaDir + "/config")

        expected = [
            'eventBuilder', 'globalTrigger', 'iceTopTrigger', 'inIceTrigger',
            'replayHub#21', 'replayHub#29', 'replayHub#30', 'replayHub#38',
            'replayHub#39', 'replayHub#40', 'replayHub#46', 'replayHub#47',
            'replayHub#48', 'replayHub#49', 'replayHub#50', 'replayHub#56',
            'replayHub#57', 'replayHub#58', 'replayHub#59', 'replayHub#65',
            'replayHub#66', 'replayHub#67', 'replayHub#72', 'replayHub#73',
            'replayHub#74', 'replayHub#78', 'replayHub#201', 'replayHub#202',
            'replayHub#203', 'replayHub#204'
        ]
        comps = cfg.components()

        self.assertEqual(
            len(expected), len(comps),
            "Expected %d components (%s), not %d (%s)" %
            (len(expected), str(expected), len(comps), str(comps)))

        for c in comps:
            try:
                expected.index(c.fullName())
            except:
                self.fail('Unexpected component "%s"' % c)
Ejemplo n.º 5
0
    def testClusterFile(self):
        cfg = DAQConfigParser.load("simpleConfig", RunClusterTest.CONFIG_DIR)

        cluster = RunCluster(cfg, "localhost", RunClusterTest.CONFIG_DIR)

        cluster.clearActiveConfig()

        cluster.writeCacheFile(False)
        cluster.writeCacheFile(True)
Ejemplo n.º 6
0
    def testLookupSpsIC40IT6(self):
        metaDir = self.initPDAQHome()
        cfg = DAQConfigParser.load("sps-IC40-IT6-AM-Revert-IceTop-V029",
                                   metaDir + "/config")

        dataList = (
            ('737d355af587', 'Bat', 21, 1),
            ('499ccc773077', 'Werewolf', 66, 6),
            ('efc9607742b9', 'Big_Two_Card', 78, 60),
            ('1e5b72775d19', 'AMANDA_SYNC_DOM', 0, 91),
            ('1d165fc478ca', 'AMANDA_TRIG_DOM', 0, 92),
        )

        self.lookup(cfg, dataList)
Ejemplo n.º 7
0
    def testDumpDOMs(self):
        metaDir = self.initPDAQHome()
        cfg = DAQConfigParser.load("sps-IC40-IT6-AM-Revert-IceTop-V029",
                                   metaDir + "/config")

        for d in cfg.getAllDOMs():
            mbid = str(d)
            if len(mbid) != 12 or mbid.startswith(" "):
                self.fail("DOM %s(%s) has bad MBID" % (mbid, d.name()))
            n = 0
            if str(d).startswith("0"):
                n += 1
                nmid = cfg.getIDbyName(d.name())
                if nmid != mbid:
                    self.fail("Bad IDbyName value \"%s\" for \"%s\"" %
                              (nmid, mbid))

                newid = cfg.getIDbyStringPos(d.string(), d.pos())
                if newid.startswith(" ") or len(newid) != 12:
                    self.fail("Bad IDbyStringPos value \"%s\" for \"%s\" %d" %
                              (newid, mbid, n))
Ejemplo n.º 8
0
    def testListsSim5(self):
        metaDir = self.initPDAQHome()
        cfg = DAQConfigParser.load("simpleConfig", metaDir + "/config")

        expected = [
            'eventBuilder', 'globalTrigger', 'inIceTrigger',
            'secondaryBuilders', 'stringHub#1001', 'stringHub#1002',
            'stringHub#1003', 'stringHub#1004', 'stringHub#1005'
        ]

        comps = cfg.components()

        self.assertEqual(
            len(expected), len(comps),
            "Expected %d components (%s), not %d (%s)" %
            (len(expected), str(expected), len(comps), str(comps)))

        for c in comps:
            try:
                expected.index(c.fullName())
            except:
                self.fail('Unexpected component "%s"' % c)
Ejemplo n.º 9
0
        print >> fd, "</icecube>"


if __name__ == "__main__":
    clusterName = "sps"
    cfgList = []
    usage = False

    # configExists has a keyword argument that builds a dir
    # like this.  load( does not and wants a directory
    # to stay consistent use the same construction
    # in both places
    configDir = os.path.join(metaDir, "config")

    for arg in sys.argv[1:]:
        if not DAQConfigParser.configExists(arg, configDir=configDir):
            print >> sys.stderr, "Could not find run config: %s" % arg
            usage = True
        else:
            cfgList.append(arg)

    if usage:
        print >> sys.stderr, "Usage: %s runConfig" % sys.argv[0]
        raise SystemExit

    ccc = ClusterConfigCreator(clusterName)
    for cfgName in cfgList:
        runCfg = DAQConfigParser.load(cfgName, configDir)

        ccc.write(sys.stdout, runCfg)
Ejemplo n.º 10
0
    def makeRunset(self,
                   runConfigDir,
                   runConfigName,
                   timeout,
                   logger,
                   forceRestart=True,
                   strict=True):
        "Build a runset from the specified run configuration"
        logger.info("Loading run configuration \"%s\"" % runConfigName)
        runConfig = DAQConfigParser.load(runConfigName, runConfigDir, strict)
        logger.info("Loaded run configuration \"%s\"" % runConfigName)

        nameList = []
        for c in runConfig.components():
            nameList.append(c.fullName())

        if nameList is None or len(nameList) == 0:
            raise CnCServerException("No components found in" +
                                     " run configuration \"%s\"" % runConfig)

        compList = []
        try:
            waitList = self.__collectComponents(nameList, compList, logger,
                                                timeout)
            if waitList is not None:
                raise CnCServerException("Still waiting for " + str(waitList))
        except:
            self.__returnComponents(compList, logger)
            raise

        setAdded = False
        try:
            try:
                runSet = self.createRunset(runConfig, compList, logger)
            except:
                runSet = None
                raise

            self.__addRunset(runSet)
            setAdded = True
        finally:
            if not setAdded:
                self.__returnComponents(compList, logger)
                runSet = None

        if runSet is not None:
            if self.__defaultDebugBits is not None:
                runSet.setDebugBits(self.__defaultDebugBits)

            try:
                connMap = runSet.buildConnectionMap()
                runSet.connect(connMap, logger)
                runSet.setOrder(connMap, logger)
                runSet.configure()
            except:
                if not forceRestart:
                    self.returnRunset(runSet, logger)
                else:
                    self.restartRunset(runSet, logger)
                raise

            setComps = []
            for c in runSet.components():
                setComps.append(c.fullName())
            logger.info("Built runset #%d: %s" % (runSet.id(), setComps))

        return runSet
Ejemplo n.º 11
0
            if clusterDesc is not None:
                raise Exception("Cannot specify multiple cluster descriptions")
            if len(name) > 2:
                clusterDesc = name[2:]
            else:
                grabDesc = True
            continue

        if os.path.basename(name) == 'default-dom-geometry.xml':
            # ignore
            continue

        nameList.append(name)

    for name in nameList:
        cfg = DAQConfigParser.load(name, configDir)
        try:
            runCluster = RunCluster(cfg, clusterDesc)
        except NotImplementedError, ue:
            print >>sys.stderr, 'For %s:' % name
            traceback.print_exc()
            continue
        except KeyboardInterrupt:
            break
        except:
            print >>sys.stderr, 'For %s:' % name
            traceback.print_exc()
            continue

        print 'RunCluster: %s (%s)' % \
            (runCluster.configName(), runCluster.descName())