From 35929441ae4e234107a8df18738805073cb33c30 Mon Sep 17 00:00:00 2001 From: Corwin Kerr Date: Thu, 5 Dec 2024 11:38:44 -0500 Subject: [PATCH 1/3] Cast environment variables to integers --- doc/src/guide/concepts/hoomd-example.py | 2 +- doc/src/guide/concepts/multiprocessing-example.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/src/guide/concepts/hoomd-example.py b/doc/src/guide/concepts/hoomd-example.py index a7ef4e2..3d8cba3 100644 --- a/doc/src/guide/concepts/hoomd-example.py +++ b/doc/src/guide/concepts/hoomd-example.py @@ -17,7 +17,7 @@ def action_implementation(job, communicator): def action(*jobs): """Execute actions on directories in parallel using HOOMD-blue.""" - processes_per_directory = os.environ['ACTION_PROCESSES_PER_DIRECTORY'] + processes_per_directory = int(os.environ['ACTION_PROCESSES_PER_DIRECTORY']) communicator = hoomd.communicator.Communicator(ranks_per_partition=processes_per_directory) action_implementation(jobs[communicator.partition], communicator) # ANCHOR_END: action diff --git a/doc/src/guide/concepts/multiprocessing-example.py b/doc/src/guide/concepts/multiprocessing-example.py index 8c51331..308b99d 100644 --- a/doc/src/guide/concepts/multiprocessing-example.py +++ b/doc/src/guide/concepts/multiprocessing-example.py @@ -15,7 +15,7 @@ def action_implementation(job): def action(*jobs): """Process any number of jobs in parallel with the multiprocessing package.""" - processes = os.environ.get('ACTION_THREADS_PER_PROCESS', multiprocessing.cpu_count()) + processes = int(os.environ.get('ACTION_THREADS_PER_PROCESS', multiprocessing.cpu_count())) if hasattr(os, 'sched_getaffinity'): processes = len(os.sched_getaffinity(0)) From 5a0f5be8b5ee51984bc3de4fbcf4f384369a612f Mon Sep 17 00:00:00 2001 From: Corwin Kerr Date: Thu, 5 Dec 2024 11:45:22 -0500 Subject: [PATCH 2/3] Add release note --- doc/src/release-notes.md | 1 + 1 file changed, 1 insertion(+) diff --git a/doc/src/release-notes.md b/doc/src/release-notes.md index f512c3c..b39a1ea 100644 --- a/doc/src/release-notes.md +++ b/doc/src/release-notes.md @@ -19,6 +19,7 @@ properly escaped in the bash script output. * Typographical errors in the documentation. * The documentation now builds correctly with mdbook 0.4.43. +* Example code converts environment variables to ints where needed. ## 0.3.1 (2024-10-04) From 4358c88574d397ee944cc15a88cf24aa6a4d2865 Mon Sep 17 00:00:00 2001 From: Corwin Kerr Date: Thu, 5 Dec 2024 11:45:38 -0500 Subject: [PATCH 3/3] Add Corwin to contributors --- doc/src/contributors.md | 1 + 1 file changed, 1 insertion(+) diff --git a/doc/src/contributors.md b/doc/src/contributors.md index b4fd20e..492a70f 100644 --- a/doc/src/contributors.md +++ b/doc/src/contributors.md @@ -7,3 +7,4 @@ The following people have contributed to the development of **row**: * Joseph Burkhart, University of Michigan * Kate Jensen, University of Michigan * Tim Moore, University of Michigan +* Corwin Kerr, University of Michigan