fix: persist active task before worker launch
This commit is contained in:
1 parent
5ed8444d5d
commit
e5e628de4a
8 files changed
+90
-9
No files matched your search
@@ -183,6 +183,28 @@ def test_completed_project_does_not_hold_resolution_wait_for_next_project_failur
|
||||
assert not (Path(command[3]) / 'quick-run' / 'uncertain.flag').exists()
|
||||
|
||||
|
||||
def test_current_task_and_attempt_are_durable_before_worker_launch(tmp_path, monkeypatch):
|
||||
import subprocess
|
||||
one, _ = command_for(tmp_path)
|
||||
two, _ = command_for(tmp_path, 'next')
|
||||
next_root = Path(two[3])
|
||||
command_path = next_root / 'command.tsv'
|
||||
command_path.write_text(command_path.read_text().replace('task\tjob\t', 'task2\tjob2\t'), encoding='utf-8')
|
||||
calls = []
|
||||
def monitor(command, *args, **kwargs):
|
||||
calls.append(command)
|
||||
record = json.loads(runtime.path.read_text(encoding='utf-8'))
|
||||
expected_task = 'task' if len(calls) == 1 else 'task2'
|
||||
assert record.get('active_task') == expected_task
|
||||
assert record.get('active_attempt')
|
||||
return subprocess.CompletedProcess(command, 0, '', '')
|
||||
runtime = worker_runtime(tmp_path, monkeypatch, monitor)
|
||||
two = (*two[:-1], 'job2')
|
||||
with runtime:
|
||||
runtime.run_worker(one, 5)
|
||||
runtime.run_worker(two, 5)
|
||||
|
||||
|
||||
@pytest.mark.parametrize('second_fails', [False, True])
|
||||
def test_prewrite_failure_releases_old_desktop_and_retries_only_once(tmp_path, monkeypatch, second_fails):
|
||||
import subprocess
|
||||
|
||||
Reference in new issue
Block a user