host.local_host¶
-
class otto.host.local_host.LocalFileTransfer(name: str, max_filename_len: int =
255)¶ Bases:
BaseFileTransferFile transfer for
LocalHost— a local copy viashutil.copy2().Concrete
BaseFileTransferso the ABC’s progress contract holds uniformly across every backend in the host fleet (Unix’sUnixFileTransfer, embedded’sEmbeddedFileTransfer, and this one). Per-file completion is the granularity —shutil.copy2is a single blocking C call with no progress hook, the analogue of an embeddedfs read.
- class otto.host.local_host.LocalHost(log: bool = True, resources: set[str] = <factory>, products: list[otto.host.product.Product] = <factory>, power_control: 'PowerController | None' = None)¶
Bases:
PosixPrivilege,PosixFileOps,BaseHost- power_control : PowerController | None¶
Always None — LocalHost/DockerContainerHost are not power-controlled.
-
async oneshot(cmd: str, timeout: float | None =
None, log: bool =True) CommandStatus¶ Run a command in a fresh subprocess (stateless, concurrent-safe).
Each call spawns an independent process — no state persists between calls, and multiple oneshot() calls can run concurrently via asyncio.gather().
- async open_session(name: str) HostSession¶
Open a named persistent shell session.
-
async expect(pattern: str | Pattern[str], timeout: float =
10.0) str¶ Wait for a pattern in the host’s session output stream.
- async get(src_files: ~types.Annotated[list[~pathlib.Path] | ~pathlib.Path, ~otto.utils.Arg(variadic=True, elem_type=~pathlib.Path, name=None, help=Remote file(s) to download.)], dest_dir: ~pathlib.Path, show_progress: ~typing.Annotated[bool, <otto.utils._Exclude object at 0x7fcc41e8fea0>] = True) tuple[Status, str]¶
Copy files to dest_dir on the local filesystem.
Delegates to
LocalFileTransferso progress reporting flows through the sameBaseFileTransfermachinery as Unix and embedded backends.
- async put(src_files: ~types.Annotated[list[~pathlib.Path] | ~pathlib.Path, ~otto.utils.Arg(variadic=True, elem_type=~pathlib.Path, name=None, help=Local file(s) to upload.)], dest_dir: ~pathlib.Path, show_progress: ~typing.Annotated[bool, <otto.utils._Exclude object at 0x7fcc41e8fea0>] = True) tuple[Status, str]¶
Copy files to dest_dir on the local filesystem.
Delegates to
LocalFileTransfer; seeget().