Skip to main content

Local-or-remote host abstraction + log/deliverables coordination protocol for optio task types.

Project description

optio-host

Local-or-remote host abstraction plus the log/deliverables coordination protocol used by optio task types.

optio-host lets a task author run shell commands, manage workdirs, and stream files without caring whether the work happens locally or on a remote host over SSH. It also provides a small line-based protocol that long-running worker processes can use to report progress and produce file deliverables.

What's in the box

  • Host Protocol + LocalHost / RemoteHost / make_host() — uniform interface for running commands, opening port forwards, transferring files, and tearing down workdirs. SSH details (auth, multiplexing, channel cleanup) are hidden behind asyncssh.
  • HookContext — small carrier passed into task hooks so they can run additional host commands, request file fetches, and report progress without touching optio-core internals.
  • optio_host.protocol — a line-oriented session driver. A long-running process on the host writes lines prefixed STATUS:, DELIVERABLE:, DONE, or ERROR. The driver tails the log, dispatches progress events, fetches deliverable files, and resolves the session on DONE / ERROR.
  • create_download_task(...) — a ready-made optio task that downloads a file from a remote host with progress reporting and integrity checks.

When to use it

You're building an optio task type that needs to run work on a host — local or remote — and you want:

  • one abstraction that works in both modes,
  • a structured way for the running process to talk back to optio (progress + deliverables),
  • SSH transport handled for you.

If you're writing the end-user task type directly (not consuming this library from another optio task package), you probably want optio-core instead.

Installation

pip install optio-host

optio-host depends on optio-core and asyncssh. Python 3.11+.

Minimal example

from optio_host import make_host, SSHConfig

# Local
async with make_host(ssh=None) as host:
    result = await host.run(["uname", "-a"])
    print(result.stdout)

# Remote
ssh = SSHConfig(host="worker-1", user="optio", key_path="~/.ssh/id_optio")
async with make_host(ssh=ssh) as host:
    result = await host.run(["uname", "-a"])
    print(result.stdout)

License

Apache-2.0.

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

optio_host-0.1.1.tar.gz (35.4 kB view details)

Uploaded Source

Built Distribution

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

optio_host-0.1.1-py3-none-any.whl (28.2 kB view details)

Uploaded Python 3

File details

Details for the file optio_host-0.1.1.tar.gz.

File metadata

  • Download URL: optio_host-0.1.1.tar.gz
  • Upload date:
  • Size: 35.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.5

File hashes

Hashes for optio_host-0.1.1.tar.gz
Algorithm Hash digest
SHA256 43473589c66145bfd97d7c0de15a2e8470e1b1573667a5c8cfb58f1879f2f64f
MD5 405b3600ecdff2c4fceb4fd62b075f82
BLAKE2b-256 1aa8c952e8f722e578dfd14ba3a5d5e193fffe05ff6eb710d7227868de8cab2d

See more details on using hashes here.

File details

Details for the file optio_host-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: optio_host-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 28.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.5

File hashes

Hashes for optio_host-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 a3175203f4a6b5574216ea5bdddc3b1735122905a1f9b4a4b78b7b35652cf78a
MD5 b6d0931051339f83dc7dc4cba05b2f05
BLAKE2b-256 e2f9782978cf2ee0bd2405a71a3e97e539ca39be72cf4c9ed1dbb65a72c7f8f6

See more details on using hashes here.

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