Back to bricks list
Introduction Getting Started
Architecture
Technical Documentation
Other Classes
AbstractDbManager AgentFactory AudioView AuthService BadRequestException BarPlotView Base BaseEnvShell BaseHTTPException BaseModelDTO BaseTestCase BaseTestCaseLight BashCodeParam BoolParam BoolRField BoolValidator BoxPlotView BrickMigration BrickService CheckBeforeTaskResult CommunityService Compress CondaShellProxy Config ConfigParams Connector ConnectorPartSpec ConnectorSpec ConverterRunner Credentials CredentialsDataBasic CredentialsDataLab CredentialsDataOther CredentialsDataS3 CredentialsParam CredentialsType CurrentUserService Dashboard DashboardType DataframeAggregatorHelper DataframeDataFilterHelper DataframeFilterHelper DataFrameRField DataframeScalerHelper datetime DateTimeUTC DbConfig DictRField DictValidator DispatchedMessage DynamicInputs DynamicOutputs EntityNavigator EntityNavigatorNote EntityNavigatorResource EntityNavigatorScenario EntityNavigatorService EntityNavigatorView EntityTag EntityType Enum ExceptionHandler ExceptionResponse ExpressionBuilder ExternalApiService ExternalSpaceCreateFolder FileDownloader FileHelper FileRField FloatParam FloatRField FloatValidator ForbiddenException FrontService FrontTheme FSNodeModel FsNodeService GwsCorePackages GWSException GzipCompress HeatmapView HistogramView ImageView InPort Inputs InputSpec InputSpecs InterfaceSpec IntParam IntRField IntValidator IO IOface Job JsonCodeParam JSONField JSONView JuliaCodeParam KVStore LazyViewParam LinePlot2DView ListParam ListRField ListValidator Logger LoggerMessageObserver MailService MambaShellProxy MessageDispatcher MessageLevel MessageObserver Model ModelRfield ModelService Monitor MonitorService MultiViews NetworkView Note Notebook NoteParam NoteSearchBuilder NoteService NoteTemplate NoteTemplateParam NoteTemplateService NotFoundException NumericHelper NumericParam NumericValidator OpenAiChat OpenAiChatMessage OpenAiChatParam OpenAiHelper OutPort Outputs OutputSpec OutputSpecs PackageHelper Paginator ParamSet ParamSpec PerlCodeParam PipShellProxy PlotlyRField PlotlyView PoolDb Port PrimitiveRField Process ProcessFactory ProcessModel ProcessProxy ProcessSpec ProgressBar ProgressBarMessageObserver ProgressBarService ProtocolModel ProtocolProxy ProtocolService ProtocolTyping PythonCodeParam Queue QueueService RCodeParam Requests ResourceDownloaderBase ResourceModel ResourceOrigin ResourceRField ResourceSearchBuilder ResourceService ResourceTransfertService ResourceTyping RField RichText RichTextBlock RichTextBlockModificationDTO RichTextBlockModificationWithUserDTO RichTextBlockType RichTextDTO RichTextFigureData RichTextFileData RichTextFormulaData RichTextListData RichTextListItem RichTextModificationDifferenceDTO RichTextModificationsDTO RichTextModificationType RichTextNoteResourceViewData RichTextObjectType RichTextParagraphData RichTextParagraphHeaderData RichTextParagraphHeaderLevel RichTextParagraphListData RichTextParagraphListItemData RichTextParagraphText RichTextResourceViewData RichTextTimestampData RichTextUserDTO RichTextVariableData RichTextView RichTextViewFileData S3Bucket ScatterPlot2DView Scenario ScenarioCreationType ScenarioProcessStatus ScenarioProxy ScenarioRunService ScenarioSaveDTO ScenarioSearchBuilder ScenarioService ScenarioStatus ScenarioTemplate ScenarioTemplateFactory ScenarioTransfertService SearchBuilder SerializableObjectJson SerializableRField Settings ShellProxy ShellProxyFactory SimpleTextView SpaceFolder SpaceService SqlMigrator StackedBarPlotView StreamlitApp StreamlitAppManager StreamlitProcess StringHelper StrParam StrRField StrValidator SysProc TableAnnotatorHelper TableColumnSelector TableColumnTagToRowExtractor TableColumnTagUnfolder TableConcatHelper TableHeaderInfo TableOperationHelper TableRowSelector TableRowTagToColumnExtractor TableRowTagUnfolder TableScalerHelper TableTagAggregatorHelper TableUnfolderHelper TableView TabularView Tag TagHelper TagKeyModel TagList TagService TagsParam TagValueModel TarCompress TarGzCompress TaskFileDownloader TaskHelper TaskInputs TaskModel TaskProxy TaskRunner TaskService TaskTyping TechnicalInfo TextParam TextView TextViewData Typing TypingDeprecated TypingIconColor TypingIconType TypingManager TypingStyle UnauthorizedException URLValidator User UserCredentialsDTO UserGroup UserService Utils UUIDRField Validator VennDiagramView Version View ViewConfig ViewTester ViewType YamlCodeParam ZipCompress
Version

MambaShellProxy

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
CONFIG_FILE_NAME: strenv_file_path: strenv_hash: strenv_name: strworking_dir: str
Functions
__INIT__

