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

Update dev notebooks #383

Merged
merged 3 commits into from
Feb 5, 2024
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
5 changes: 5 additions & 0 deletions dev_utils/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Development notebooks

This directory contains Jupyter notebooks meant for interactively testing the code.

Note that these notebooks are not checked as part of the CI pipeline, and could therefore be outdated.
41 changes: 19 additions & 22 deletions dev_utils/connection_test.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,18 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"This notebook tests the PyACP performance when run with a slower network connection. It uses the Linux ``tc-netem`` command to emulate a slower (latency- and bandwidth-restricted) network in a Docker container.\n",
"This notebook tests the PyACP performance when run with a slower network connection. It uses the Linux ``tc-netem`` command to emulate a slower (latency- and bandwidth-restricted) network in a Docker container."
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"---\n",
"**NOTE**\n",
"\n",
"Note that not all Linux kernels support ``tc-netem``: For example, it cannot be run on WSL2."
"- not all Linux kernels support ``tc-netem``. For example, it cannot be run on WSL2.\n",
"- this notebook may become outdated as the PyACP codebase evolves. It is not regularly checked for compatibility, and may need to be updated."
]
},
{
Expand Down Expand Up @@ -72,18 +81,7 @@
"metadata": {},
"outputs": [],
"source": [
"slow_server = pyacp.launch_acp(config=slow_launch)\n",
"normal_server = pyacp.launch_acp(config=normal_launch)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"slow_server.wait(timeout=30)\n",
"normal_server.wait(timeout=30)"
"slow_acp = pyacp.launch_acp(config=slow_launch)"
]
},
{
Expand All @@ -92,8 +90,7 @@
"metadata": {},
"outputs": [],
"source": [
"client_slow = pyacp.Client(slow_server)\n",
"client_normal = pyacp.Client(normal_server)"
"normal_acp = pyacp.launch_acp(config=normal_launch)"
]
},
{
Expand All @@ -110,13 +107,13 @@
"metadata": {},
"outputs": [],
"source": [
"def run_example(client):\n",
" f = client.upload_file(local_path=\"../examples/data/class40/class40.cdb\")\n",
" m = client.import_model(path=f, format=\"ansys:cdb\")\n",
"def run_example(acp_instance):\n",
" f = acp_instance.upload_file(local_path=\"../examples/data/class40/class40.cdb\")\n",
" m = acp_instance.import_model(path=f, format=\"ansys:cdb\")\n",
" mg = m.create_modeling_group()\n",
" for _ in range(100):\n",
" mg.create_modeling_ply()\n",
" client.clear()"
" acp_instance.clear()"
]
},
{
Expand All @@ -125,7 +122,7 @@
"metadata": {},
"outputs": [],
"source": [
"run_example(client_normal)"
"run_example(normal_acp)"
]
},
{
Expand All @@ -134,7 +131,7 @@
"metadata": {},
"outputs": [],
"source": [
"run_example(client_slow)"
"run_example(slow_acp)"
]
},
{
Expand Down
Loading
Loading