Skip to content

Commit 40f190c

Browse files
authored
Merge branch 'main' into feat/concurrency-context
2 parents 4946583 + f180e03 commit 40f190c

1 file changed

Lines changed: 9 additions & 10 deletions

File tree

‎tests/core/integration/test_restatement.py‎

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1854,7 +1854,6 @@ def _run_restatement_plan(tmp_path: Path, config: Config, q: queue.Queue):
18541854
# ensure dev is present before the restatement plan starts
18551855
assert restatement_ctx.state_sync.get_environment("dev") is not None
18561856

1857-
q.put("plan_started")
18581857
expected_error = None
18591858
try:
18601859
restatement_ctx.plan(
@@ -1875,15 +1874,15 @@ def _run_restatement_plan(tmp_path: Path, config: Config, q: queue.Queue):
18751874

18761875
assert q.get() == "thread_started"
18771876

1878-
try:
1879-
if e := restatement_plan_future.exception(timeout=1):
1880-
# abort early if the plan thread threw an exception
1881-
raise e
1882-
except TimeoutError:
1883-
# that's ok, we dont actually expect the plan to have finished in 1 second
1884-
pass
1885-
1886-
assert q.get() == "plan_started"
1877+
# wait until the original model is blocked inside the restatement's evaluation
1878+
deadline = time.monotonic() + 30
1879+
while not evaluation_lock_file_path.exists():
1880+
if restatement_plan_future.done():
1881+
if e := restatement_plan_future.exception():
1882+
raise e
1883+
raise AssertionError("Restatement plan finished before it blocked on the model")
1884+
assert time.monotonic() < deadline, "Restatement plan never entered the evaluation lock"
1885+
time.sleep(0.1)
18871886

18881887
# ok, now the prod restatement plan is running, let's deploy dev to prod
18891888
ctx.plan(environment="prod", auto_apply=True)

0 commit comments

Comments
 (0)