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
HostProtocol +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 behindasyncssh.HookContext— small carrier passed into task hooks so they can run additional host commands, request file fetches, and report progress without touchingoptio-coreinternals.optio_host.protocol— a line-oriented session driver. A long-running process on the host writes lines prefixedSTATUS:,DELIVERABLE:,DONE, orERROR. The driver tails the log, dispatches progress events, fetches deliverable files, and resolves the session onDONE/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
Release history Release notifications | RSS feed
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 optio_host-0.1.2.tar.gz.
File metadata
- Download URL: optio_host-0.1.2.tar.gz
- Upload date:
- Size: 36.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e15324487de08252e60e752fe030f2ed507d7cd6bcb84b6671b669aa83530ae4
|
|
| MD5 |
00658806bcb5c7412658447bb1fc1ada
|
|
| BLAKE2b-256 |
0bdf534c8e3198e30d024714e73d66e4cb5efd1f77a59345d7ad162dbc2e29db
|
File details
Details for the file optio_host-0.1.2-py3-none-any.whl.
File metadata
- Download URL: optio_host-0.1.2-py3-none-any.whl
- Upload date:
- Size: 28.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
42ea1f08a37adc456a67e9ec2892ecaffb9f2459e35c9a0aae0368e80140fe97
|
|
| MD5 |
a70ad9a6accdbf0b8fe13cf168c2b967
|
|
| BLAKE2b-256 |
d26630d40a4fa3140a9e1613d6a03371b6907b045e8b51b80daaf7e3411dcf94
|