Flows
Flows contain your automation logic. Within them, you define what you want to automate and how to do so.
The flow script is written in Python. Executions of flows will process the handler
function of the flow script.
Depending on the complexity of your automated process, it can consists of one or many flows. Executions of flows can start executions of other flows and pass inputs and outputs between each other.
Small flows with well-defined scope can be re-used by many automated processes. We recommend breaking automated processes down into several flows which automate specific tasks. In addition to simpler re-use, it also makes it easier to maintain and extend your automated processes.
Working with Flows
You can create flows in the User Interface by pressing the "Create" button and selecting "Flow":
The new flow is opened and you can directly modify the script.
The flow script editor provided in the Cloudomation user interface is mainly intended for writing small flows, or doing small edits on existing flows. For larger projects, it is recommended to use an editor of your choice and use the Git Integration.
When making changes, Cloudomation does not store older versions of your flows. Make sure to have a backup of your flows if you make significant changes. Or even better: use the Git Integration.
Clicking the "Run" button in the flow view will create an execution of the flow and automatically redirect you to the execution view. Read more about executing flows in the documentation on Development and Productive Mode.
Interaction between Flows
Executions of flows can create executions of other flows.
Create a child execution.
import flow_apidef handler(system: flow_api.System, this: flow_api.Execution):my_flow = this.flow('my_other_flow_name')return this.success('all done')
When an execution creates another execution, a parent-child relation is established between them:
If a child execution fails, it will raise an exception, causing the parent execution to fail as well. To avoid the parent failing, you can catch the exception:
Create a child execution and handle errors.
import flow_apidef handler(system: flow_api.System, this: flow_api.Execution):try:my_flow = this.flow('my_other_flow_name')except flow_api.DependencyFailedError:this.log('my_other_flow_name failed')else:this.log('my_other_flow_name succeeded')return this.success('all done')
Please refer to Exceptions for details about error handling.
Interaction with other Services: Tasks
In order to connect with services outside of the Cloudomation platform, you can create task executions from your flow.
Creating a task execution from your flow is simple:
import flow_apidef handler(system: flow_api.System, this: flow_api.Execution):my_task = this.task('GIT',command='get',url='https://github.com/starflows/library.git',)# read the outputs of the task and log themthis.log(my_task.get('output_value'))return this.success('all done')