Universal runner with builder objects to run async, threaded or group commands
Project description
runner (runner-pjpawel)
Universal runner with builder objects to run async, threaded or group commands
Build for my research projects to run multiple scenarios with retry with one command
Remember! This project is on early stage of development
Install
pip install runner-pjpawel
Build runner
- Create Runner class.
from runner_pjpawel import Runner
runner = Runner()
- Add commands. Use prepared
Commandclasses inrunner.commandsmodule or classes that extendsrunnner.command.BaseCommand
from runner_pjpawel.command.common import ShellCommand
shell = ShellCommand("uname -a")
runner.add_command(shell)
- Invoke
runorrun_syncmethod.
runner.run_sync()
Existing commands
- ShellCommand - executes shell command with subprocess.Popen
- GroupCommand - treats all commands as one, allow to execute reset callback before retry
- ParallelCommand - run commands in separate threads in parallel
Commands to be implemented
- CyclicCommand - Handles job than should be run more than once
- ThreadCommand - Run callable in separate thread
Build new commands
You can build you own command. To do so, create class that extend class BaseCommand.
You have to override _do_work method.
class YourCommand(BaseCommand):
def _do_work(self) -> CommandResult | None:
...
Full examples
- Simplest example
from runner_pjpawel import Runner
from runner_pjpawel.command import ShellCommand
r = Runner(show_progress_bar=False)
r.add_command(ShellCommand("uname"))
r.run_sync()
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file runner_pjpawel-0.1.4.tar.gz.
File metadata
- Download URL: runner_pjpawel-0.1.4.tar.gz
- Upload date:
- Size: 24.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3a7e248d6c9b8f4d23105b11172789ef5b41be5f4f728e5a3adbf1f787bd7b2f
|
|
| MD5 |
24b3af28098af8a94ff509fe3450fdfc
|
|
| BLAKE2b-256 |
65a8b4eb1bcf8af4cb2dc07d6a8fa9fd3fbc202d16d026c0c55e4a1df3f4c8a4
|
Provenance
The following attestation bundles were made for runner_pjpawel-0.1.4.tar.gz:
Publisher:
pypi.yaml on pjpawel/runner
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
runner_pjpawel-0.1.4.tar.gz -
Subject digest:
3a7e248d6c9b8f4d23105b11172789ef5b41be5f4f728e5a3adbf1f787bd7b2f - Sigstore transparency entry: 721404495
- Sigstore integration time:
-
Permalink:
pjpawel/runner@e9e8369d61ca8684c423d0647db504117f0705ff -
Branch / Tag:
refs/tags/0.1.4 - Owner: https://github.com/pjpawel
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
pypi.yaml@e9e8369d61ca8684c423d0647db504117f0705ff -
Trigger Event:
release
-
Statement type:
File details
Details for the file runner_pjpawel-0.1.4-py3-none-any.whl.
File metadata
- Download URL: runner_pjpawel-0.1.4-py3-none-any.whl
- Upload date:
- Size: 12.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9702758f4b37c9de7a428e0f98e64d65e07187e851e8d75549fd6d36435cc38b
|
|
| MD5 |
34d93512c0355161be6f2d1cf2097373
|
|
| BLAKE2b-256 |
4a0bd881d761e3bb8c600a24e3876ac2f9709b93a12cf4769eb37c9a8b7d178c
|
Provenance
The following attestation bundles were made for runner_pjpawel-0.1.4-py3-none-any.whl:
Publisher:
pypi.yaml on pjpawel/runner
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
runner_pjpawel-0.1.4-py3-none-any.whl -
Subject digest:
9702758f4b37c9de7a428e0f98e64d65e07187e851e8d75549fd6d36435cc38b - Sigstore transparency entry: 721404504
- Sigstore integration time:
-
Permalink:
pjpawel/runner@e9e8369d61ca8684c423d0647db504117f0705ff -
Branch / Tag:
refs/tags/0.1.4 - Owner: https://github.com/pjpawel
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
pypi.yaml@e9e8369d61ca8684c423d0647db504117f0705ff -
Trigger Event:
release
-
Statement type: