Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add external script into example_notebook #731

Merged
merged 1 commit into from
Jan 8, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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!")
Loading