CMS 3D CMS Logo

SplitV.py
Go to the documentation of this file.
1 import copy
2 import os
3 
4 def SplitV(config, validationDir):
5 
6  jobs = []
7  SplitVType = "single"
8 
9 
10  IOVs = []
11 
12 
13  if not SplitVType in config["validations"]["SplitV"]:
14  raise Exception("No 'single' key word in config for SplitV")
15 
16  for singleName in config["validations"]["SplitV"][SplitVType]:
17  for IOV in config["validations"]["SplitV"][SplitVType][singleName]["IOV"]:
18 
19  if not IOV in IOVs:
20  IOVs.append(IOV)
21 
22  for alignment in config["validations"]["SplitV"][SplitVType][singleName]["alignments"]:
23 
24  workDir = "{}/SplitV/{}/{}/{}/{}".format(validationDir, SplitVType, singleName, alignment, IOV)
25 
26 
27  local = {}
28  local["output"] = "{}/{}/SplitV/{}/{}/{}/{}".format(config["LFS"], config["name"], SplitVType, alignment, singleName, IOV)
29  local["alignment"] = copy.deepcopy(config["alignments"][alignment])
30  local["validation"] = copy.deepcopy(config["validations"]["SplitV"][SplitVType][singleName])
31  local["validation"].pop("alignments")
32  local["validation"]["IOV"] = IOV
33  if "dataset" in local["validation"]:
34  local["validation"]["dataset"] = local["validation"]["dataset"].format(IOV)
35  if "goodlumi" in local["validation"]:
36  local["validation"]["goodlumi"] = local["validation"]["goodlumi"].format(IOV)
37 
38 
39  job = {
40  "name": "SplitV_{}_{}_{}_{}".format(SplitVType, alignment, singleName, IOV),
41  "dir": workDir,
42  "exe": "cmsRun",
43  "cms-config": "{}/src/Alignment/OfflineValidation/python/TkAlAllInOneTool/SplitV_cfg.py".format(os.environ["CMSSW_BASE"]),
44  "run-mode": "Condor",
45  "dependencies": [],
46  "config": local,
47  }
48 
49  jobs.append(job)
50 
51 
52  if "merge" in config["validations"]["SplitV"]:
53 
54  mergeJobs = []
55  SplitVType = "merge"
56 
57 
58  for mergeName in config["validations"]["SplitV"][SplitVType]:
59  for IOV in IOVs:
60 
61  workDir = "{}/SplitV/{}/{}/{}".format(validationDir, SplitVType, mergeName, IOV)
62 
63 
64  local = {}
65 
66  job = {
67  "name": "SplitV_{}_{}_{}".format(SplitVType, mergeName, IOV),
68  "dir": workDir,
69  "exe": "SplitVmerge",
70  "run-mode": "Condor",
71  "dependencies": [],
72  "config": local,
73  }
74 
75  for alignment in config["alignments"]:
76 
77  local.setdefault("alignments", {})
78  if alignment in config["validations"]["SplitV"]["single"][mergeName]["alignments"]:
79  local["alignments"][alignment] = copy.deepcopy(config["alignments"][alignment])
80  local["validation"] = copy.deepcopy(config["validations"]["SplitV"][SplitVType][mergeName])
81  local["output"] = "{}/{}/SplitV/{}/{}/{}".format(config["LFS"], config["name"], SplitVType, mergeName, IOV)
82 
83 
84  for singleJob in jobs:
85 
86  alignment, singleName, singleIOV = singleJob["name"].split("_")[2:]
87 
88  if int(singleIOV) == IOV and singleName in config["validations"]["SplitV"][SplitVType][mergeName]["singles"]:
89  local["alignments"][alignment]["file"] = singleJob["config"]["output"]
90  job["dependencies"].append(singleJob["name"])
91 
92  mergeJobs.append(job)
93 
94  jobs.extend(mergeJobs)
95 
96  return jobs
def SplitV(config, validationDir)
Definition: SplitV.py:4