@@ -112,7 +112,7 @@ def __init__(
112112 self .__dag : t .Optional [DAG [str ]] = None
113113
114114 self ._start = start
115- if not self ._start and is_dev and ( forward_only or self . _has_paused_forward_only ()) :
115+ if not self ._start and is_dev and forward_only :
116116 self ._start = default_start or yesterday_ds ()
117117
118118 self ._end = end if end or not is_dev else (default_end or now ())
@@ -167,11 +167,8 @@ def start(self) -> TimeLike:
167167 @start .setter
168168 def start (self , new_start : TimeLike ) -> None :
169169 self ._ensure_valid_date_range (new_start , self ._end )
170- self .set_start (new_start )
171- self .override_start = True
172-
173- def set_start (self , new_start : TimeLike ) -> None :
174170 self ._start = new_start
171+ self .override_start = True
175172 self .__missing_intervals = None
176173 self ._refresh_dag_and_ignored_snapshots ()
177174
@@ -371,6 +368,7 @@ def set_choice(self, snapshot: Snapshot, choice: SnapshotChangeCategory) -> None
371368 # Invalidate caches.
372369 self ._categorized = None
373370 self ._uncategorized = None
371+ self .__missing_intervals = None
374372
375373 @property
376374 def effective_from (self ) -> t .Optional [TimeLike ]:
@@ -393,6 +391,9 @@ def effective_from(self, effective_from: t.Optional[TimeLike]) -> None:
393391 effective_from: The effective date to set.
394392 """
395393 self ._set_effective_from (effective_from )
394+ if effective_from and self .is_dev and not self .override_start :
395+ self ._start = effective_from
396+ self ._refresh_dag_and_ignored_snapshots ()
396397
397398 def _set_effective_from (self , effective_from : t .Optional [TimeLike ]) -> None :
398399 if not self .forward_only :
@@ -410,32 +411,30 @@ def _set_effective_from(self, effective_from: t.Optional[TimeLike]) -> None:
410411 @property
411412 def _missing_intervals (self ) -> t .Dict [t .Tuple [str , str ], Intervals ]:
412413 if self .__missing_intervals is None :
413- # we need previous snapshots because this method is cached and users have the option
414- # to choose non-breaking / forward only. this will change the version of the snapshot on the fly
415- # thus changing the missing intervals. additionally we replace any snapshots with the old copies
416- # because they have intervals and the ephemeral ones don't
417- snapshots = {
418- (snapshot .name , snapshot .version_get_or_generate ()): snapshot
419- for snapshot in self .snapshots
414+ old_snapshots = {
415+ (old .name , old .version_get_or_generate ()): old
416+ for _ , old in self .context_diff .modified_snapshots .values ()
420417 }
421418
422- for new , old in self .context_diff .modified_snapshots .values ():
423- # Never override forward-only snapshots to preserve the effect
424- # of the effective_from setting. Instead re-merge the intervals.
425- if not new .is_forward_only :
426- snapshots [(old .name , old .version_get_or_generate ())] = old
427- else :
428- new .intervals = []
429- new .merge_intervals (old )
419+ for new in self .context_diff .new_snapshots .values ():
420+ new .intervals = []
421+ new .dev_intervals = []
422+ old = old_snapshots .get ((new .name , new .version_get_or_generate ()))
423+ if not old :
424+ continue
425+ new .merge_intervals (old )
426+ if new .is_forward_only :
427+ new .dev_intervals = new .intervals .copy ()
430428
431429 self .__missing_intervals = {
432430 (snapshot .name , snapshot .version_get_or_generate ()): missing
433431 for snapshot , missing in missing_intervals (
434- snapshots . values () ,
432+ self . snapshots ,
435433 start = self ._start ,
436434 end = self ._end ,
437435 execution_time = self ._execution_time ,
438436 restatements = self .restatements ,
437+ is_dev = self .is_dev ,
439438 ignore_cron = True ,
440439 ).items ()
441440 }
@@ -728,12 +727,6 @@ def _build_snapshots_and_dag(
728727 ignored_snapshot_names ,
729728 )
730729
731- def _has_paused_forward_only (self ) -> bool :
732- for name , snapshot in self ._snapshot_mapping .items ():
733- if snapshot .is_paused_forward_only or self ._is_forward_only_model (name ):
734- return True
735- return False
736-
737730 def _is_forward_only_model (self , model_name : str ) -> bool :
738731 def _is_forward_only_expected (snapshot : Snapshot ) -> bool :
739732 # Returns True if the snapshot is not categorized yet but is expected
0 commit comments