Ejemplo n.º 1
0
    def testInit(self):
        """
        Test constructor
        """

        cmssw = CMSSW(config=testWMConfig, logger=self.logger, workingdir=None)
        cmssw.run(self.reqConfig)
Ejemplo n.º 2
0
    def testInit(self):
        """
        Test constructor
        """

        cmssw = CMSSW(config=testWMConfig, logger=self.logger, workingdir=None)
        cmssw.run(self.reqConfig)
Ejemplo n.º 3
0
 def testSandbox(self):
     """
     Make sure userSandbox is set and it creates a sandbox
     """
     cmssw = CMSSW(config=testWMConfig, logger=self.logger, workingdir=None)
     tarFileName, configArguments = cmssw.run(self.reqConfig)
     self.assertTrue(configArguments["userSandbox"])
     self.assertTrue(os.path.getsize(tarFileName) > 0)
Ejemplo n.º 4
0
 def testScramOut(self):
     """
     Make sure return arguments contain SCRAM info
     """
     cmssw = CMSSW(config=testWMConfig, logger=self.logger, workingdir=None)
     _dummy, configArguments = cmssw.run(self.reqConfig)
     self.assertEqual(configArguments["ScramArch"], os.environ["SCRAM_ARCH"])
     self.assertEqual(configArguments["CMSSWVersion"], os.environ["CMSSW_VERSION"])
Ejemplo n.º 5
0
 def testSandbox(self):
     """
     Make sure userSandbox is set and it creates a sandbox
     """
     cmssw = CMSSW(config=testWMConfig, logger=self.logger, workingdir=None)
     tarFileName, configArguments = cmssw.run(self.reqConfig)
     self.assertTrue(configArguments['userSandbox'])
     self.assertTrue(os.path.getsize(tarFileName) > 0)
Ejemplo n.º 6
0
 def testOutputFiles(self):
     """
     Make sure return arguments are modified to reflect files
     to be written
     """
     outputFiles = ["histograms.root", "output.root", "output2.root"]
     cmssw = CMSSW(config=testWMConfig, logger=self.logger, workingdir=None)
     _dummy, configArguments = cmssw.run(self.reqConfig)
     self.assertEqual(configArguments["outputFiles"], outputFiles)
Ejemplo n.º 7
0
 def testSpecKeys(self):
     """
     Make sure return arguments contain other stuff eventually in WMSpec
     """
     cmssw = CMSSW(config=testWMConfig, logger=self.logger, workingdir=None)
     _dummy, configArguments = cmssw.run(self.reqConfig)
     self.assertTrue(len(configArguments["InputDataset"]) > 0)
     self.assertTrue(configArguments.has_key("ProcessingVersion"))
     self.assertTrue(configArguments.has_key("AnalysisConfigCacheDoc"))
Ejemplo n.º 8
0
 def testNoInputFiles(self):
     """
     Make sure userSandbox is set and it creates a sandbox even if inputFiles are not set
     """
     del testWMConfig.JobType.inputFiles
     cmssw = CMSSW(config=testWMConfig, logger=self.logger, workingdir=None)
     tarFileName, configArguments = cmssw.run(self.reqConfig)
     self.assertTrue(configArguments["userSandbox"])
     self.assertTrue(os.path.getsize(tarFileName) > 0)
Ejemplo n.º 9
0
 def testOutputFiles(self):
     """
     Make sure return arguments are modified to reflect files
     to be written
     """
     outputFiles = ['histograms.root', 'output.root', 'output2.root']
     cmssw = CMSSW(config=testWMConfig, logger=self.logger, workingdir=None)
     _dummy, configArguments = cmssw.run(self.reqConfig)
     self.assertEqual(configArguments['outputFiles'], outputFiles)
Ejemplo n.º 10
0
 def testSpecKeys(self):
     """
     Make sure return arguments contain other stuff eventually in WMSpec
     """
     cmssw = CMSSW(config=testWMConfig, logger=self.logger, workingdir=None)
     _dummy, configArguments = cmssw.run(self.reqConfig)
     self.assertTrue(len(configArguments['InputDataset']) > 0)
     self.assertTrue('ProcessingVersion' in configArguments)
     self.assertTrue('AnalysisConfigCacheDoc' in configArguments)
