Skip to content

Workflow py Operator Syntax Reference

Treasure Workflow supports the Python operator to run custom scripts, which are triggered by other command operators in Treasure Workflow.

The py> operator runs a Python script using Python command.

See Python API documents for details including variable mappings to keyword arguments.

+step1:
  py>: my_step1_method
+step2:
  py>: tasks.MyWorkflow.step2

Syntax

py>: [tasks.][PACKAGE.CLASS.]METHOD

where:

  • [tasks.] -

  • [PACKAGE.CLASS] - Optional class name of your Python object.

  • METHOD: Name of the task defined within your Python object class that defines the action that you want performed during this stage of the Treasure Workflow.

Examples

py>: tasks.MyWorkflow.my_task

python : PATH STRING or COMMAND ARGUMENTS LIST

The python defaults to python . If an alternate python and options are desired, use the python option.Examples:

  • python: /opt/conda/bin/python
  • python: ["python" , "v"]

It is also possible to configure this in an export section.

Example:

_export:
  py:
    python: /opt/conda/bin/python