feat: control and recover independent verification attempts
This commit is contained in:
1 parent
e6e9b6906d
commit
b9712ed651
7 files changed
+239
-1
No files matched your search
@@ -0,0 +1,8 @@
|
||||
def test_close_and_controls_do_not_block_new_task_creation(ui,qtbot):
|
||||
page=ui.window.verification_panel
|
||||
task=ui.service.verification.create_task('任务',request_id='control')['task_id']
|
||||
page.open_task(task)
|
||||
qtbot.waitUntil(lambda:not page.controller.task_query.busy)
|
||||
assert page.start_button.isEnabled() and page.new_button.isEnabled()
|
||||
page.begin_shutdown()
|
||||
assert page.new_button.isEnabled()
|
||||
@@ -0,0 +1,59 @@
|
||||
import time
|
||||
from threading import Event
|
||||
from test_independent_verification_intake import service
|
||||
from test_independent_verification_runner import imported
|
||||
from test_native_cli_netlist import graph
|
||||
|
||||
|
||||
def wait_idle(service):
|
||||
deadline=time.monotonic()+5
|
||||
while service.busy and time.monotonic()<deadline:time.sleep(.01)
|
||||
assert not service.busy
|
||||
|
||||
|
||||
def test_start_idempotency_and_frozen_members_do_not_swallow_new_version(service,tmp_path,monkeypatch):
|
||||
from dx_productivity.trial_task_center import netlist_verification
|
||||
entered=Event();release=Event();calls=[]
|
||||
def export(capture,output,*,stop_event):
|
||||
calls.append(str(output));entered.set();release.wait(3);output.mkdir(parents=True,exist_ok=True)
|
||||
return {'status':'success','complete':True,'graph':graph(output),'outputs':{}}
|
||||
monkeypatch.setattr(netlist_verification,'_export_saved_capture',export)
|
||||
task,item=imported(service,tmp_path)
|
||||
first=service.start(task,selection=None,request_id='run')
|
||||
assert entered.wait(2)
|
||||
assert service.start(task,selection=None,request_id='run')==first
|
||||
payload=service.repo.revision(item,1)['payload']
|
||||
newer={k:v for k,v in payload.items() if k not in {'input_state','payload_digest'}};newer['input_version']=2
|
||||
service.publish_inputs(task,(newer,),submission_id='new')
|
||||
release.set();wait_idle(service)
|
||||
assert len(calls)==2 and service.read_item(item)['status']=='waiting'
|
||||
assert service.read_item(item,version=1)['status']=='consistent'
|
||||
|
||||
|
||||
def test_stop_during_export_is_cancelled_and_rerun_is_new_generation(service,tmp_path,monkeypatch):
|
||||
from dx_productivity.trial_task_center import netlist_verification
|
||||
entered=Event()
|
||||
def slow(capture,output,*,stop_event):
|
||||
entered.set();stop_event.wait(3)
|
||||
return {'status':'cancelled','complete':False,'reason':'stopped'}
|
||||
monkeypatch.setattr(netlist_verification,'_export_saved_capture',slow)
|
||||
task,item=imported(service,tmp_path)
|
||||
run=service.start(task,selection=None,request_id='start');assert entered.wait(2)
|
||||
service.stop(run['run_id'],request_id='stop');wait_idle(service)
|
||||
assert service.read_item(item)['status']=='stopped'
|
||||
def normal(capture,output,*,stop_event):
|
||||
output.mkdir(parents=True,exist_ok=True)
|
||||
return {'status':'success','complete':True,'graph':graph(output),'outputs':{}}
|
||||
monkeypatch.setattr(netlist_verification,'_export_saved_capture',normal)
|
||||
service.rerun(item,1,request_id='again');wait_idle(service)
|
||||
assert service.read_item(item)['attempt']['generation']==2
|
||||
|
||||
|
||||
def test_recovery_never_automatically_runs_and_unknown_owner_blocks(service,tmp_path):
|
||||
task,item=imported(service,tmp_path)
|
||||
attempt=service.repo.create_attempt(item,1,request_id='lost')
|
||||
service.repo.claim(attempt['attempt_id'],owner_id='lost-owner')
|
||||
result=service.recover()
|
||||
assert result['blocked']==1 and not service.busy
|
||||
assert service.repo.attempt(attempt['attempt_id'])['state']=='stopping'
|
||||
assert service.read_item(item)['verdict'] is None
|
||||
Reference in new issue
Block a user