- Blocks
- Sensor
Blocks
Sensor
A sensor is a block that continuously evaluates a condition until it’s met or until a period of time has elapsed.
If there is a block with a sensor as an upstream dependency, that block won’t start running until the sensor has evaluated its condition successfully.
Read more about sensors in Core abstractions.Example
You can add sensors to a pipeline the same way you add other types of blocks.
from mage_ai.orchestration.run_status_checker import check_status
@sensor
def check_condition(**kwargs) -> bool:
return check_status(
'pipeline_uuid',
kwargs['execution_date'],
block_uuid='block_uuid',
)