utils
execute_command(cmd, cwd=None, log=False, shell=None)
async
Standard handling for calling external command.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
cmd
|
str
|
The relative path of the command being called to cwd. |
required |
cwd
|
str
|
The current working directory to call the cmd from, passed to subprocess. |
None
|
log
|
bool
|
If true, output stdout/stderr to logfile in cwd. |
False
|
shell
|
str
|
Which shell to ask subprocess to invoke when processing the command, will default to bash internally. |
None
|
Returns:
| Type | Description |
|---|---|
object
|
Namespace containing the returncode, stdout and stderr from the process that was invoked. |
Source code in model_ensembler/tasks/utils.py
flight_task(func, check=True)
Decorator for making func as a task, providing context preprocessing.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
func
|
callable
|
Callable to wrap with context. |
required |
check
|
bool
|
Determine whether the func is to be treated as a check or another type of action (checks can be skipped). |
True
|
Returns:
| Type | Description |
|---|---|
func
|
The wrapped function that can process the context provided appropriately. |