| 1219 | } |
| 1220 | |
| 1221 | static application_attempt_decision_t application_consume_attempt( |
| 1222 | cbm_daemon_application_job_t *job, application_attempt_t *attempt, |
| 1223 | application_job_execution_t *execution, cbm_proc_outcome_t *failure_outcome) { |
| 1224 | cbm_mcp_supervised_result_disposition_t disposition = |
| 1225 | application_attempt_disposition(job, attempt); |
| 1226 | application_record_attempt(attempt, &execution->last_result, &execution->have_last_result, |
| 1227 | execution->last_log); |
| 1228 | if (disposition == CBM_MCP_SUPERVISED_RESULT_SUCCESS) { |
| 1229 | execution->response = attempt->result.response; |
| 1230 | attempt->result.response = NULL; |
| 1231 | execution->successful = execution->response != NULL; |
| 1232 | application_attempt_free(attempt); |
| 1233 | return APPLICATION_ATTEMPT_DECISION_SUCCESS; |
| 1234 | } |
| 1235 | if (disposition == CBM_MCP_SUPERVISED_RESULT_UNSAFE_TERMINAL) { |
| 1236 | execution->unsafe_terminal = true; |
| 1237 | execution->supervision_failed = |
| 1238 | attempt->has_result && !attempt->result.cancellation_requested && |
| 1239 | (attempt->result.supervision_failed || !attempt->result.tree_quiesced); |
| 1240 | application_attempt_free(attempt); |
| 1241 | return APPLICATION_ATTEMPT_DECISION_STOP; |
| 1242 | } |
| 1243 | if (application_result_is_attributable_failure(attempt, disposition)) { |
| 1244 | *failure_outcome = attempt->result.outcome; |
| 1245 | application_attempt_free(attempt); |
| 1246 | return APPLICATION_ATTEMPT_DECISION_RECOVERABLE; |
| 1247 | } |
| 1248 | application_attempt_free(attempt); |
| 1249 | return APPLICATION_ATTEMPT_DECISION_STOP; |
| 1250 | } |
| 1251 | |
| 1252 | static bool application_recovery_record_suspects( |
| 1253 | cbm_daemon_application_job_t *job, const char *marker_path, const char *quarantine_path, |
no test coverage detected