fix: preserve batch receipts and resource recovery after review
Core regression / Python core, intervention UI and release configuration (push) Successful in 18m39s
Core regression / JavaScript syntax (push) Successful in 7s
Core regression / Python core, intervention UI and release configuration (pull_request) Successful in 11m51s
Core regression / JavaScript syntax (pull_request) Successful in 7s
Core regression / Python core, intervention UI and release configuration (push) Successful in 18m39s
Core regression / JavaScript syntax (push) Successful in 7s
Core regression / Python core, intervention UI and release configuration (pull_request) Successful in 11m51s
Core regression / JavaScript syntax (pull_request) Successful in 7s
This commit is contained in:
1 parent
e63a82b695
commit
4a438e027b
25 files changed
+748
-138
No files matched your search
@@ -57,6 +57,36 @@ def test_cache_only_batch_does_not_create_desktop_or_cad(tmp_path):
|
||||
assert not Desktop.created
|
||||
|
||||
|
||||
@pytest.mark.parametrize('failure', ['factory', 'first_write'])
|
||||
def test_desktop_startup_before_acquisition_does_not_block_later_batches(tmp_path, monkeypatch, failure):
|
||||
from dx_productivity.trial_task_center import batch_runtime
|
||||
|
||||
def fail_startup(*args, **options):
|
||||
raise OSError('desktop startup unavailable')
|
||||
|
||||
runtime = batch_runtime.BatchCadRuntime(
|
||||
tmp_path, 'execution', desktop_factory=fail_startup if failure == 'factory' else Desktop)
|
||||
if failure == 'first_write':
|
||||
write_record = batch_runtime.write_record
|
||||
|
||||
def fail_first_write(path, record):
|
||||
if record['state'] == 'starting':
|
||||
fail_startup()
|
||||
write_record(path, record)
|
||||
|
||||
monkeypatch.setattr(batch_runtime, 'write_record', fail_first_write)
|
||||
|
||||
with pytest.raises(OSError, match='desktop startup unavailable'):
|
||||
with runtime:
|
||||
with runtime.native_scope(tmp_path / 'startup'):
|
||||
pytest.fail('startup must fail before the desktop is acquired')
|
||||
|
||||
assert not Desktop.created
|
||||
assert batch_runtime.pending_resources(tmp_path) == ()
|
||||
with batch_runtime.BatchCadRuntime(tmp_path, 'execution', desktop_factory=Desktop):
|
||||
pass
|
||||
|
||||
|
||||
def test_batch_forwards_business_failure_to_owned_cad_close(tmp_path):
|
||||
from dx_productivity.trial_task_center.batch_runtime import BatchCadRuntime
|
||||
runtime = BatchCadRuntime(tmp_path, 'execution', desktop_factory=Desktop)
|
||||
@@ -182,6 +212,28 @@ def command_for(tmp_path, name='one'):
|
||||
return ('cscript', '//nologo', 'worker.vbs', str(root), 'python', 'job'), project
|
||||
|
||||
|
||||
def test_unlaunched_worker_retry_leaves_no_ownership_record(tmp_path, monkeypatch):
|
||||
from dx_productivity.trial_task_center import batch_runtime, worker_monitor
|
||||
|
||||
def fail_startup(*args, **options):
|
||||
raise OSError('desktop factory unavailable')
|
||||
|
||||
def unexpected_worker(*args, **options):
|
||||
pytest.fail('no worker may launch after the desktop factory fails')
|
||||
|
||||
monkeypatch.setattr(worker_monitor, 'run_monitored_process', unexpected_worker)
|
||||
command, _ = command_for(tmp_path)
|
||||
runtime = batch_runtime.BatchCadRuntime(tmp_path / 'data', 'execution', desktop_factory=fail_startup)
|
||||
with pytest.raises(OSError, match='desktop factory unavailable'):
|
||||
with runtime:
|
||||
runtime.run_worker(command, 5)
|
||||
|
||||
assert runtime.record['retries']
|
||||
assert batch_runtime.pending_resources(runtime.root) == ()
|
||||
with batch_runtime.BatchCadRuntime(runtime.root, 'execution', desktop_factory=Desktop):
|
||||
pass
|
||||
|
||||
|
||||
def worker_runtime(tmp_path, monkeypatch, monitor):
|
||||
from dx_productivity.trial_task_center.batch_runtime import BatchCadRuntime
|
||||
from dx_productivity.trial_task_center import worker_monitor
|
||||
|
||||
Reference in new issue
Block a user