Skip to main content

PYTHON

The Python Step allows you to run arbitrary Python code in order to perform minor data processing tasks such as filtering or manipulating data from other Steps in the Process. This step is similar to the JAVASCRIPT step

The code to execute is defined via the input.script field in the Step Context. This snippet is expected to be an anonymous function that receives two arguments: steps and context. The object returned from this function will be stored in the output.result field in the Step Context after execution.

Snippets provided to this Step may use the console.log() statement to persist execution information in the Step Context. Note that it is not currently feasible to use 3rd party libraries other than those in the default Node runtime. If your use-case requires 3rd party support, it is likely that Workers are a better solution.

Please find below an example of how this Step might be used to filter the results of the user_fetcher step ref:

def main(steps, context):
return {
"processId": context.get("id"),
"currentStepId": steps["__self"]["id"],
"statusMessage": "Process completed", # Test string
"isSuccessful": True # Test boolean
}

Input

FieldDescriptionMandatoryExample
scriptThe anonymous function to execute as part of this Step.See above

Output

FieldDescription
resultThe object that was returned by the function provided in input.script.
logsAn array of log objects, each containing the ms elapsed since execution started and the log message.
errorAn error message in case of an unsuccessful execution.