Skip to content

Commit 5d162cb

Browse files
authored
Merge pull request #374 from pyiron/executorlib
Rename pympipool to executorlib
2 parents dc1b460 + daea011 commit 5d162cb

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

62 files changed

+1187
-448
lines changed

.github/workflows/benchmark.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ jobs:
4343
python tests/benchmark/llh.py process >> timing.log
4444
python tests/benchmark/llh.py thread >> timing.log
4545
mpiexec -n 4 python -m mpi4py.futures tests/benchmark/llh.py mpi4py >> timing.log
46-
python tests/benchmark/llh.py pympipool >> timing.log
46+
python tests/benchmark/llh.py executorlib >> timing.log
4747
python tests/benchmark/llh.py block_allocation >> timing.log
4848
cat timing.log
4949
python -m unittest tests/benchmark/test_results.py

.github/workflows/unittest-flux-openmpi.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,13 +31,13 @@ jobs:
3131
run: |
3232
conda create -y -n py312 python=3.12.1 pympipool
3333
pip install . --no-deps --no-build-isolation
34-
coverage run -a --omit="pympipool/_version.py,tests/*" -m unittest discover tests
34+
coverage run -a --omit="executorlib/_version.py,tests/*" -m unittest discover tests
3535
- name: Test Flux with OpenMPI
3636
shell: bash -l {0}
3737
timeout-minutes: 5
3838
run: >
3939
flux start
40-
coverage run -a --omit="pympipool/_version.py,tests/*" -m unittest tests/test_flux_executor.py tests/test_executor_backend_flux.py;
40+
coverage run -a --omit="executorlib/_version.py,tests/*" -m unittest tests/test_flux_executor.py tests/test_executor_backend_flux.py;
4141
coverage xml
4242
env:
4343
PYMPIPOOL_PMIX: "pmix"

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,6 @@ repos:
55
- id: ruff
66
name: ruff lint
77
args: ["--select", "I", "--fix"]
8-
files: ^pympipool/
8+
files: ^executorlib/
99
- id: ruff-format
1010
name: ruff format

README.md

