diff --git a/mkShapesRDF/shapeAnalysis/latinos/PlotFactory.py b/mkShapesRDF/shapeAnalysis/latinos/PlotFactory.py index a927a18..b9a036a 100644 --- a/mkShapesRDF/shapeAnalysis/latinos/PlotFactory.py +++ b/mkShapesRDF/shapeAnalysis/latinos/PlotFactory.py @@ -14,6 +14,8 @@ ROOT.gROOT.SetBatch(True) +import shutil + # ----------------------------------------------------- PlotFactory -------------------------------------- @@ -77,6 +79,18 @@ def makePlot( self._outputDirPlots = outputDirPlots os.system("mkdir " + outputDirPlots + "/") + # + # prepare index.php + # + # it assumes the file index.php exists in the folder PlotsConfigurationsRun3 (as it should) + # and you are working from a folder PlotsConfigurationsRun3// + # or you are working from a folder PlotsConfigurationsRun3// --> this is the case for several years analyses + # + if os.path.exists("../index.php"): + shutil.copy2("../index.php", self._outputDirPlots + "/" + "index.php") # complete target filename given + if os.path.exists("../../index.php"): + shutil.copy2("../../index.php", self._outputDirPlots + "/" + "index.php") # complete target filename given + # # prepare plotter.html # diff --git a/mkShapesRDF/shapeAnalysis/mkShapesRDF.py b/mkShapesRDF/shapeAnalysis/mkShapesRDF.py index d3b2931..50be6e0 100644 --- a/mkShapesRDF/shapeAnalysis/mkShapesRDF.py +++ b/mkShapesRDF/shapeAnalysis/mkShapesRDF.py @@ -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", @@ -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? ) parser.add_argument( "-q", @@ -133,6 +155,34 @@ 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 + print ("check jobs") + + # + # if "submit" is triggered, override the operation mode and just "submit" to batch system the creation of histograms + # "operationMode = 0" means submit + # + if args.submit : + operationMode = 0 + doBatch = 1 # if "submit" it means on the batch system! + print ("submit jobs on the batch system") + + # + # 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 + print ("hadd histograms") + + + + global folder global batchFolder global outputFolder @@ -335,13 +385,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", ] )