forked from iarsene/O2DQworkflows
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrunFilterPP.py
More file actions
66 lines (52 loc) · 2.42 KB
/
runFilterPP.py
File metadata and controls
66 lines (52 loc) · 2.42 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
#!/usr/bin/env python3
import sys
import json
import os
commonDeps = ["o2-analysis-timestamp", "o2-analysis-fdd-converter", "o2-analysis-event-selection", "o2-analysis-multiplicity-table", "o2-analysis-trackselection", "o2-analysis-trackextension", "o2-analysis-pid-tof", "o2-analysis-pid-tof-full", "o2-analysis-pid-tof-beta", "o2-analysis-pid-tpc-full"]
# Make some checks on provided arguments
if len(sys.argv) < 3:
print("ERROR: Invalid syntax! The command line should look like this:")
print(" ./runTableMaker.py <yourConfig.json> <runData|runMC> [task|param|value] ...")
sys.exit()
# Load the configuration file provided as the first parameter
config = {}
with open(sys.argv[1]) as configFile:
config = json.load(configFile)
# Check whether we run over data or MC
if not ((sys.argv[2] == "runMC") or (sys.argv[2] == "runData")):
print("ERROR: You have to specify either runMC or runData !")
sys.exit()
runOverMC = False
if sys.argv[2] == "runMC":
runOverMC = True
# Get all the user required modifications to the configuration file
for count in range(3, len(sys.argv)):
param = sys.argv[count].split(":")
if len(param) != 3:
print("ERROR: Wrong parameter syntax: ", param)
sys.exit()
config[param[0]][param[1]] = param[2]
taskNameInConfig = "d-q-filter-p-p-task"
taskNameInCommandLine = "o2-analysis-dq-filter-pp"
if runOverMC == True:
taskNameInConfig = "d-q-filter-p-p-task"
taskNameInCommandLine = "o2-analysis-dq-filter-pp"
if not taskNameInConfig in config:
print("ERROR: Task to be run not found in the configuration file!")
sys.exit()
# Write the updated configuration file into a temporary file
updatedConfigFileName = "tempConfig.json"
with open(updatedConfigFileName,'w') as outputFile:
json.dump(config, outputFile)
# Check which dependencies need to be run
depsToRun = {}
for dep in commonDeps:
depsToRun[dep] = 1
commandToRun = taskNameInCommandLine + " --configuration json://" + updatedConfigFileName + " --severity error --shm-segment-size 12000000000 -b"
for dep in depsToRun.keys():
commandToRun += " | " + dep + " --configuration json://" + updatedConfigFileName + " -b"
print("====================================================================================================================")
print("Command to run:")
print(commandToRun)
print("====================================================================================================================")
os.system(commandToRun)