parallel_manager
A simple shell command manager. Used for running parallel simulations.
How-to
First install the package with pip:
pip install parallel_manager
To run the manager, we will need to wrap the manager initialization and request creations all in a async function like this:
from parallel_manager.manager import BaseShellManager
from parallel_manager.workerGroup import ShellWorkerGroup
import logging
import asyncio
async def Main():
# Init the manager
simpleShellWorkergroup = ShellWorkerGroup("simpleShellWorkergroup",
logging.getLogger(),
"./log",
10)
simpleShellManager = BaseShellManager("simpleShellManager")
simpleShellManager.add_workergroup("shell", simpleShellWorkergroup)
await simpleShellManager.init()
# Adding tasks
# Here we just run 100 echo
for i in range(100):
simpleShellManager.add_shell_request(f"echoing loop-{i}", f"echo {i}")
# Wait for the manager to finish
await simpleShellManager.done()
Then we simply use asyncio.run() to run the above function:
asyncio.run(Main())
The manager will run at most 10 processes at a given time and will terminate when all 100 requests are done.
Full example is at here
Structure
- Worker
- Receive request from queue and process it
- WorkerGroup
- Manage workers of same class
- Collect basic stats from workers
- Manager
- Might host various workergroups with different worker type
- Support various ways to add tasks
- Control workergroups/workers
- Various middleware/plugin to the BaseManager to implement other features like http web monitoring and task submission
TODOs
Short-term todos
- Manager statistics plugin
- Manager summary when all tasks are done
- Timeout support
- Status monitor, progress monitor
- Dump failed task/able to rerun
- Dump unfinished tasks when script terminates
Long-term todos
- Thread-mode support (completely non-blocking)
- Use a separate thread to run the workers
- Allow to submit task at any time
- Http monitor
- Interactive control for status monitoring and changing configuration dynamically, treat worker as a server that can submit task to, like a local slurm control
-
PythonFunctionWorkerclass (execute python function calls) and other worker class as well - Standardize plugin format for each class
- For instance, http server monitor could be a plugin that can be added to any manager class.
Metadata
Release files for parallel-manager 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| parallel_manager-0.1.0.tar.gz | 10.0 kB | Without provenance | Details for parallel_manager-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| parallel_manager-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for parallel_manager-0.1.0-py3-none-any.whl |
Total release size: 19.5 kB
Release files / parallel_manager-0.1.0.tar.gz
| Download URL | parallel_manager-0.1.0.tar.gz |
|---|---|
| Size | 10.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
d6948a963225dc5afa128a8dfe9691ce0d3fa13a72b961c5bd135925c7f15c7d
|
|
BLAKE2b-256 checksum How to use checksums |
23539f89185faa7a8ceeb1a18705febfe64032cfe8724a7875688d1e99c53466
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.9.17
|
Release files / parallel_manager-0.1.0-py3-none-any.whl
| Download URL | parallel_manager-0.1.0-py3-none-any.whl |
|---|---|
| Size | 9.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
20597c56406c21e08b83aa6bdda077255a5a6acf89c2f530117c0565b705c3db
|
|
BLAKE2b-256 checksum How to use checksums |
6433cf3cf43c5f89943b5a6d4495ac42405b613ccafa3d0875a8f92d6ba8c100
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.9.17
|
Security for parallel-manager 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.