diff --git a/diagnostics/example_notebook/example_notebook.ipynb b/diagnostics/example_notebook/example_notebook.ipynb index 3277a876a..872fe360e 100644 --- a/diagnostics/example_notebook/example_notebook.ipynb +++ b/diagnostics/example_notebook/example_notebook.ipynb @@ -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!\")" ], diff --git a/diagnostics/example_notebook/script.py b/diagnostics/example_notebook/script.py new file mode 100644 index 000000000..4c63eacc0 --- /dev/null +++ b/diagnostics/example_notebook/script.py @@ -0,0 +1,4 @@ +# script to showcase launching external scripts in the notebook + +def HelloWorld(): + print("Hello, world!")