Environment
Environment
Methods:
Name | Description |
---|---|
importModule |
Imports the given module (if necessary) and returns a fake module object |
install |
Installs dependencies. |
launch |
Launch the environment, only available in ExternalEnvironment. Raises an exception in InternalEnvironment. See |
executeCommands |
Executes the given commands in this environment. |
execute |
Execute the given function in the given module. See |
launched |
Check if the environment is launched, important in ExternalEnvironment |
exit |
Exit the environment |
Source code in wetlands/environment.py
importModule(modulePath)
Imports the given module (if necessary) and returns a fake module object that contains the same methods of the module which will be executed within the environment.
Source code in wetlands/environment.py
install(dependencies, additionalInstallCommands={})
Installs dependencies.
See EnvironmentManager.create
for more details on the dependencies
and additionalInstallCommands
parameters.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
dependencies
|
Dependencies
|
Dependencies to install. |
required |
additionalInstallCommands
|
Commands
|
Platform-specific commands during installation. |
{}
|
Returns: Output lines of the installation commands.
Source code in wetlands/environment.py
launch(additionalActivateCommands={}, logOutputInThread=True)
abstractmethod
Launch the environment, only available in ExternalEnvironment. Raises an exception in InternalEnvironment. See InternalEnvironment.launch
and ExternalEnvironment.launch
Source code in wetlands/environment.py
executeCommands(commands, additionalActivateCommands={}, popenKwargs={})
Executes the given commands in this environment.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
commands
|
Commands
|
The commands to execute in the environment. |
required |
additionalActivateCommands
|
Commands
|
Platform-specific activation commands. |
{}
|
popenKwargs
|
dict[str, Any]
|
Keyword arguments for subprocess.Popen(). See |
{}
|
Returns:
Type | Description |
---|---|
Popen
|
The launched process. |
Source code in wetlands/environment.py
execute(modulePath, function, args=(), kwargs={})
abstractmethod
Execute the given function in the given module. See ExternalEnvironment.execute
and InternalEnvironment.execute