Back to home page

EIC code displayed by LXR

 
 

    


Warning, file /swf-monitor/src/monitor_app/tests/test_reproductions.py was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).

0001 """Reproduction attempts: a request the agent did not run reads as
0002 withdrawn, never as queued (monitor_app/reproductions.py). Pure rows,
0003 no store."""
0004 from types import SimpleNamespace
0005 
0006 from django.utils import timezone
0007 
0008 from monitor_app.reproductions import _attempt, withdrawn_phase
0009 
0010 
0011 SIG = SimpleNamespace(key='exit139:task39951', level='record', data={},
0012                       trace={}, exit_code=139)
0013 
0014 
0015 def _entry(**over):
0016     e = {'request_id': 'fe2c58a2c862', 'run_id': None, 'pandaid': 2726603,
0017          'queue': 'UM_GREX_PanDA_1', 'role': 'elsewhere', 'requested_at':
0018          '2026-09-15T06:49:15+00:00', 'requested_by': 'swf-2',
0019          'outcome': 'submitted', 'jedi_task_id': None, 'canary_pandaid': None}
0020     e.update(over)
0021     return e
0022 
0023 
0024 def test_request_in_the_agents_hands_reads_queued():
0025     row = _attempt(SIG, _entry(), None, timezone.now())
0026     assert (row['phase'], row['result'], row['active']) == ('queued_submission', 'pending', True)
0027     assert withdrawn_phase(_entry()) is None
0028 
0029 
0030 def test_dropped_duplicate_reads_cancelled_and_ended():
0031     e = _entry(outcome='cancelled', withdrawn='duplicate',
0032                reason='duplicate: the same row on this queue was already in flight')
0033     row = _attempt(SIG, e, None, timezone.now())
0034     assert (row['phase'], row['result'], row['active']) == ('cancelled', 'cancelled', False)
0035     assert row['reason'].startswith('duplicate:')
0036     assert row['request_mirror'] == 'cancelled'
0037 
0038 
0039 def test_failed_dispatch_reads_failed_submission():
0040     e = _entry(outcome='cancelled', withdrawn='dispatch_failed',
0041                reason='submission failed: payload-canary rc=2: no such queue')
0042     row = _attempt(SIG, e, None, timezone.now())
0043     assert (row['phase'], row['result'], row['active']) == ('submission_failed', 'inconclusive', False)
0044     assert row['reason'].startswith('submission failed:')
0045 
0046 
0047 def test_an_ended_outcome_without_the_withdrawn_mark_is_left_to_the_run():
0048     # The reconcile writes an ended outcome only from a run; the row's
0049     # phase then comes from the run, not from the entry.
0050     assert withdrawn_phase(_entry(outcome='completed')) is None