Marvin Actions
Marvin Actions help you to interact with Marvin RPA functions.
Actions
marvin.execute
Add a new process to Marvin execution queue
Parameters:
script - name of the automation script to be executed.
vars - variables to be setted on script start.
robotKey - robotKey of the robot to execute the script. If the execution is at the same robot, keep it as None
robotSecret - robotSecret of the robot to execute the script. If the execution is at the same robot, keep it as None
Returns:
executionId - ID of the execution added to robots queue.
Usage Example
marvin.execute("another-process", {'email': '[email protected]', 'name': 'John'})
prompt.alert('Execution ID: ' + $executionId)
marvin.import_module
Imports Python modules that are not natively included with Marvin. Does the same as the import module
and from package import module
in Python.
Parameters:
import_name - name of the module to be imported. Here will be putted the part of the import
of Python syntax.
from_name - used when the Python import contains from
. Here will be putted the from
part of Python syntax.
version - specific version of the module (optional). Ex: "1.2.3", ">=1.2.0", "~=1.2.0". If specified, the module will be automatically installed before import.
Returns:
<import_name> - return the requested module, with the same name as the given import_name
.
Exceptions:
ModuleNotInstalled - when the requested module was not installed previously, or the module is not present on Marvin. Check marvin.install_module action for further informations.
Usage Example - Simple Import
Usage Example - Import with Specific Version
Usage Example - From Import
Usage Example - From Import with Version
Usage Example - Version Operators
# Install version greater than or equal to 1.5.0
result = marvin.import_module("pandas", version=">=1.5.0")
# Install version compatible with 1.2.x
result = marvin.import_module("numpy", version="~=1.2.0")
# Install version different from 2.0.0
result = marvin.import_module("requests", version="!=2.0.0")
marvin.install_module
Install modules that are not natively included with Marvin. This is a analog function to pip install <module>
on Python.
Parameters:
module_name - name of the module to be installed for your process.
version - specific version of the module (optional). Ex: "1.2.3", ">=1.2.0", "~=1.2.0", "!=2.0.0".
Returns:
This action has no return
Usage Example - Install Latest Version
Usage Example - Install Specific Version
Usage Example - Install with Version Operators
# Install version greater than or equal to 1.5.0
marvin.install_module('pandas', '>=1.5.0')
# Install version compatible with 1.2.x (>=1.2.0, <1.3.0)
marvin.install_module('numpy', '~=1.2.0')
# Install version less than or equal to 2.0.0
marvin.install_module('requests', '<=2.0.0')
# Install any version except 2.0.0
marvin.install_module('flask', '!=2.0.0')
Important: sometimes the module name used on Python
import
is the same name as used for module instalation. If some error occurs, check if your informations are correct.Version Note: The system supports PEP 440 version operators: -
==
- exact version (automatically added if not specified) ->=
- version greater than or equal -<=
- version less than or equal
-~=
- compatible version (ex:~=1.2.0
=>=1.2.0, <1.3.0
) -!=
- different versionCompatibility: The functions maintain compatibility with existing code. If no version is specified, the behavior will be the same as before (installation of the latest version).