Shell task proxy.
This class is a proxy to Shell commandes. It allow running commands in a shell and get the output and stdout.
working_dir: str
summary
If not provided, an new temp directory is created. defaults to None
In a task it can be used provided like this : ShellProxy(message_dispatcher=self.message_dispatcher)
Can be useful to log command outputs in task's logs. defaults to None
Name | Type | Default value | Description |
---|---|---|---|
working_dir | str | Working directory for the shell (all command will be executed from this dir). , optional | |
message_dispatcher | MessageDispatcher | If provided, the output of the command will be redirected to the dispatcher. , optional |
Attach a custom observer to the shell proxy. The logs of the proxy will be dispatch to the observer
Name | Type | Default value | Description |
---|---|---|---|
observer | MessageObserver |
Attach a progress_bar to the shell proxy. The logs of the proxy will be dispatch to the progress_bar logs
Name | Type | Default value | Description |
---|---|---|---|
progress_bar | ProgressBar |
Run a command in a shell and return the output. There logs of the command are ignored.
:raises Exception: description
Name | Type | Default value | Description |
---|---|---|---|
cmd | Union | Command to run [list, str] | |
env | dict | Environment variables to pass to the shell, defaults to none , optional | |
shell_mode | bool | False | If true, the command is run in a shell, defaults to false , optional |
text | bool | True | If true, the output is returned as a string, defaults to true , optional |
Any |
Get the message dispatcher
MessageDispatcher |
Log an error message using the dispatcher
Name | Type | Default value | Description |
---|---|---|---|
message | str |
Log an info message using the dispatcher
Name | Type | Default value | Description |
---|---|---|---|
message | str |
Log a warining message using the dispatcher
Name | Type | Default value | Description |
---|---|---|---|
message | str |
Run a command in a shell. The logs of the command will be dispatched to the message dispatcher during the execution.
⚠️ Warning ⚠️ Do not set to True if the command generates a lot of logs,
because logs are stored in database, defaults to False
⚠️ Warning ⚠️ Do not set to True if the command generates a lot of logs,
because logs are stored in database, defaults to True
Name | Type | Default value | Description |
---|---|---|---|
cmd | Union | Command to run [list, str] | |
env | dict | Environment variables to pass to the shell, defaults to none , optional | |
shell_mode | bool | False | If true, the command is run in a shell, defaults to false , optional |
dispatch_stdout | bool | False | If true, the stdout of the command is dispatched to the message dispatcher. , optional |
dispatch_stderr | bool | True | If true, the stderr of the command is dispatched to the message dispatcher. , optional |
int |
Run a command in a shell without blocking the thread. There logs of the command are ignored.
Name | Type | Default value | Description |
---|---|---|---|
cmd | Union | Command to run [list, str] | |
env | dict | Environment variables to pass to the shell, defaults to none , optional | |
shell_mode | bool | False | If true, the command is run in a shell, defaults to false , optional |
SysProc |
ShellProxyDTO |
Returns the name of the class
Name | Type | Default value | Description |
---|---|---|---|
slugify | bool | False | True to slugify the class name if true, defaults to false , optional |
snakefy | bool | False | True to snakefy the class name if true, defaults to false , optional |
replace_uppercase | bool | False | Replace upper cases by "-" if true, defaults to false , optional |
str |
Returns the full name of the class
Name | Type | Default value | Description |
---|---|---|---|
slugify | bool | False | Slugify the returned class name if true, defaults to false , optional |
snakefy | bool | False | Snakefy the returned class name if true, defaults to false `` |
str |
Get the human name of the resource
str |
Get the short description of the resource
str |
Get the style of the resource
TypingStyle |
Get the typing name of the resource
str |
Get all the classes that inherit this class
List |