Skip to content
Snippets Groups Projects
Commit 2bea8aca authored by Mikhail Karnevskiy's avatar Mikhail Karnevskiy
Browse files

make report name steerable

parent 0e788f1f
No related branches found
No related tags found
1 merge request!21Beautify report
......@@ -50,7 +50,7 @@ def combine_report(run_path, calibration):
shutil.copytree("{}/{}".format(run_path, entry), "{}/{}".format(sphinx_path, entry))
return sphinx_path
def make_report(run_path, tmp_path, out_path, project, author, version):
def make_report(run_path, tmp_path, out_path, project, author, version, out_name):
run_path = os.path.abspath(run_path)
try:
import subprocess
......@@ -72,6 +72,12 @@ def make_report(run_path, tmp_path, out_path, project, author, version):
"{}/sphinx_rep/conf.py".format(tmp_path),
patch_file])
subprocess.check_call(["sed",
"-i",
"-e",
"s/{}.tex/{}.tex/g".format(project.replace(" ",""), out_name),
"{}/sphinx_rep/conf.py".format(tmp_path)], shell=False)
except subprocess.CalledProcessError:
raise Exception("Failed to run sphinx-quickbuild. Is sphinx installed?"
"Generated simple index.rst instead")
......@@ -127,7 +133,7 @@ def make_report(run_path, tmp_path, out_path, project, author, version):
# shutil.rmtree(tmp_path)
def finalize(joblist, run_path, out_path, project, calibration, author, version):
def finalize(joblist, run_path, out_path, project, calibration, author, version, out_name = 'GGG'):
print("Waiting on jobs to finish: {}".format(joblist))
......@@ -142,7 +148,7 @@ def finalize(joblist, run_path, out_path, project, calibration, author, version)
break
sleep(10)
sphinx_path = combine_report(run_path, calibration)
make_report(sphinx_path, run_path, out_path, project, author, version)
make_report(sphinx_path, run_path, out_path, project, author, version, out_name)
......
......@@ -340,7 +340,6 @@ def concurrent_run(temp_path, nb, nbname, args, cparm=None, cval=None,
params = parameter_values(parms, **args)
new_nb = replace_definitions(nb, params, execute=False)
base_name = nbname.replace(".ipynb", "")
new_name = "{}_{}.ipynb".format(os.path.basename(base_name), suffix)
nbpath = "{}/{}".format(temp_path, new_name)
......@@ -486,11 +485,17 @@ def run():
os.makedirs(out_path)
cmd = ('"from cal_tools.cal_tools import finalize; ' +
'finalize({{joblist}}, \'{run_path}\', \'{out_path}\', '+
'\'{project}\', \'{calibration}\', \'{author}\', \'{version}\')"')
'\'{project}\', \'{calibration}\', \'{author}\', '
'\'{version}\', \'{out_name}\')"')
out_name = title;
for p in parms:
if p.name == "out_name":
out_name=p.value
fmtcmd = cmd.format(run_path=run_tmp_path, out_path=out_path,
project=title, calibration=title,
author=author, version=version)
author=author, version=version, out_name=out_name)
joblist = []
if concurrency.get("parameter", None) is None:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment