Wrapper bundle
Wrappers encapsulate executable resources. Executing a wrapped resource will instead run the wrapper, which can coordinate the execution of the wrapped resource.
Download
Download the bundle using the Bundle Manager.
Included resources
cache
Execution wrapper for caching an output_value
Returns the output_value
of a previous execution.
usage:
this.using(
'cache',
max_age_minutes=60,
).connect(
'my-connector'
)
# returns the output_value of the last successful execution of
# "my-connector". if there is no successful execution of
# within the last 60 minutes, it will create a new connection
# and return its output_value
Input schema
Key | Type | Description | Default |
---|---|---|---|
max_age_minutes | integer | How old a child execution can be before considered stale. |
|
check
Execution wrapper for output_value checks
waits for a child execution and passes the outputs to a script to check for correctness
usage with a checker flow:
this.using(
'check',
checker_flow='my-checker-flow',
inputs={
'additional': 'inputs',
'to': 'checker',
},
).flow(
'child-execution'
)
usage with a checker script:
this.using(
'check',
checker_script=(
'''
import flow_api
def handler(system: flow_api.System, this: flow_api.Execution):
# TODO add your logic to check this.get('input_value')['data']
# additional inputs are available in this.get('input_value')
return this.success('check succeeded')
'''
),
inputs={
'additional': 'inputs',
'to': 'checker',
},
).flow(
'child-execution'
)
Input schema
Any of
- Checker flow
Key | Type | Description | Default |
---|---|---|---|
checker_flow | string | A flow which is called with the output_value of the child to determine if the child was successful. |
- Checker script
Key | Type | Description | Default |
---|---|---|---|
checker_script | string | A script which is called with the output_value of the child to determine if the child was successful. |
interactive
Execution wrapper for interactive error handling
observes a child execution and pauses when an error occurs
usage:
this.using(
'interactive',
interactive_limit_minutes: int = 30,
archive_retries: bool = True,
notify_users: list[str] = None,
context: object = None,
child_message_is_markdown: bool = True,
subject: str = '{{child_name}} failed{{#is_retry}} {{fail_count}} times{{/is_retry}}',
body: str = '''Execution [{{child_name}}]({{self_url}}/execution/{{child_id}}) ended with **{{child_status}}**
{{#parent_name}}
The parent process **{{parent_name}}** is blocked and waiting for confirmation on how to continue.
{{/parent_name}}
{{#is_email}}
Please choose how to proceed by following this link: [{{subject}}]({{self_url}}/execution/{{this_id}})
{{/is_email}}
{{#context}}
### Context
{{context}}
{{/context}}
{{#child_message}}
### Status message
{{child_message}}
{{/child_message}}
''',
).flow(
'child-execution'
)
Input schema
Key | Type | Description | Default |
---|---|---|---|
archive_retries | boolean | If set, previous child executions are archived when a new child execution is started. |
|
body | string | A template for the body of notifications sent to users. |
|
child_message_is_markdown | boolean | If set, the status message of ended child executions is interpreted as markdown. |
|
context | object | Any contextual JSON data which is attached to notifications. | |
interactive_limit_minutes | integer | Cloudomation users which have not been active within that time are considered inactive. |
|
notify_users | enum | Any of
Notify all users which were active within
Notify a single user.
Notify a list of users. | |
subject | string | A template for the subject line of notifications sent to users. |
|
mock
Execution wrapper for mocking output_value
Returns the output_value of a previous execution.
modes
-
ENDED_SUCCESS
(default)looks for the last successful execution of the child and returns its output_value
-
ENDED_ERROR
looks for the last failed execution of the child and returns its output_value
-
LAST
looks for the last execution of the child and returns its output_value
-
STATIC
returns the output_value which is configured in the output_value parameter of the wrapper
-
FIXED
returns the output_value of the execution which is specified using the execution_id parameter of the wrapper
usage:
this.using(
'mock',
).connect(
'my-connector'
)
# returns the output_value of the last successful execution of "my-connector"
Input schema
Key | Type | Description | Default | ||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
ignore_in_productive_mode | boolean | When set and run in productive mode, the child will not be mocked but started normally. |
| ||||||||||||||||||||||||||||||||||||||||||||||||
mode | enum | Any of
|
notify
Execution wrapper for notifications
observes a child execution and generates notification on end
usage:
this.using(
'notify',
notify_on_success: bool = False,
notify_on_error: bool = True,
child_message_is_markdown: bool = True,
to: list[str] = None,
context: object = None,
subject: str = '{{child_name}} {{child_status}}',
body: str = '''Execution [{{child_name}}]({{self_url}}/execution/{{child_id}}) ended with **{{child_status}}**
{{#context}}
### Context
{{context}}
{{/context}}
{{#child_message}}
### Status message
{{child_message}}
{{/child_message}}
''',
).flow(
'child-execution'
)
Input schema
Key | Type | Description | Default |
---|---|---|---|
body | string | A template for the body of notifications sent to users. |
|
child_message_is_markdown | boolean | If set, the status message of ended child executions is interpreted as markdown. |
|
notify_on_error | boolean | If a notification should be generated when the child ends with |
|
notify_on_success | boolean | If a notification should be generated when the child ends with | |
subject | string | A template for the subject line of notifications sent to users. |
|
to | enum | Any of
Notify a single user.
Notify a list of users |
retry
Execution wrapper for retries
observes a child execution and restarts it if an error occurs
usage:
this.using(
'retry',
max_tries: int = 0,
delay_sec: int = 10,
timeout_sec: int = 0,
archive_retries: bool = True,
).flow(
'child-execution'
)
todo:
- back-off
- hard timeout: cancel child when exceeded
Input schema
Key | Type | Description | Default |
---|---|---|---|
archive_retries | boolean | If set, previous child executions are archived when a new child execution is started. |
|
delay_sec | integer | The number of seconds to wait in between retries. |
|
max_tries | integer | The number of times to try starting the child before failing. |
|
timeout_sec | integer | Fail, if the child did not succeed within the timeout. Set to 0 to disable. |
rollback
Execution wrapper for rollbacks
starts a rollback flow in case of exceptions
usage:
this.using(
'rollback',
rollback_flow_name: str = 'my_rollback_flow',
).flow(
'child-execution'
)
Input schema
Key | Type | Description | Default |
---|---|---|---|
rollback_flow_name | string | The name of the flow that should be executed in case of a |
timeout
Execution wrapper for timeouts
Starts a child execution and waits for it to end within a timeout. If the timeout is exceeded, the child execution and all descendants are cancelled.
usage:
this.using(
'timeout',
seconds=30,
).flow(
'child-execution'
)
Input schema
Key | Type | Description | Default |
---|---|---|---|
seconds | integer | The number of seconds before a timeout occurs. |
|
validate
Execution wrapper for validating input/output schema.
usage:
this.using(
'validate',
schema_name: str = 'my_schema_name',
mode: str = 'complain',
point_of_validation: str = 'input',
).flow(
'child-execution'
)
Input schema
Key | Type | Description | Default |
---|---|---|---|
mode | enum | Any of
Validates the input_value or output_value of the child against a json schema and raises a Constant value:
Creates a json schema from the Constant value:
| |
point_of_validation | enum | Any of
Constant value:
Constant value:
| |
schema_name | string | The name of the schema resource that should be used for the wrapper. |