Running scripts and Python functions

Running scripts and Python functions#

class vortex.algo.components.Expresso(*args, **kw)[source]#

Run a script resource in the good environment.

class vortex.algo.components.PythonFunction(*args, **kw)[source]#

Execute a function defined in Python module. The function is passed the current sequence, as well as a keyword arguments described by attribute func_kwargs. Example:

>>> exe = toolbox.executable(
...     role           = 'Script',
...     format         = 'ascii',
...     hostname       = 'localhost',
...     kind           = 'script',
...     language       = 'python',
...     local          = 'module.py',
...     remote         = '/path/to/module.py',
...     tube           = 'file',
... )
>>> tbalgo = toolbox.algo(
...     engine="function",
...     func_name="my_plugin_entry_point_function",
...     func_kwargs={ntasks: 35, subnproc: 4},
... )
>>> tbalgo.run(exe[0])
# /path/to/module.py
# ...
def my_plugin_entry_point_function(
    sequence, ntasks, subnproc,
):
    for input in sequence.effective_inputs(role=gridpoint):
        # ...