sys
check(ctx, cmd, cwd=None, log=False, fail=False, shell=None)
async
Check: Call arbitrary command as a check.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ctx
|
object
|
Contextual configuration. |
required |
cmd
|
str
|
See |
required |
cwd
|
str
|
See |
None
|
log
|
bool
|
See |
False
|
fail
|
bool
|
If true, then the check returning nonzero will raise an error rather than return false, meaning run abandonment rather than recheck will take place. |
False
|
shell
|
str
|
See |
None
|
Returns:
| Type | Description |
|---|---|
bool
|
True if return code is zero, false otherwise. |
Raises:
| Type | Description |
|---|---|
FailureNotToleratedError
|
Error when fail is true and the check returns a nonzero code. |
Source code in model_ensembler/tasks/sys.py
execute(ctx, cmd, cwd=None, log=False, shell=None)
async
Process: Call arbitrary command as a processing task.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ctx
|
object
|
Contextual configuration. |
required |
cmd
|
str
|
See |
required |
cwd
|
str
|
See |
None
|
log
|
bool
|
See |
False
|
shell
|
str
|
See |
None
|
Returns:
| Type | Description |
|---|---|
bool
|
True if return code is zero, false otherwise. |
Source code in model_ensembler/tasks/sys.py
move(ctx, dest, include=None, exclude=None, cwd=None)
async
Process: rsync current working directory contents.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ctx
|
object
|
Contextual configuration. |
required |
dest
|
str
|
Path to copy ctx.id named directory to. |
required |
include
|
List[str]
|
rsync include specifiers. |
None
|
exclude
|
List[str]
|
rsync exclude specifiers, defaults to "*" when calling rsync if include specifiers are given and no exclude specifiers are provided. |
None
|
cwd
|
str
|
See |
None
|
Returns:
| Type | Description |
|---|---|
bool
|
true if return code is zero, false otherwise. |
Raises:
| Type | Description |
|---|---|
RuntimeError
|
If did not provide necessary context attribute for using this processing task. |
Source code in model_ensembler/tasks/sys.py
remove(ctx, directory=None)
async
Process: Remove directory using shutil.rmtree.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ctx
|
object
|
Contextual configuration. |
required |
directory
|
str
|
Specify the directory to remove, otherwise this will use the path specified by ctx.dir. |
None
|
Returns:
| Type | Description |
|---|---|
bool
|
True if return code is zero, false otherwise. |
Raises:
| Type | Description |
|---|---|
OSError
|
If directory cannot be removed. |