gws_core

Introduction
Getting Started
Developer guide
Release
Architecture
CLI
Technical documentations
Version

ShellProxy

Shell task proxy.

This class is a proxy to Shell commandes. It allow running commands in a shell and get the output and stdout.

Attributes
working_dir: str
Functions
__init__

summary

working_dir : str
working directory for the shell (all command will be executed from this dir). If not provided, an new temp directory is created. defaults to None
message_dispatcher : MessageDispatcher
if provided, the output of the command will be redirected to the dispatcher. 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
attach_observer

Attach a custom observer to the shell proxy. The logs of the proxy will be dispatch to the observer

observer : MessageObserver
attach_progress_bar

Attach a progress_bar to the shell proxy. The logs of the proxy will be dispatch to the progress_bar logs

progress_bar : ProgressBar
check_output

Run a command in a shell and return the output. There logs of the command are ignored.

cmd : Union
command to run
env : dict
environment variables to pass to the shell
shell_mode : bool - False
if True, the command is run in a shell
text : bool - True
if True, the output is returned as a string
Return type : Any
clean_working_dir
dispatch_waiting_messages
get_message_dispatcher

Get the message dispatcher

Return type : MessageDispatcher
log_error_message

Log an error message using the dispatcher

message : str
log_info_message

Log an info message using the dispatcher

message : str
log_warning_message

Log a warining message using the dispatcher

message : str
run

Run a command in a shell. The logs of the command will be dispatched to the message dispatcher during the execution.

cmd : Union
command to run
env : dict
environment variables to pass to the shell
shell_mode : bool - False
if True, the command is run in a shell
dispatch_stdout : bool - False
if True, the stdout of the command is dispatched to the message dispatcher. ⚠️ Warning ⚠️ Do not set to True if the command generates a lot of logs, because logs are stored in database
dispatch_stderr : bool - True
if True, the stderr of the command is dispatched to the message dispatcher. ⚠️ Warning ⚠️ Do not set to True if the command generates a lot of logs, because logs are stored in database
Return type : int
run_in_new_thread

Run a command in a shell without blocking the thread. There logs of the command are ignored.

cmd : Union
command to run
env : dict
environment variables to pass to the shell
shell_mode : bool - False
if True, the command is run in a shell
Return type : SysProc
to_dto
Return type : ShellProxyDTO
classname @classmethod

Returns the name of the class

slugify : bool - False
True to slugify the class name if True
snakefy : bool - False
True to snakefy the class name if True
replace_uppercase : bool - False
Replace upper cases by "-" if True
Return type : str
full_classname @classmethod

Returns the full name of the class

slugify : bool - False
Slugify the returned class name if True
snakefy : bool - False
Snakefy the returned class name if True
Return type : str
get_human_name @classmethod

Get the human name of the resource

Return type : str
get_short_description @classmethod

Get the short description of the resource

Return type : str
get_style @classmethod

Get the style of the resource

Return type : TypingStyle
get_typing_name @classmethod

Get the typing name of the resource

Return type : str
inheritors @classmethod

Get all the classes that inherit this class

Return type : List