summary

                  will be used to create the env. If the env file has changed, the env will be recreated and
                  previous env will be deleted.
                If not provided, an new temp directory is created. defaults to None
                      Can be useful to log command outputs in task's logs. defaults to None

:raises Exception: description :raises Exception: description

Parameters:
NameTypeDefault valueDescription
env_file_pathUnion Path to the env file. this file must contained dependencies for the virtual env and str
env_namestr Name of the environment. this name will be shown in the env list. if not provided, a name is generated
working_dirstr Working directory for the shell (all command will be executed from this dir). , optional
message_dispatcherMessageDispatcher If provided, the output of the command will be redirected to the dispatcher. , optional
ATTACH_OBSERVER

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

Parameters:
NameTypeDefault valueDescription
observerMessageObserver
ATTACH_PROGRESS_BAR

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

Parameters:
NameTypeDefault valueDescription
progress_barProgressBar
BUILD_OS_ENV

Creates the OS environment variables that are passed to the shell command

Return type:
dict
CHECK_OUTPUT

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

:raises Exception: description

Parameters:
NameTypeDefault valueDescription
cmdUnion Command to run [list, str]
envdict Environment variables to pass to the shell, defaults to none , optional
shell_modebool False If true, the command is run in a shell, defaults to false , optional
textbool True If true, the output is returned as a string, defaults to true , optional
Return type:
Any
CLEAN_WORKING_DIR
CREATE_ENV_DIR

Create the env dir.

Return type:
Path
DISPATCH_WAITING_MESSAGES
ENV_IS_INSTALLED

Returns True if the virtual env is installed. False otherwise

Return type:
bool
FORMAT_COMMAND

Format the user command. If the command is a list, must return a list.

Parameters:
NameTypeDefault valueDescription
user_cmdUnion
Return type:
Union
GET_CONFIG_FILE_PATH

Returns the path of the config file used to create the env

Return type:
str
GET_ENV_DIR_PATH

Returns the absolute path for the env dir base on a dir name. All env are in the global env dir.

Return type:
str
GET_MESSAGE_DISPATCHER

Get the message dispatcher

Return type:
MessageDispatcher
GET_VENV_DIR_PATH
Return type:
str
INSTALL_ENV

Install the virtual env. Return True if the env was installed, False if it was already installed, or an error occured.

Return type:
bool
LOG_ERROR_MESSAGE

Log an error message using the dispatcher

Parameters:
NameTypeDefault valueDescription
messagestr
LOG_INFO_MESSAGE

Log an info message using the dispatcher

Parameters:
NameTypeDefault valueDescription
messagestr
LOG_WARNING_MESSAGE

Log a warining message using the dispatcher

Parameters:
NameTypeDefault valueDescription
messagestr
READ_ENV_FILE

Read the env file and return its content.

Return type:
str
RUN

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
Parameters:
NameTypeDefault valueDescription
cmdUnion Command to run [list, str]
envdict Environment variables to pass to the shell, defaults to none , optional
shell_modebool False If true, the command is run in a shell, defaults to false , optional
dispatch_stdoutbool False If true, the stdout of the command is dispatched to the message dispatcher. , optional
dispatch_stderrbool True If true, the stderr of the command is dispatched to the message dispatcher. , optional
Return type:
int
RUN_IN_NEW_THREAD

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

Parameters:
NameTypeDefault valueDescription
cmdUnion Command to run [list, str]
envdict Environment variables to pass to the shell, defaults to none , optional
shell_modebool False If true, the command is run in a shell, defaults to false , optional
Return type:
SysProc
TO_DTO
Return type:
ShellProxyDTO
UNINSTALL_ENV

Uninstall the virtual env. Return true if the env was uninstalled, False if it was already uninstalled or an error occured.

Return type:
bool
CLASSNAME - @classmethod

Returns the name of the class

Parameters:
NameTypeDefault valueDescription
slugifybool False True to slugify the class name if true, defaults to false , optional
snakefybool False True to snakefy the class name if true, defaults to false , optional
replace_uppercasebool False Replace upper cases by "-" if true, defaults to false , optional
Return type:
str
FOLDER_IS_ENV - @classmethod

return true if the folder is a valid env folder

Parameters:
NameTypeDefault valueDescription
folder_pathstr
Return type:
bool
FROM_ENV_STR - @classmethod

Create the virtual environment from a string containing the environment definition.

The env dir name is generated from an hash of the env_str. So if the env_str is the same, the env dir name will be the same.

Parameters:
NameTypeDefault valueDescription
env_strstr
message_dispatcherMessageDispatcher
Return type:
BaseEnvShell
FULL_CLASSNAME - @classmethod

Returns the full name of the class

Parameters:
NameTypeDefault valueDescription
slugifybool False Slugify the returned class name if true, defaults to false , optional
snakefybool False Snakefy the returned class name if true, defaults to false ``
Return type:
str
GET_CREATION_INFO - @classmethod

Returns the json info file content

Parameters:
NameTypeDefault valueDescription
folder_pathstr
Return type:
VEnvCreationInfo
GET_ENV_TYPE - @classmethod

Returns the type of the env

Return type:
Literal
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
HASH_ENV_STR - @classmethod

Create a hash from the env_str to generate a unique env dir name.

Parameters:
NameTypeDefault valueDescription
env_strstr
Return type:
str
INHERITORS - @classmethod

Get all the classes that inherit this class

Return type:
List