[da][rfc] Allow AutomationConditionSensorDefinition to target a global condition #26492
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary & Motivation
This replaces the
default_condition
functionality with aglobal_condition
.The previous default_condition behavior applied a given condition to all assets targeted by a given sensor, which meant that each of these assets would still be evaluated independently.
In contrast, the global_condition is evaluated just a single time, and based on the result of that evaluation, either ALL of the selected assets will be launched, or NONE of them will be.
This is a much closer analog to something like a ScheduleDefinition, and is a much closer mental model match to existing concepts.
In order to provide options for conditions that would make sense to be evaluated in such a manner, I added a pair of automation conditions that can be targeted at a provided asset selection. So some example usages:
How I Tested These Changes
Changelog
AutomationCondition.any_assets_match
andAutomationCondition.all_assets_match
, which allow anAutomationCondition
to be targeted at all assets within an asset selection.AutomationConditionSensorDefinition
'sdefault_condition
argument with aglobal_condition
argument. This condition is evaluated a single time, and based on the results, either all assets targeted by the sensor will be requested, or none of them will be.