Ejemplo n.º 1
0
    def testParentageRelationship(self):
        """
        Test methods related to the primary and parent datasets and blocks
        """
        primDict = {"block_A": {"blockSize": 1, "locations": ["Site_A"]},
                    "block_B": {"blockSize": 2, "locations": ["Site_B"]}}
        parentDict = {"parent_A": {"blockSize": 11, "locations": ["Site_A"]},
                      "parent_B": {"blockSize": 12, "locations": ["Site_B"]},
                      "parent_C": {"blockSize": 13, "locations": ["Site_A", "Site_B"]}}
        parentage = {"block_A": ["parent_B", "parent_D"],  # parent_D has no replicas!
                     "block_B": ["parent_A", "parent_C"]}
        wflow = Workflow("workflow_1", {"RequestType": "TaskChain",
                                        "InputDataset": "Dataset_name_XXX",
                                        "IncludeParents": True})

        self.assertEqual(wflow.getParentDataset(), "")
        wflow.setParentDataset("Parent_dataset_XXX")
        self.assertEqual(wflow.getParentDataset(), "Parent_dataset_XXX")

        self.assertEqual(wflow.getPrimaryBlocks(), {})
        wflow.setPrimaryBlocks(primDict)
        self.assertItemsEqual(wflow.getPrimaryBlocks().keys(), ["block_A", "block_B"])

        self.assertEqual(wflow.getParentBlocks(), {})
        wflow.setParentBlocks(parentDict)
        self.assertItemsEqual(wflow.getParentBlocks().keys(), ["parent_A", "parent_B", "parent_C"])

        self.assertEqual(wflow.getChildToParentBlocks(), {})
        wflow.setChildToParentBlocks(parentage)
        self.assertItemsEqual(wflow.getChildToParentBlocks(), parentage)
Ejemplo n.º 2
0
 def testTaskChainWflow(self):
     """
     Test loading a TaskChain like request into Workflow
     """
     tChainSpec = {"RequestType": "TaskChain",
                   "TaskChain": 3,
                   "Campaign": "top-campaign",
                   "RequestName": "whatever_name",
                   "DbsUrl": "a_dbs_url",
                   "SiteWhitelist": ["CERN", "FNAL", "DESY"],
                   "SiteBlacklist": [],
                   "Task1": {"InputDataset": "/task1/input-dataset/tier",
                             "MCPileup": "/task1/mc-pileup/tier",
                             "Campaign": "task1-campaign"},
                   "Task2": {"DataPileup": "/task2/data-pileup/tier",
                             "Campaign": "task2-campaign"},
                   "Task3": {"MCPileup": "/task1/mc-pileup/tier",
                             "Campaign": "task3-campaign"},
                   }
     wflow = Workflow(tChainSpec['RequestName'], tChainSpec)
     self.assertEqual(wflow.getName(), tChainSpec['RequestName'])
     self.assertEqual(wflow.getDbsUrl(), tChainSpec['DbsUrl'])
     self.assertItemsEqual(wflow.getSitelist(), tChainSpec['SiteWhitelist'])
     campaigns = ["%s-campaign" % c for c in {"task1", "task2", "task3"}]
     self.assertItemsEqual(wflow.getCampaigns(), campaigns)
     self.assertEqual(wflow.getInputDataset(), tChainSpec['Task1']['InputDataset'])
     pileups = [tChainSpec['Task1']['MCPileup'], tChainSpec['Task2']['DataPileup']]
     self.assertItemsEqual(wflow.getPileupDatasets(), pileups)
     self.assertFalse(wflow.hasParents())
     self.assertEqual(wflow.getParentDataset(), "")
     self.assertEqual(wflow.getPrimaryBlocks(), {})
     self.assertEqual(wflow.getSecondarySummary(), {})
     self.assertEqual(wflow.getParentBlocks(), {})
     self.assertEqual(wflow._getValue("NoKey"), None)
     self.assertEqual(len(wflow.getDataCampaignMap()), 3)
Ejemplo n.º 3
0
    def testReRecoWflow(self):
        """
        Test loading a ReReco like request into Workflow
        """
        parentDset = "/rereco/parent-dataset/tier"
        rerecoSpec = {"RequestType": "ReReco",
                      "InputDataset": "/rereco/input-dataset/tier",
                      "Campaign": "any-campaign",
                      "RequestName": "whatever_name",
                      "DbsUrl": "a_dbs_url",
                      "SiteWhitelist": ["CERN", "FNAL", "DESY"],
                      "SiteBlacklist": ["FNAL"]}
        wflow = Workflow(rerecoSpec['RequestName'], rerecoSpec)
        self.assertEqual(wflow.getName(), rerecoSpec['RequestName'])
        self.assertEqual(wflow.getDbsUrl(), rerecoSpec['DbsUrl'])
        self.assertItemsEqual(wflow.getSitelist(), ["CERN", "DESY"])
        self.assertItemsEqual(wflow.getCampaigns(), [rerecoSpec["Campaign"]])
        self.assertEqual(wflow.getInputDataset(), rerecoSpec["InputDataset"])
        self.assertItemsEqual(wflow.getPileupDatasets(), set())
        self.assertFalse(wflow.hasParents())
        self.assertEqual(wflow.getParentDataset(), "")
        self.assertEqual(wflow.getPrimaryBlocks(), {})
        self.assertEqual(wflow.getSecondarySummary(), {})
        self.assertEqual(wflow.getParentBlocks(), {})
        self.assertEqual(wflow._getValue("NoKey"), None)
        self.assertEqual(len(wflow.getDataCampaignMap()), 1)

        wflow.setParentDataset(parentDset)
        self.assertEqual(wflow.getParentDataset(), parentDset)
        self.assertEqual(len(wflow.getDataCampaignMap()), 2)