-
Notifications
You must be signed in to change notification settings - Fork 1
/
checkStatus.py
76 lines (60 loc) · 2.64 KB
/
checkStatus.py
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
67
68
69
70
71
72
73
74
75
76
import itertools
import os
import sys
from Tools import col, enSetup, etaSetup, mainParser, makeTag, phiSetup, tagBuilder
sys.path.append(os.path.abspath(os.path.curdir))
def checkStatus(options):
# Getting environment info
CWD = os.getcwd()
# List or range of energies to shoot particles
energies, minEn, maxEn = enSetup(options)
# List or range of etas to shoot particles
etas, minEta, maxEta = etaSetup(options)
# List or range of phi to shoot particles
phis, minPhi, maxPhi = phiSetup(options)
# List of particles to generate in pdg codes
particles = options.particles
if particles is None or len(particles) == 0:
print(
col.magenta + "Warning: " + col.endc + "Particles not specified. "
"Using Gamma as default. This might not be compatible with your configuration."
)
particles = [22]
# List of delta values
deltas = options.delta
if deltas is None or len(deltas) == 0:
deltas = [10.0]
# Pack the ranges into an array
ranges = [minEn, maxEn, minEta, maxEta, minPhi, maxPhi]
iterator = itertools.product(particles, energies, etas, phis, deltas)
for p, E, eta, phi, delta in iterator:
# Append particle, energy, eta and phi tags. Phi tag is skipped if full range is used
# and create printout message.
outTag = tagBuilder(options, p, E, eta, phi, ranges, delta)
print(
f"{col.bold}Campaign: {col.magenta}{options.campaign}{col.endc}\t{col.bold}Tag: {col.magenta}{options.tag}{col.endc}"
)
os.chdir(CWD)
os.chdir(f"myGeneration/{outTag}/crab_projects/")
listCommand = f"ls | grep {options.step} | grep {options.geometry}"
if options.campaign is not None:
listCommand = f"{listCommand}| grep {options.campaign} "
if options.tag is not None:
listCommand = f"{listCommand}| grep {options.tag} "
if options.delta is not None:
listCommand = f"{listCommand}| grep Delta{makeTag(delta)} "
if options.overlapping:
listCommand = f"{listCommand}| grep Overlapping "
if options.pointing is False:
listCommand = f"{listCommand}| grep Parallel "
listCommand = f"{listCommand}> submissions.txt"
os.system(listCommand)
fSubmissions = open("submissions.txt")
for submission in fSubmissions:
os.system(f"crab status -d {submission} > log.txt")
os.system("tail -n +9 log.txt | head -n -8")
os.system("rm log.txt")
os.system("rm submissions.txt")
if __name__ == "__main__":
options = mainParser()
checkStatus(options)