Skip to content
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
59 changes: 57 additions & 2 deletions mkShapesRDF/shapeAnalysis/mkShapesRDF.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,28 @@ def defaultParser():
required=False,
default=-1,
)

parser.add_argument(
"--check",
action='store_true'
help="Check status of batch submission"
required=False,
)

parser.add_argument(
"--submit",
action='store_true'
help="Submit jobs for histograms creation to batch system"
required=False,
)

parser.add_argument(
"--histoadd",
action='store_true'
help="Hadd root files"
required=False,
)

parser.add_argument(
"-b",
"--doBatch",
Expand Down Expand Up @@ -103,7 +125,7 @@ def defaultParser():
type=int,
help="Resubmit jobs, 1 resubmit finished jobs with errors, 2 resubmit running jobs",
required=False,
default="0",
default="0", # default 0 ?? Why not "1" as default?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess "0" is the default because you do not want to resubmit jobs if they crashed because of errors in the configuration. We can then just check what caused the jobs to crash, and if there are errors, we fix them. Otherwise, we resubmit.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

my question is: if I run "--resubmit" it means that I want to resubmit ... otherwise I run the command "--check".
Actually, the "resubmit 0" does nothing in the code ...

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah right, I just got confused. I was thinking at 'operation' mode rather than 'resubmit'. We can change it to 1, then.

)
parser.add_argument(
"-q",
Expand Down Expand Up @@ -133,6 +155,30 @@ def main():
dryRun = int(args.dryRun)
queue = args.queue

#
# if "check" is triggered, override the operation mode and just "check" the status of the submission of jobs
# "operationMode = 1" means check jobs
#
if args.check :
operationMode = 1

#
# if "submit" is triggered, override the operation mode and just "submit" to batch system the creation of histograms
# "operationMode = 1" means check jobs
#
if args.submit :
operationMode = 0

#
# if "histoadd" is triggered, override the operation mode and just "hadd" the histograms
# "operationMode = 2" means perform hadd of the histograms
#
if args.histoadd :
operationMode = 2




global folder
global batchFolder
global outputFolder
Expand Down Expand Up @@ -335,13 +381,22 @@ def main():
)
print(tabulate.tabulate(tabulated, headers="firstrow", tablefmt="fancy_grid"))

#
# Change colour depending if running jobs is 0 or not, it will help spotting problematic jobs
# ANSI color codes
# RED = "\033[91m"
# GREEN = "\033[92m"
# YELLOW = "\033[93m"
# RESET = "\033[0m"
#

tabulated = []
tabulated.append(["Total jobs", "Finished jobs", "Running jobs"])
tabulated.append(
[
len(files),
"\033[92m " + str(len(errs)) + "\033[00m",
"\033[93m " + str(len(notFinished)) + "\033[00m",
"\033[91m " + str(len(notFinished)) + "\033[00m",
]
)

Expand Down