Ejemplo n.º 11
0
 def testNoInputFiles(self):
     """
     Make sure userSandbox is set and it creates a sandbox even if inputFiles are not set
     """
     del testWMConfig.JobType.inputFiles
     cmssw = CMSSW(config=testWMConfig, logger=self.logger, workingdir=None)
     tarFileName, configArguments = cmssw.run(self.reqConfig)
     self.assertTrue(configArguments['userSandbox'])
     self.assertTrue(os.path.getsize(tarFileName) > 0)
Ejemplo n.º 12
0
 def testScramOut(self):
     """
     Make sure return arguments contain SCRAM info
     """
     cmssw = CMSSW(config=testWMConfig, logger=self.logger, workingdir=None)
     _dummy, configArguments = cmssw.run(self.reqConfig)
     self.assertEqual(configArguments['ScramArch'],
                      os.environ['SCRAM_ARCH'])
     self.assertEqual(configArguments['CMSSWVersion'],
                      os.environ['CMSSW_VERSION'])
Ejemplo n.º 13
0
    def testValidateConfig(self):
        """
        Validate config, done as part of the constuctor
        """
        origConfig = copy.deepcopy(testWMConfig)

        # Make sure the original config works
        cmssw = CMSSW(config=origConfig, logger=self.logger, workingdir=None)
        valid, reason = cmssw.validateConfig(config=testWMConfig)
        self.assertTrue(valid)
        self.assertEqual(reason, "")

        # Test a couple of ways of screwing up the processing version
        testConfig = copy.deepcopy(testWMConfig)
        testConfig.Data.processingVersion = ""
        self.assertRaises(Exception, CMSSW, config=testConfig, logger=self.logger, workingdir=None)
        del testConfig.Data.processingVersion
        self.assertRaises(Exception, CMSSW, config=testConfig, logger=self.logger, workingdir=None)

        # Test a bad input dataset
        testConfig = copy.deepcopy(testWMConfig)
        testConfig.Data.inputDataset = ""
        self.assertRaises(Exception, CMSSW, config=testConfig, logger=self.logger, workingdir=None)

        # Test a bad psetName
        testConfig = copy.deepcopy(testWMConfig)
        del testConfig.JobType.psetName
        self.assertRaises(Exception, CMSSW, config=testConfig, logger=self.logger, workingdir=None)

        # Test several errors, make sure the reason message catches them all.
        cmssw = CMSSW(config=origConfig, logger=self.logger, workingdir=None)
        testConfig = copy.deepcopy(testWMConfig)
        testConfig.Data.processingVersion = ""
        testConfig.Data.inputDataset = ""
        del testConfig.JobType.psetName
        valid, reason = cmssw.validateConfig(config=testConfig)
        self.assertFalse(valid)
        self.assertEqual(reason.count("."), 3)
Ejemplo n.º 14
0
    def testValidateConfig(self):
        """
        Validate config, done as part of the constuctor
        """
        origConfig = copy.deepcopy(testWMConfig)

        # Make sure the original config works
        cmssw = CMSSW(config=origConfig, logger=self.logger, workingdir=None)
        valid, reason = cmssw.validateConfig(config=testWMConfig)
        self.assertTrue(valid)
        self.assertEqual(reason, '')

        # Test a couple of ways of screwing up the processing version
        testConfig = copy.deepcopy(testWMConfig)
        testConfig.Data.processingVersion = ''
        self.assertRaises(Exception,
                          CMSSW,
                          config=testConfig,
                          logger=self.logger,
                          workingdir=None)
        del testConfig.Data.processingVersion
        self.assertRaises(Exception,
                          CMSSW,
                          config=testConfig,
                          logger=self.logger,
                          workingdir=None)

        # Test a bad input dataset
        testConfig = copy.deepcopy(testWMConfig)
        testConfig.Data.inputDataset = ''
        self.assertRaises(Exception,
                          CMSSW,
                          config=testConfig,
                          logger=self.logger,
                          workingdir=None)

        # Test a bad psetName
        testConfig = copy.deepcopy(testWMConfig)
        del testConfig.JobType.psetName
        self.assertRaises(Exception,
                          CMSSW,
                          config=testConfig,
                          logger=self.logger,
                          workingdir=None)

        # Test several errors, make sure the reason message catches them all.
        cmssw = CMSSW(config=origConfig, logger=self.logger, workingdir=None)
        testConfig = copy.deepcopy(testWMConfig)
        testConfig.Data.processingVersion = ''
        testConfig.Data.inputDataset = ''
        del testConfig.JobType.psetName
        valid, reason = cmssw.validateConfig(config=testConfig)
        self.assertFalse(valid)
        self.assertEqual(reason.count('.'), 3)