Runner

Simple wrapper around subprocess.Popen.
Multiple commands can be configured to be executed. Each command can have some predetermined parameters and additional parameters or overrides can be passed when application is executed. Multiple instances of one application can be running using aliases.
To communicate to running processes Channel classes from yet-another-io-channels-library are used.
Examples:
Using STDIO.
runner = Runner()
runner.add("cat", "cat")
runner.start('cat')
channel = runner.get_channel('cat')
channel.write(b'hello, world')
# later
line = channel.read() # Will return b'hello, world'
Using UNIX socket.
runner = Runner()
self._runner.add("socat", "socat SYSTEM:cat UNIX-LISTEN:socket",
type="socket", socket="socket")
runner.start('socat')
channel = runner.get_channel('socat')
channel.write(b'hello, world')
# later
line = channel.read() # Will return b'hello, world'
Classes
Runner
Runner(*, extra_paths=None)
Create a new runner object.
extra_paths: List of paths which will be appended to PATH environment variable
add(self, name, command, **kwargs)
Add the application to the list of registered applications or update if already added.
name: application namecommand: the command to be executed
**kwargs can include the following:
type: eitherstdioorsocket. Default isstdiocwd: working directory of the processsocket: if type issocket, this is the name of the UNIX socket file to connect tosetpgrp: ifTruethe process is moved to a separate process group and will not receive signals sent to main process. Default isFalsebuffering: if set to"line"the channel is line-buffered for reading
update_config(self, config)
Config must be a dictionary where each key is an alias of an
application and value is a dictionary of that application's
configuration. runner.add("app", "command", **kwargs) is equivalent
to runner.update_config({"app": {"command": "command", **kwargs}}). Useful for adding multiple applications at once.
ensure_running(self, app_name, alias=None, with_args=None, **kwargs)
start(self, app_name, alias=None, with_args=None, **kwargs)
Start the process. If the process with the same alias is already
running, start will raise ProcessExistsException, while
ensure_running will silently do nothing.
app_name: application alias, given in the configurationalias: alias that will be given to actual started process. IfNone, application alias will be usedwith_args: list of additional arguments that will be added to the commandkwargs: extend or override parameters in application config
get_channel(self, alias)
Returns the Channel object to communicate to the running process.
terminate(self, alias)
Terminates the process.
Metadata
Release files for yet-another-runner 0.6.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 |
|---|---|---|---|---|
| yet-another-runner-0.6.0.tar.gz | 8.0 kB | Without provenance | Details for yet-another-runner-0.6.0.tar.gz |
Release files / yet-another-runner-0.6.0.tar.gz
| Download URL | yet-another-runner-0.6.0.tar.gz |
|---|---|
| Size | 8.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
0b3477b47525a8c8dd37d4e1e1199df464c3c875958094c80f009b0e6dcbc87f
|
|
BLAKE2b-256 checksum How to use checksums |
b59617597c793587b337bb86b1a6c4eb7a2cbca3c4d7a2d7f5c238ae2d064359
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.11.4
|
Security for yet-another-runner 0.6.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.