mlos_bench.services.local.local_exec
Helper functions to run scripts and commands locally on the scheduler side.
Classes
Collection of methods to run scripts and commands in an external process on the node |
Functions
|
A single command line may contain multiple commands separated by special characters |
Module Contents
- class mlos_bench.services.local.local_exec.LocalExecService(config: Dict[str, Any] | None = None, global_config: Dict[str, Any] | None = None, parent: mlos_bench.services.base_service.Service | None = None, methods: Dict[str, Callable] | List[Callable] | None = None)[source]
Bases:
mlos_bench.services.local.temp_dir_context.TempDirContextService
,mlos_bench.services.types.local_exec_type.SupportsLocalExec
Collection of methods to run scripts and commands in an external process on the node acting as the scheduler.
Can be useful for data processing due to reduced dependency management complications vs the target environment.
Create a new instance of a service to run scripts locally.
- Parameters:
config (dict) – Free-format dictionary that contains parameters for the service. (E.g., root path for config files, etc.)
global_config (dict) – Free-format dictionary of global parameters.
parent (Service) – An optional parent service that can provide mixin functions.
methods (Union[Dict[str, Callable], List[Callable], None]) – New methods to register with the service.
- local_exec(script_lines: Iterable[str], env: Mapping[str, mlos_bench.tunables.tunable.TunableValue] | None = None, cwd: str | None = None) Tuple[int, str, str] [source]
Execute the script lines from script_lines in a local process.
- Parameters:
- Returns:
(return_code, stdout, stderr) – A 3-tuple of return code, stdout, and stderr of the script process.
- Return type: