Skip to content

Commit

Permalink
add external script into example_notebook (#731)
Browse files Browse the repository at this point in the history
  • Loading branch information
jtmims authored Jan 8, 2025
1 parent 1eb0928 commit 865c8dd
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 2 deletions.
19 changes: 17 additions & 2 deletions diagnostics/example_notebook/example_notebook.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -314,13 +314,28 @@
"outputs": [],
"execution_count": null,
"source": [
"# Part 4: Close the catalog files and\n",
"# Part 4: running an external script\n",
"# the use of external python scripts can help prevent bloat in the notebook\n",
"# here, we show how this can be done\n",
"sys.path.append(os.environ[\"POD_HOME\"])\n",
"import script\n",
"script.HelloWorld()"
],
"id": "dfff0ee7ac28d733"
},
{
"metadata": {},
"cell_type": "code",
"outputs": [],
"execution_count": null,
"source": [
"# Part 5: Close the catalog files and\n",
"# release variable dict reference for garbage collection\n",
"# ------------------------------------------------------\n",
"cat.close()\n",
"tas_dict = None\n",
"\n",
"# Part 5: Confirm POD executed successfully\n",
"# Part 6: Confirm POD executed successfully\n",
"# ----------------------------------------\n",
"print(\"Last log message by example_multicase POD: finished successfully!\")"
],
Expand Down
4 changes: 4 additions & 0 deletions diagnostics/example_notebook/script.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# script to showcase launching external scripts in the notebook

def HelloWorld():
print("Hello, world!")

0 comments on commit 865c8dd

Please sign in to comment.