Lines changed: 32 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
# pympipool
2-
[![Unittests](https://github.com/pyiron/pympipool/actions/workflows/unittest-openmpi.yml/badge.svg)](https://github.com/pyiron/pympipool/actions/workflows/unittest-openmpi.yml)
3-
[![Coverage Status](https://coveralls.io/repos/github/pyiron/pympipool/badge.svg?branch=main)](https://coveralls.io/github/pyiron/pympipool?branch=main)
4-
[![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/pyiron/pympipool/HEAD?labpath=notebooks%2Fexamples.ipynb)
1+
# executorlib
2+
[![Unittests](https://github.com/pyiron/executorlib/actions/workflows/unittest-openmpi.yml/badge.svg)](https://github.com/pyiron/executorlib/actions/workflows/unittest-openmpi.yml)
3+
[![Coverage Status](https://coveralls.io/repos/github/pyiron/executorlib/badge.svg?branch=main)](https://coveralls.io/github/pyiron/executorlib?branch=main)
4+
[![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/pyiron/executorlib/HEAD?labpath=notebooks%2Fexamples.ipynb)
55

66
## Challenges
77
In high performance computing (HPC) the Python programming language is commonly used as high-level language to
@@ -16,25 +16,25 @@ challenging, in primarily three aspects:
1616
* **Integration**: Existing workflow libraries implement a secondary the job management on the Python level rather than
1717
leveraging the existing infrastructure provided by the job scheduler of the HPC.
1818

19-
### pympipool is ...
20-
In a given HPC allocation the `pympipool` library addresses these challenges by extending the Executor interface
19+
### executorlib is ...
20+
In a given HPC allocation the `executorlib` library addresses these challenges by extending the Executor interface
2121
of the standard Python library to support the resource assignment in the HPC context. Computing resources can either be
22-
assigned on a per function call basis or as a block allocation on a per Executor basis. The `pympipool` library
22+
assigned on a per function call basis or as a block allocation on a per Executor basis. The `executorlib` library
2323
is built on top of the [flux-framework](https://flux-framework.org) to enable fine-grained resource assignment. In
2424
addition, [Simple Linux Utility for Resource Management (SLURM)](https://slurm.schedmd.com) is supported as alternative
25-
queuing system and for workstation installations `pympipool` can be installed without a job scheduler.
25+
queuing system and for workstation installations `executorlib` can be installed without a job scheduler.
2626

27-
### pympipool is not ...
28-
The pympipool library is not designed to request an allocation from the job scheduler of an HPC. Instead within a given
29-
allocation from the job scheduler the `pympipool` library can be employed to distribute a series of python
27+
### executorlib is not ...
28+
The executorlib library is not designed to request an allocation from the job scheduler of an HPC. Instead within a given
29+
allocation from the job scheduler the `executorlib` library can be employed to distribute a series of python
3030
function calls over the available computing resources to achieve maximum computing resource utilization.
3131

3232
## Example
33-
The following examples illustrates how `pympipool` can be used to distribute a series of MPI parallel function calls
33+
The following examples illustrates how `executorlib` can be used to distribute a series of MPI parallel function calls
3434
within a queuing system allocation. `example.py`:
3535
```python
3636
import flux.job
37-
from pympipool import Executor
37+
from executorlib import Executor
3838

3939
def calc(i):
4040
from mpi4py import MPI
@@ -57,7 +57,7 @@ Which returns:
5757
```
5858
The important part in this example is that [mpi4py](https://mpi4py.readthedocs.io) is only used in the `calc()`
5959
function, not in the python script, consequently it is not necessary to call the script with `mpiexec` but instead
60-
a call with the regular python interpreter is sufficient. This highlights how `pympipool` allows the users to
60+
a call with the regular python interpreter is sufficient. This highlights how `executorlib` allows the users to
6161
parallelize one function at a time and not having to convert their whole workflow to use [mpi4py](https://mpi4py.readthedocs.io).
6262
The same code can also be executed inside a jupyter notebook directly which enables an interactive development process.
6363

@@ -68,7 +68,7 @@ resulting in a total of four CPU cores being utilized.
6868

6969
After submitting the function `calc()` with the corresponding parameter to the executor `exe.submit(calc, 0)`
7070
a python [`concurrent.futures.Future`](https://docs.python.org/3/library/concurrent.futures.html#future-objects) is
71-
returned. Consequently, the `pympipool.Executor` can be used as a drop-in replacement for the
71+
returned. Consequently, the `executorlib.Executor` can be used as a drop-in replacement for the
7272
[`concurrent.futures.Executor`](https://docs.python.org/3/library/concurrent.futures.html#module-concurrent.futures)
7373
which allows the user to add parallelism to their workflow one function at a time.
7474

@@ -108,20 +108,20 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
108108
```
109109

110110
# Documentation
111-
* [Installation](https://pympipool.readthedocs.io/en/latest/installation.html)
112-
* [Compatible Job Schedulers](https://pympipool.readthedocs.io/en/latest/installation.html#compatible-job-schedulers)
113-
* [pympipool with Flux Framework](https://pympipool.readthedocs.io/en/latest/installation.html#pympipool-with-flux-framework)
114-
* [Test Flux Framework](https://pympipool.readthedocs.io/en/latest/installation.html#test-flux-framework)
115-
* [Without Flux Framework](https://pympipool.readthedocs.io/en/latest/installation.html#without-flux-framework)
116-
* [Examples](https://pympipool.readthedocs.io/en/latest/examples.html)
117-
* [Compatibility](https://pympipool.readthedocs.io/en/latest/examples.html#compatibility)
118-
* [Resource Assignment](https://pympipool.readthedocs.io/en/latest/examples.html#resource-assignment)
119-
* [Data Handling](https://pympipool.readthedocs.io/en/latest/examples.html#data-handling)
120-
* [Up-Scaling](https://pympipool.readthedocs.io/en/latest/examples.html#up-scaling)
121-
* [Coupled Functions](https://pympipool.readthedocs.io/en/latest/examples.html#coupled-functions)
122-
* [SLURM Job Scheduler](https://pympipool.readthedocs.io/en/latest/examples.html#slurm-job-scheduler)
123-
* [Workstation Support](https://pympipool.readthedocs.io/en/latest/examples.html#workstation-support)
124-
* [Development](https://pympipool.readthedocs.io/en/latest/development.html)
125-
* [Contributions](https://pympipool.readthedocs.io/en/latest/development.html#contributions)
126-
* [License](https://pympipool.readthedocs.io/en/latest/development.html#license)
127-
* [Integration](https://pympipool.readthedocs.io/en/latest/development.html#integration)
111+
* [Installation](https://executorlib.readthedocs.io/en/latest/installation.html)
112+
* [Compatible Job Schedulers](https://executorlib.readthedocs.io/en/latest/installation.html#compatible-job-schedulers)
113+
* [executorlib with Flux Framework](https://executorlib.readthedocs.io/en/latest/installation.html#executorlib-with-flux-framework)
114+
* [Test Flux Framework](https://executorlib.readthedocs.io/en/latest/installation.html#test-flux-framework)
115+
* [Without Flux Framework](https://executorlib.readthedocs.io/en/latest/installation.html#without-flux-framework)
116+
* [Examples](https://executorlib.readthedocs.io/en/latest/examples.html)
117+
* [Compatibility](https://executorlib.readthedocs.io/en/latest/examples.html#compatibility)
118+
* [Resource Assignment](https://executorlib.readthedocs.io/en/latest/examples.html#resource-assignment)
119+
* [Data Handling](https://executorlib.readthedocs.io/en/latest/examples.html#data-handling)
120+
* [Up-Scaling](https://executorlib.readthedocs.io/en/latest/examples.html#up-scaling)
121+
* [Coupled Functions](https://executorlib.readthedocs.io/en/latest/examples.html#coupled-functions)
122+
* [SLURM Job Scheduler](https://executorlib.readthedocs.io/en/latest/examples.html#slurm-job-scheduler)
123+
* [Workstation Support](https://executorlib.readthedocs.io/en/latest/examples.html#workstation-support)
124+
* [Development](https://executorlib.readthedocs.io/en/latest/development.html)
125+
* [Contributions](https://executorlib.readthedocs.io/en/latest/development.html#contributions)
126+
* [License](https://executorlib.readthedocs.io/en/latest/development.html#license)
127+
* [Integration](https://executorlib.readthedocs.io/en/latest/development.html#integration)

binder/postBuild

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@
22
mkdir -p /home/jovyan/.local/share/jupyter/kernels/flux
33
cp binder/kernel.json /home/jovyan/.local/share/jupyter/kernels/flux
44

5-
# install pympipool
5+
# install executorlib
66
pip install . --no-deps --no-build-isolation
77

88
# copy notebooks
99
mv notebooks/*.ipynb .
1010

1111
# clean up
12-
rm -rf .ci_support .github binder docs notebooks pympipool pympipool.egg-info tests .coveralls.yml .gitignore .readthedocs.yml LICENSE MANIFEST.in README.md pyproject.toml setup.py build
12+
rm -rf .ci_support .github binder docs notebooks executorlib executorlib.egg-info tests .coveralls.yml .gitignore .readthedocs.yml LICENSE MANIFEST.in README.md pyproject.toml setup.py build

docs/_config.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
title: pympipool
1+
title: executorlib
22
author: Jan Janssen
33
logo: images/pyiron-logo.png
44

55
execute:
66
execute_notebooks : off
77

88
repository:
9-
url : https://github.com/pyiron/pympipool
9+
url : https://github.com/pyiron/executorlib
1010
html:
1111
use_repository_button: true
1212

docs/api.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
Interface
22
=========
33

4-
Documentation of the classes and functions defined in the :code:`pympipool` package.
4+
Documentation of the classes and functions defined in the :code:`executorlib` package.
55

66
.. autosummary::
77
:toctree: _autosummary
88
:template: custom-module-template.rst
99
:recursive:
1010

11-
pympipool
11+
executorlib

docs/development.md

Lines changed: 27 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Development
2-
The `pympipool` package is developed based on the need to simplify the up-scaling of python functions over multiple
2+
The `executorlib` package is developed based on the need to simplify the up-scaling of python functions over multiple
33
compute nodes. The project is used for Exascale simualtion in the context of computational chemistry and materials
44
science. Still it remains a scientific research project with the goal to maximize the utilization of computational
55
resources for scientific applications. No formal support is provided.
@@ -41,31 +41,31 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
4141
```
4242

4343
## Integration
44-
The key functionality of the `pympipool` package is the up-scaling of python functions with thread based parallelism,
44+
The key functionality of the `executorlib` package is the up-scaling of python functions with thread based parallelism,
4545
MPI based parallelism or by assigning GPUs to individual python functions. In the background this is realized using a
4646
combination of the [zero message queue](https://zeromq.org) and [cloudpickle](https://github.com/cloudpipe/cloudpickle)
47-
to communicate binary python objects. The `pympipool.communication.SocketInterface` is an abstraction of this interface,
48-
which is used in the other classes inside `pympipool` and might also be helpful for other projects. It comes with a
49-
series of utility functions:
50-
51-
* `pympipool.communication.interface_bootup()`: To initialize the interface
52-
* `pympipool.communication.interface_connect()`: To connect the interface to another instance
53-
* `pympipool.communication.interface_send()`: To send messages via this interface
54-
* `pympipool.communication.interface_receive()`: To receive messages via this interface
55-
* `pympipool.communication.interface_shutdown()`: To shutdown the interface
56-
57-
While `pympipool` was initially designed for up-scaling python functions for HPC, the same functionality can be leveraged
58-
to up-scale any executable independent of the programming language it is developed in. This approach follows the design
59-
of the `flux.job.FluxExecutor` included in the [flux framework](https://flux-framework.org). In `pympipool` this approach
47+
to communicate binary python objects. The `executorlib.communication.SocketInterface` is an abstraction of this
48+
interface, which is used in the other classes inside `executorlib` and might also be helpful for other projects. It
49+
comes with a series of utility functions:
50+
51+
* `executorlib.communication.interface_bootup()`: To initialize the interface
52+
* `executorlib.communication.interface_connect()`: To connect the interface to another instance
53+
* `executorlib.communication.interface_send()`: To send messages via this interface
54+
* `executorlib.communication.interface_receive()`: To receive messages via this interface
55+
* `executorlib.communication.interface_shutdown()`: To shutdown the interface
56+
57+
While `executorlib` was initially designed for up-scaling python functions for HPC, the same functionality can be
58+
leveraged to up-scale any executable independent of the programming language it is developed in. This approach follows
59+
the design of the `flux.job.FluxExecutor` included in the [flux framework](https://flux-framework.org). In `executorlib` this approach
6060
is extended to support any kind of subprocess, so it is no longer limited to the [flux framework](https://flux-framework.org).
6161

6262
### Subprocess
6363
Following the [`subprocess.check_output()`](https://docs.python.org/3/library/subprocess.html) interface of the standard
64-
python libraries, any kind of command can be submitted to the `pympipool.SubprocessExecutor`. The command can either be
64+
python libraries, any kind of command can be submitted to the `executorlib.SubprocessExecutor`. The command can either be
6565
specified as a list `["echo", "test"]` in which the first entry is typically the executable followed by the corresponding
6666
parameters or the command can be specified as a string `"echo test"` with the additional parameter `shell=True`.
6767
```python
68-
from pympipool import SubprocessExecutor
68+
from executorlib import SubprocessExecutor
6969

7070
with SubprocessExecutor(max_workers=2) as exe:
7171
future = exe.submit(["echo", "test"], universal_newlines=True)
@@ -74,20 +74,20 @@ with SubprocessExecutor(max_workers=2) as exe:
7474
```
7575
>>> (False, "test", True)
7676
```
77-
In analogy to the previous examples the `SubprocessExecutor` class is directly imported from the `pympipool` module and
78-
the maximum number of workers is set to two `max_workers=2`. In contrast to the `pympipool.Executor` class no other
77+
In analogy to the previous examples the `SubprocessExecutor` class is directly imported from the `executorlib` module and
78+
the maximum number of workers is set to two `max_workers=2`. In contrast to the `executorlib.Executor` class no other
7979
settings to assign specific hardware to the command via the python interface are available in the `SubprocessExecutor`
8080
class. To specify the hardware requirements for the individual commands, the user has to manually assign the resources
8181
using the commands of the resource schedulers like `srun`, `flux run` or `mpiexec`.
8282

83-
The `concurrent.futures.Future` object returned after submitting a command to the `pymipool.SubprocessExecutor` behaves
83+
The `concurrent.futures.Future` object returned after submitting a command to the `executorlib.SubprocessExecutor` behaves
8484
just like any other future object. It provides a `done()` function to check if the execution completed as well as a
8585
`result()` function to return the output of the submitted command.
8686

8787
In comparison to the `flux.job.FluxExecutor` included in the [flux framework](https://flux-framework.org) the
88-
`pymipool.SubprocessExecutor` differs in two ways. One the `pymipool.SubprocessExecutor` does not provide any option for
89-
resource assignment and two the `pymipool.SubprocessExecutor` returns the output of the command rather than just
90-
returning the exit status when calling `result()`.
88+
`executorlib.SubprocessExecutor` differs in two ways. One the `executorlib.SubprocessExecutor` does not provide any
89+
option for resource assignment and two the `executorlib.SubprocessExecutor` returns the output of the command rather
90+
than just returning the exit status when calling `result()`.
9191

9292
### Interactive Shell
9393
Beyond external executables which are called once with a set of input parameters and or input files and return one set
@@ -111,13 +111,13 @@ if __name__ == "__main__":
111111
count(iterations=int(user_input))
112112
```
113113
This example is challenging in terms of interfacing it with a python process as the length of the output changes depending
114-
on the input. The first option that the `pympipool.ShellExecutor` provides is specifying the number of lines to read for
114+
on the input. The first option that the `executorlib.ShellExecutor` provides is specifying the number of lines to read for
115115
each call submitted to the executable using the `lines_to_read` parameter. In comparison to the `SubprocessExecutor`
116116
defined above the `ShellExecutor` only supports the execution of a single executable at a time, correspondingly the input
117117
parameters for calling the executable are provided at the time of initialization of the `ShellExecutor` and the inputs
118118
are submitted using the `submit()` function:
119119
```python
120-
from pympipool import ShellExecutor
120+
from executorlib import ShellExecutor
121121

122122
with ShellExecutor(["python", "count.py"], universal_newlines=True) as exe:
123123
future_lines = exe.submit(string_input="4", lines_to_read=5)
@@ -130,10 +130,10 @@ The response for a given set of input is again returned as `concurrent.futures.F
130130
execute other steps on the python side while waiting for the completion of the external executable. In this case the
131131
example counts the numbers from `0` to `3` and prints each of them in one line followed by `done` to notify the user its
132132
waiting for new inputs. This results in `n+1` lines of output for the input of `n`. Still predicting the number of lines
133-
for a given input can be challenging, so the `pympipool.ShellExecutor` class also provides the option to wait until a
133+
for a given input can be challenging, so the `executorlib.ShellExecutor` class also provides the option to wait until a
134134
specific pattern is found in the output using the `stop_read_pattern`:
135135
```python
136-
from pympipool import ShellExecutor
136+
from executorlib import ShellExecutor
137137

138138
with ShellExecutor(["python", "count.py"], universal_newlines=True) as exe:
139139
future_pattern = exe.submit(string_input="4", stop_read_pattern="done")

0 commit comments

Comments
 (0)