catalyst.Executor¶
- class Executor(address: str | None = None, *, host: str | None = None, user: str = '', port: int | None = None, workspace: str | None = None, plugins: list[str] | None = None, deploy: list[str | Path] | None = None, ready_timeout: float = 60.0, name: str = 'executor', sudo: bool = False, sudo_password: str | None = None, executor_bin: str | None = None, triple: str | None = None, env: dict[str, str] | None = None, verbose: int = 1)[source]¶
Bases:
objectA
catalyst-executorprocess, addressable over TCP ataddress. Construction is inert;launch()/stop()are idempotent, andwith Executor(...) as ex:launches on entry and stops on exit.Three modes:
host=<addr>: remote over forwarded SSH.deploy=[...]first scp’s those directories and files into the workspace.address: attach to an executor whose lifetime is managed elsewhere.neither: subprocess on
127.0.0.1(no SSH).
Attributes
The
host:portthe executor serves on.explicit
triple=if given, else auto-detected viauname.- address¶
The
host:portthe executor serves on. RaisesRuntimeErrorif it is neither launched nor committed to an address byresolve().
- triple¶
explicit
triple=if given, else auto-detected viauname.Nonewhen undetectable (the compiler falls back to the host triple).- Type:
LLVM target triple
Methods
launch()Deploy the executor and return
self.remove_workspace([force])Remote only.
resolve()Commit to the address this executor will serve on, without deploying it.
Remote only.
stop()Tear down the executor + tunnel and deregister from the atexit hook.
- launch() Self[source]¶
Deploy the executor and return
self. Idempotent, chainable. See the class docstring for the three modes.
- remove_workspace(force: bool = False) None[source]¶
Remote only. Delete a pinned workspace. Refuses to delete
/or$HOME.force=Truere-raises SSH errors; default swallows them. The safety refusal always raises.- Raises:
ValueError – If
hostorworkspaceis missing.
- resolve() Executor | None[source]¶
Commit to the address this executor will serve on, without deploying it.
Compiled programs carry their executor’s address, so it has to be known before the executor runs; committing to it here lets the deployment wait until execution. Only possible when the address is predictable: an attached executor already has one, and a deployed one needs
port=pinned, since a free-port search settles the address only at launch.- Returns:
selfif an address could be committed to,Noneif it is only knowable by launching and the caller should do that.- Return type:
Executor | None
- setup_workspace() Self[source]¶
Remote only. Deploy the bundle to a persistent workspace without starting the executor.
Requires
host, pinnedworkspace=, anddeploy=. Idempotent; a laterlaunch()(or a freshExecutor(..., workspace=<same>)) reuses it. Delete viaremove_workspace().- Raises:
ValueError – If
host,workspace, ordeployis missing.
- stop() None[source]¶
Tear down the executor + tunnel and deregister from the atexit hook. Idempotent. Auto-generated workspaces are removed; a pinned
workspace=stays forremove_workspace(). Shutdown errors are swallowed (best-effort).