Skip to main content

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

  1. Create Runner class.
from runner_pjpawel import Runner
runner = Runner()
  1. Add commands. Use prepared Command classes in runner.commands module or classes that extends runnner.command.BaseCommand
from runner_pjpawel.command.common import ShellCommand
shell = ShellCommand("uname -a")
runner.add_command(shell)
  1. Invoke run or run_sync method.
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

  1. 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

runner_pjpawel-0.1.4.tar.gz (24.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

runner_pjpawel-0.1.4-py3-none-any.whl (12.7 kB view details)

Uploaded Python 3

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

Hashes for runner_pjpawel-0.1.4.tar.gz
Algorithm Hash digest
SHA256 3a7e248d6c9b8f4d23105b11172789ef5b41be5f4f728e5a3adbf1f787bd7b2f
MD5 24b3af28098af8a94ff509fe3450fdfc
BLAKE2b-256 65a8b4eb1bcf8af4cb2dc07d6a8fa9fd3fbc202d16d026c0c55e4a1df3f4c8a4

See more details on using hashes here.

Provenance

The following attestation bundles were made for runner_pjpawel-0.1.4.tar.gz:

Publisher: pypi.yaml on pjpawel/runner

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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

Hashes for runner_pjpawel-0.1.4-py3-none-any.whl
Algorithm Hash digest
SHA256 9702758f4b37c9de7a428e0f98e64d65e07187e851e8d75549fd6d36435cc38b
MD5 34d93512c0355161be6f2d1cf2097373
BLAKE2b-256 4a0bd881d761e3bb8c600a24e3876ac2f9709b93a12cf4769eb37c9a8b7d178c

See more details on using hashes here.

Provenance

The following attestation bundles were made for runner_pjpawel-0.1.4-py3-none-any.whl:

Publisher: pypi.yaml on pjpawel/runner

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page