FaaS

The Platform can run programs using the built-in Function-as-a-Service (FaaS) action blocks. They are available under the FaaS folder in the Workflow Editor.

Python

You can use the Python FaaS block to run and manage Python code. Python is one of the most popular programming languages used across different industries and use cases. You can easily place Python scripts and programs and pass parameters to them using the Workflow Editor. 

The Python FaaS block in the Workflow Editor

Procedure

  1. Drag and drop the Python action block from the Faas Folder available from the Workflow Editor onto any desired location.

  2. You can enter Python code in the code section available in the Object Editor. Like the other action blocks, you can access the fullscreen editor by clicking on the button in the value field when you hover over it. The editor supports language-standard syntax highlighting.

  3. You can seamlessly pass data from the workflow to the Python script by entering the values in the parameters field. All the properties added to the parameters object will automatically become variables within the Python code. Notice in our example that msg is being used as a property in the parameters object.

    In this example, a cached version of the Python block will be run

  4. Passing data out of the Python block happens through the print command in the Python code (or any other command that outputs to stdout). Anything printed out will appear in the result property of the Python block.

  5. The fullBuild option is a boolean field allowing you to decide if you want to run a cached version of the designated Python block. If set to true, this will run a cached version which will result in a faster runtime. It should be set to true before publishing to production, but set to false during debugging or when frequent changes to the code are being made.

In this example, a cached version of the Python block will be run

Python CLI

The Python CLI block allows for Python command-line scripts to be executed within the Workflow environment. Python is the supported programming language and the main difference is that the input is always "text" based. While the main Python block will execute the content like a Python interpreter, the Python CLI block will run the code as it is run through the command-line interface.

The

Procedure

  1. Drag and drop the Python CLI action block from the Faas Folder available from the Workflow Editor onto any desired location.

  2. When interacting with the Python Block you can toggle between const or expression input by clicking on the dropdown menu available under the Code section.

Choosing between const or expression input
  1. You can enter Python code in the code section available in the Object Editor. Like the other action blocks, you can access the fullscreen editor by clicking on the button in the value field when you hover over it. The editor supports language-standard syntax highlighting.

Input Limits!

Note that the Python CLI input limits are 2097000 bytes(~ 1.99 MB)

The Fullscreen Editor, note that you can toggle on/off Python syntax
  1. You can seamlessly pass data from the workflow to the Python script by entering the values in the CLI parameters field.

  2. Passing data out of the Python block is done as if it is run via the command-line interface. Anything printed out will appear in the result property of the Python block.

  3. The fullBuild option is a boolean field allowing you to decide if you want to run a cached version of the designated Python block. If set to true, this will run a cached version which will result in a faster runtime. It should be set to true before publishing to production, but set to false during debugging or when frequent changes to the code are being made.

  4. You can expand the Output variables to view the available ones according to the block.