Skip to content

Commit

Permalink
fix race condition for deleting state (#25618)
Browse files Browse the repository at this point in the history
## Summary & Motivation
In case the scheduler daemon has a stale version of the workspace when
the schedule is turned on, we do not want to delete.

## How I Tested These Changes
BK (internal)
  • Loading branch information
prha authored Oct 29, 2024
1 parent 1a7d3f6 commit d4d5d82
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions python_modules/dagster/dagster/_scheduler/scheduler.py
Original file line number Diff line number Diff line change
Expand Up @@ -343,9 +343,9 @@ def launch_scheduled_runs(

# Remove all-stopped states declared in code immediately.
# Also remove all other states that are not present in the workspace after a 12-hour grace period.
if (
state.status == InstigatorStatus.DECLARED_IN_CODE
or _last_iteration_time + RETAIN_ORPHANED_STATE_INTERVAL_SECONDS
if state.status == InstigatorStatus.DECLARED_IN_CODE or (
_last_iteration_time
and _last_iteration_time + RETAIN_ORPHANED_STATE_INTERVAL_SECONDS
< end_datetime_utc.timestamp()
):
logger.info(
Expand Down

0 comments on commit d4d5d82

Please sign in to comment.