Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[da][rfc] Allow AutomationConditionSensorDefinition to target a global condition #26492

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

OwenKephart
Copy link
Contributor

Summary & Motivation

This replaces the default_condition functionality with a global_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:

  • AutomationCondition.all_assets_match(selection.roots(), AutomationCondition.on_cron(xyz)): triggers when all root assets in a given selection's parents have been materialized since a given cron tick
  • AutomationCondition.any_assets_match(selection.roots(), AutomationCondition.eager()): triggers whenever any upstream assets from this job kick off

How I Tested These Changes

Changelog

  • Added AutomationCondition.any_assets_match and AutomationCondition.all_assets_match, which allow an AutomationCondition to be targeted at all assets within an asset selection.
  • Replaced the experimental AutomationConditionSensorDefinition's default_condition argument with a global_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.

Copy link
Contributor Author

This stack of pull requests is managed by Graphite. Learn more about stacking.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant