Executions
Executions are the central part of your automation, together with flows. Executions "get things done" in Engine. If you think about flows as a set of instructions that describe how your automation should work, you can think about executions as the instances where those instructions are acted upon.
E.g. a flow can define a logic to send an email. Every time you run this flow, an execution is created that processes the handler function of the flow and sends the email.
However, flows are not the only type of Execution. There are more execution types:
FLOW
orSCRIPT
which contain automation logicCONNECTION
which are connections to third party systemsSCHEDULE
which execute other flows periodically
Executions are preserved even after they finish their work. You can see past and present executions in the Execution Live Monitor.
Executions are activities and as such, they are more volatile than resources. E.g. they are not tracked by the git integration and are subject to a configurable auto-expiry.
Executions are normally created in the project or bundle where the executed resource (e.g. FLOW
) is located.
See here how you can override this behaviour.
Concept
Creating Executions
Executions can be created in several ways:
Using the User Interface
You can manually create executions of flows using the user interface. Navigate to the flow you want to start and click on "Run" or "Run in dev mode" to start the execution in productive or development mode respectively:
Run and Run in dev mode buttons
Find more information about the development and productive modes in Development and Productive Mode
Once a flow is started, it is executed once and immediately. You will be navigated to the execution.
Header of the an execution
Run with options
If you want to start an execution in a specific way, you can do so by selecting "Run with options" from the dropdown of the "Run" button.
The dropdown of the "Run" button.
Here you can customise the roles, the wrappers used and much more.
The customisation options for the execution.
Using the REST API
To create an execution using the REST API make an HTTP POST
request to
https://<your-workspace-name>.cloudomation.com/api/latest/execution
Please refer to the REST API documentation for details.
Using Webhooks
To create executions using a webhook, first you need to create and enable a webhook. Please refer to Webhooks for details.
Using Schedules
To create executions using a schedule, first you need to create and enable a schedule.
Helper to Create a Schedule
The scheduling bundle adds an additional button to the flow view which helps you to manually configure a schedule for your flow. Refer to the bundle manager on how to import bundles.
The schedule button
Clicking on the button will execute a helper flow which assists you in creating a new schedule. The helper flow will create a message form for you to configure the details of the schedule.
It is also possible to create schedules without using the helper flow. Please refer to Scheduling for more details.
By Executions
Executions can create other executions.
An execution creating synchronuous child executions of type FLOW
, CONNECTION
, and CONNECTION
.
import flow_api
def handler(system: flow_api.System, this: flow_api.Execution, inputs: dict):
this.flow('my-child-flow', custom_parameter='value')
this.connect('my-database', fetchval='SELECT 1+1')
this.connect(connector_type='REST', url='https://cloudomation.com')
return this.success('all done')
Defining Where Executions Run
Let's build on the previous example to see how you can specify the project in which the execution should run.
This is done by defining the project_id
key in the init
parameter.
An execution creating synchronuous child executions in specified projects.
import flow_api
def handler(system: flow_api.System, this: flow_api.Execution, inputs: dict):
this.flow('my-child-flow', custom_parameter='value', init={'project_id': system.project('my-project').get('id')})
this.connect('my-database', fetchval='SELECT 1+1', init={'project_id': system.project('my-other-project').get('id')})
this.connect(connector_type='REST', url='https://cloudomation.com', init={'project_id': system.project('Default project').get('id')})
return this.success('all done')
Execution Priority
When there are a lot of executions to be processed, Cloudomation Engine decides on the order of processing by looking at the execution priority. The higher the priority, the sooner it will be processed.
The execution priority can be set for individual executions but also for resources that create executions (e.g. flows). If you set the execution priority for a resource, all executions created by it will have that execution priority (unless overwritten explicitly in a flow script).
Setting execution priorities can be useful when there are many executions processed in parallel and some are more important than others i.e. they're time sensitive.
The default value for the execution priority can be adjusted in the workspace settings.
For Individual Executions
You can set the execution priority for an execution within a flow_script.
This is done by passing the priority
parameter.
An execution creating synchronuous child executions of type FLOW
and CONNECTION
with varying execution priorities.
import flow_api
def handler(system: flow_api.System, this: flow_api.Execution, inputs: dict):
this.flow('my-child-flow', custom_parameter='value', priority=10)
this.connect('my-database', fetchval='SELECT 1+1', priority=60)
return this.success('all done')
For Resources
You can set the execution priority for a resource in the UI by navigating to the resource, clicking on "Details" and entering a number into the execution priority field.
Execution created by this resource will then have the execution priority set in the resource.
The execution priority