Skip to content
Snippets Groups Projects
Commit f16466d9 authored by Daniel Savoiu's avatar Daniel Savoiu
Browse files

Refactor ANALYSIS_OUTPUT_PATH check.

parent 25e5f57e
Branches
No related tags found
1 merge request!6Update law to `v0.1.12`, reduction of code duplication, and various small fixes.
......@@ -72,10 +72,11 @@ class FastProd(Task, HTCondorWorkflow, law.LocalWorkflow):
if self.htcondor_remote_storage:
return self.remote_target(outfile)
else:
if os.getenv("ANALYSIS_OUTPUT_PATH"):
outpath = os.getenv("ANALYSIS_OUTPUT_PATH") + "/" + self.name + "/" + self.__class__.__name__ + "/"
out_dir = os.getenv("ANALYSIS_OUTPUT_PATH")
if out_dir:
outpath = os.path.join(out_dir, self.name, self.__class__.__name__)
logger.debug("Output path is: %s", outpath)
return law.LocalFileTarget(outpath + "/" + outfile)
return law.LocalFileTarget(os.path.join(outpath, outfile))
else:
logger.error("Local output path ANALYSIS_OUTPUT_PATH is not defined, aborted!")
raise
......
......@@ -67,10 +67,11 @@ class FastWarm(Task, HTCondorWorkflow, law.LocalWorkflow):
if self.htcondor_remote_storage:
return self.remote_target(outfile)
else:
if os.getenv("ANALYSIS_OUTPUT_PATH"):
outpath = os.getenv("ANALYSIS_OUTPUT_PATH") + "/" + self.name + "/" + self.__class__.__name__ + "/"
out_dir = os.getenv("ANALYSIS_OUTPUT_PATH")
if out_dir:
outpath = os.path.join(out_dir, self.name, self.__class__.__name__)
logger.debug("Output path is: %s", outpath)
return law.LocalFileTarget(outpath + "/" + outfile)
return law.LocalFileTarget(os.path.join(outpath, outfile))
else:
logger.error("Local output path ANALYSIS_OUTPUT_PATH is not defined, aborted!")
raise
......
......@@ -38,10 +38,11 @@ class MergeFastWarm(Task):
if self.htcondor_remote_storage:
return self.remote_target(outfile)
else:
if os.getenv("ANALYSIS_OUTPUT_PATH"):
outpath = os.getenv("ANALYSIS_OUTPUT_PATH") + "/" + self.name + "/" + self.__class__.__name__ + "/"
out_dir = os.getenv("ANALYSIS_OUTPUT_PATH")
if out_dir:
outpath = os.path.join(out_dir, self.name, self.__class__.__name__)
logger.debug("Output path is: %s", outpath)
return law.LocalFileTarget(outpath + "/" + outfile)
return law.LocalFileTarget(os.path.join(outpath, outfile))
else:
logger.error("Local output path ANALYSIS_OUTPUT_PATH is not defined, aborted!")
raise
......
......@@ -70,10 +70,11 @@ class Warmup(Task, HTCondorWorkflow, law.LocalWorkflow):
if self.htcondor_remote_storage:
return self.remote_target(outfile)
else:
if os.getenv("ANALYSIS_OUTPUT_PATH"):
outpath = os.getenv("ANALYSIS_OUTPUT_PATH") + "/" + self.name + "/" + self.__class__.__name__ + "/"
out_dir = os.getenv("ANALYSIS_OUTPUT_PATH")
if out_dir:
outpath = os.path.join(out_dir, self.name, self.__class__.__name__)
logger.debug("Output path is: %s", outpath)
return law.LocalFileTarget(outpath + "/" + outfile)
return law.LocalFileTarget(os.path.join(outpath, outfile))
else:
logger.error("Local output path ANALYSIS_OUTPUT_PATH is not defined, aborted!")
raise
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment