| 1554 | } |
| 1555 | |
| 1556 | static application_attempt_decision_t application_consume_attempt( |
| 1557 | cbm_daemon_application_job_t *job, application_attempt_t *attempt, |
| 1558 | application_job_execution_t *execution, cbm_proc_outcome_t *failure_outcome) { |
| 1559 | cbm_mcp_supervised_result_disposition_t disposition = |
| 1560 | application_attempt_disposition(job, attempt); |
| 1561 | application_record_attempt(attempt, &execution->last_result, &execution->have_last_result, |
| 1562 | execution->last_log); |
| 1563 | if (disposition == CBM_MCP_SUPERVISED_RESULT_SUCCESS) { |
| 1564 | execution->response = attempt->result.response; |
| 1565 | attempt->result.response = NULL; |
| 1566 | execution->successful = application_index_response_succeeded(execution->response); |
| 1567 | application_attempt_free(attempt); |
| 1568 | return APPLICATION_ATTEMPT_DECISION_SUCCESS; |
| 1569 | } |
| 1570 | if (disposition == CBM_MCP_SUPERVISED_RESULT_UNSAFE_TERMINAL) { |
| 1571 | execution->unsafe_terminal = true; |
| 1572 | execution->supervision_failed = |
| 1573 | attempt->has_result && !attempt->result.cancellation_requested && |
| 1574 | (attempt->result.supervision_failed || !attempt->result.tree_quiesced); |
| 1575 | application_attempt_free(attempt); |
| 1576 | return APPLICATION_ATTEMPT_DECISION_STOP; |
| 1577 | } |
| 1578 | if (application_result_is_attributable_failure(attempt, disposition)) { |
| 1579 | *failure_outcome = attempt->result.outcome; |
| 1580 | application_attempt_free(attempt); |
| 1581 | return APPLICATION_ATTEMPT_DECISION_RECOVERABLE; |
| 1582 | } |
| 1583 | application_attempt_free(attempt); |
| 1584 | return APPLICATION_ATTEMPT_DECISION_STOP; |
| 1585 | } |
| 1586 | |
| 1587 | static bool application_recovery_record_suspects( |
| 1588 | cbm_daemon_application_job_t *job, const char *marker_path, const char *quarantine_path, |
no test coverage detected