python3 and node run: inside Mirage
(in_process with a runtime), on the host, or in a container or sandbox.
Machines explains routing, captures and each
provider. This page covers what is particular to the Python SDK; each
machine’s page has its install and an example.
Declare machines
Each entry inWorkspace(machines={...}) is a config dict, a runtime object
or a machine handle. By default, the first machine whose captures names a program runs
it:
Change them on a live workspace
Machine providers such as docker and ssh can only be set in the constructor. On a running workspace,add_machine(name, spec) adds a runtime
or a host or remote machine, remove_machine(name) removes one, and engines() lists
them:
python3 moves to the new machine at once. A running line finishes before
its removed runtime closes, a removed instance cannot be added again, and
workspace cannot be removed. register_runtime(name, cls) makes your own
runtime class available by name in YAML.
Child processes
ws.spawn starts a program from your code with the same policy checks as a
shell command.
Python SDK notes
- Local: with neither
homenorMIRAGE_LOCAL_HOME,python3is the interpreter running Mirage. - Machines:
mount_type: sshneedspip install 'mirage-ai[ssh]'on the host. Thesshmachine matcheshostagainst~/.ssh/config.