Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement
AutomationCondition.replace()
function (#27109)
## Summary & Motivation Users often want to make small changes to the existing policies. There is an existing utility to remove a sub-condition (`.without(…)`), and you can add a new sub-condition with `&`. However, these utilities aren't always the most ergonomic for certain use cases. This would allow the following types of changes to our examples: [Older time window partitions](https://docs.dagster.io/concepts/automation/declarative-automation/customizing-automation-conditions#update-an-older-time-partition-when-using-automationconditionon_cron) before: ```python condition = five_days_ago_condition & AutomationCondition.eager().without( AutomationCondition.in_latest_time_window(), ) ``` after: ```python AutomationCondition.eager().replace( "in_latest_time_window", five_days_ago_condition ) ``` ## How I Tested These Changes Added unit tests. ## Changelog Implemented `AutomationCondition.replace()` function to improve ergonomics of updating sub-conditions.
- Loading branch information