romtools.hpc.components.caller#
Functions
|
Build the shell command that runs a staged call runner. |
Classes
|
Executes a Python callable named by a "module:qualname" target string. |
|
Imports and runs the target in the current process. |
|
Runs the target on a remote host over an SSH connection. |
|
Runs the target under a separate interpreter, through a runner script staged in a scratch directory beside the run directory. |
- class romtools.hpc.components.caller.BaseCaller(*, config=None, logger=None)[source]#
Bases:
Component,ABCExecutes a Python callable named by a “module:qualname” target string.
Arguments and return values may contain numpy arrays, tuples, lists, and dictionaries thereof.
- Parameters:
config (dict)
logger (Logger)
- class romtools.hpc.components.caller.LocalCaller(*, files, config=None, logger=None)[source]#
Bases:
BaseCallerImports and runs the target in the current process.
A configured python_setup or python_command names an interpreter other than this one - a Python provided by a module, or a wrapper such as srun - so the call is staged out to a subprocess instead of imported here.
- Parameters:
files (LocalFileManager) – The local file manager used to stage inputs and read results back
config (dict)
logger (Logger)
- class romtools.hpc.components.caller.RemoteCaller(connection, *, files, config=None, logger=None)[source]#
Bases:
StagedCallerRuns the target on a remote host over an SSH connection.
- Parameters:
connection (Connection) – An established Connection to the remote host
files (RemoteFileManager) – The remote file manager used to stage inputs and read results back
config (dict)
logger (Logger)
- class romtools.hpc.components.caller.StagedCaller(run_cmd, *, files, config=None, logger=None)[source]#
Bases:
BaseCallerRuns the target under a separate interpreter, through a runner script staged in a scratch directory beside the run directory.
Arguments and results travel as a JSON + .npz pair, so that interpreter needs no access to romtools; run_cmd and files decide which machine it lives on.
- Parameters:
run_cmd – Callable that issues a shell command on the execution host
files (BaseFileManager) – The file manager used to stage inputs and read results back
config (dict)
logger (Logger)
- romtools.hpc.components.caller.build_call_command(python_setup, python_command, call_id, target)[source]#
Build the shell command that runs a staged call runner.
Runner paths are relative to the run directory the command executes from, since the remote root itself may be relative. The body is a brace group so that a failed cd skips it entirely instead of running the payload in the login directory without errexit.
- Parameters:
python_setup (str)
python_command (str)
call_id (str)
target (str)
- Return type:
str