Skip to content

Commit

Permalink
feat: output an empty marker file when a notebook makes plots
Browse files Browse the repository at this point in the history
  • Loading branch information
steven-murray committed May 15, 2024
1 parent 20fd21c commit 174a432
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
1 change: 1 addition & 0 deletions hera_notebook_templates/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ def runfunc(ctx, basename, **kwargs):
output_path = output_path,
kernel_name = ctx.obj['kernel'],
parameters=kwargs,
inject_paths=True
)

for fmt in ctx.obj['formats']:
Expand Down
16 changes: 11 additions & 5 deletions hera_notebook_templates/notebooks/lststack.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,9 @@
"fileconf: str = \"/lustre/aoc/projects/hera/h6c-analysis/IDR2/lstbin-outputs/redavg-smoothcal-notebook/file-config.h5\"\n",
"fileidx: int = 380\n",
"\n",
"PAPERMILL_INPUT_PATH = \"\"\n",
"PAPERMILL_OUTPUT_PATH = \"\"\n",
"\n",
"# The following are defaults that can be overwritten at execution time (preferably by a YAML file)\n",
"save_lstbin_data: bool = True\n",
"save_metric_data: bool = True\n",
Expand Down Expand Up @@ -487,13 +490,16 @@
{
"cell_type": "code",
"execution_count": null,
"id": "d7baff45-6153-4d97-a181-ea40273cd4ac",
"metadata": {
"tags": []
},
"id": "a6530710",
"metadata": {},
"outputs": [],
"source": [
"print_metadata()"
"# If this notebook is making plots, and is being run through PAPERMILL, output an empty\n",
"# file that tells the execution script to save a copy of the output notebook to the\n",
"# public-facing notebook directory.\n",
"if PAPERMILL_OUTPUT_PATH and make_plots:\n",
" pth = Path(f\"{PAPERMILL_OUTPUT_PATH}.hasplots\")\n",
" pth.touch()"
]
},
{
Expand Down

0 comments on commit 174a432

Please sign in to comment.