A conditional block is an ‘Add-on Block’ associated with another block. The condition will be evaluated before the parent block is executed, determining if the parent block gets executed.
0.8.93
or greater.condition_failed
.
morpheus
block returns a variable— pill
, which is either red or blue. Both downstream blocks have conditionals associated with them. The red_pill
block will only execute if pill
is red, and the blue_pill
block will only execute if pill
is blue.
Here’s what the conditionals look like for each:
pill=red
, the red_pill
block will execute, and the blue_pill
block will not. Additionally, any downstream blocks of the blue_pill
block will not execute.
@condition
.Name | Description | Sample value |
---|---|---|
block_uuid | Conditional block UUID. | 'fireball_conditional' |
ds | Date string when the parent block started executing. | '2023-12-25' |
event | A dictionary containing metadata from an event triggered pipeline. | {} |
execution_date | Python datetime object for when the trigger run started executing. | datetime.datetime(2023, 4, 26, 20, 28, 17, 335254, tzinfo=datetime.timezone.utc) |
execution_partition | Partition used for the trigger run when it was executed. | '207/20230426T202817' |
hr | Hour string when the trigger run started executing. | '20' |
pipeline_run | Python pipeline run object associated to the current run. | PipelineRun(id=2357, pipeline_uuid=fire_etl, execution_date=2023-04-26 20:28:17.335254+00:00) |
pipeline_uuid | UUID of the current pipeline. | 'fire_etl' |