Flow Generation

For simple flows, Gladier can handle the process of stitching together the flows of several tools into one big flow, or even generating a flow from scratch for a simple Gladier tool. Flow generation does not replace manually authored flows, but provides a path for automating simple flows that don’t require a lot of branching.

Flow generation is available for both clients and tools with the @generate_flow_definition decorator. Although it’s applied the same way, the decorator behaves a little differently for a client and a tool.

  • Gladier Tool – Generates a flow for each function defined in funcx_functions

  • Gladier Client – Combines flows for each Gladier Tool defined in gladier_tools

Flow Generation on Gladier Tools

For Gladier Tools that only need one flow step per FuncX Function, flow generation can be a good option. Gladier will automatically determine information about the functions on the tool, and incorporate them into the flow. The usage looks like this:

from gladier import GladierBaseTool, generate_flow_definition

def ls(data):
    """Do an 'ls' on the filesystem, given a ``dir``"""
    import os
    the_dir = data.get('dir', '~')
    return os.listdir(the_dir)

class FileSystemListCommand(GladierBaseTool):
    """List files on the filesystem"""
    funcx_functions = [ls]

The decorator @generate_flow_definition will automatically set the flow_definition attribute when a GladierClient includes it in tools. The flow it generates will be identical to the following:

  "Comment": "List files on the filesystem",
  "StartAt": "Ls",
  "States": {
    "Ls": {
      "ActionScope": "https://auth.globus.org/scopes/facd7ccc-c5f4-42aa-916b-a0e270e2c2a9/automate2",
      "ActionUrl": "https://api.funcx.org/automate",
      "Comment": "Do an 'ls' on the filesystem, given a ``dir``",
      "Type": "Action",
      "ExceptionOnActionFailure": false,
      "Parameters": {
        "tasks": [
            "endpoint.$": "$.input.funcx_endpoint_compute",
            "func.$": "$.input.ls_funcx_id",
            "payload.$": "$.input"
      "End": true,
      "ResultPath": "$.Ls",
      "WaitTime": 300

Flow Generation Modifiers

You’ll notice that flow generation makes some assumptions you might want to change. For example, ls is not a compute heavy task, and might be better to run on the head node. Overriding some attributes of the flow can be done with modifiers.

    ls: {'endpoint': 'funcx_endpoint_non_compute'}
class FileSystemListCommand(GladierBaseTool):
    """List files on the filesystem"""
    funcx_functions = [ls]

Flow Generation on Gladier Clients

When Flow Generation is applied to Gladier Clients it does not generate the flow from scratch, but instead combines the flow on each Gladier Tool into one big flow.

Note that modifiers can also be used with Gladier Clients to customize some attributes.

   'generate_metadata': {'endpoint': 'funcx_endpoint_non_compute'},
   'publish_to_search': {'endpoint': 'funcx_endpoint_non_compute',
                         'payload': 'generate_metadata'}
class ProcessData(GladierBaseClient):
    gladier_tools = [


A complete reference is coming soon!