| 38 | } |
| 39 | |
| 40 | void PartialRunMgr::ExecutorDone(int step_id, const Status& executor_status) { |
| 41 | StatusCallback done; |
| 42 | Status callback_status; |
| 43 | { |
| 44 | mutex_lock l(mu_); |
| 45 | auto run_it = step_id_to_partial_run_.find(step_id); |
| 46 | if (run_it == step_id_to_partial_run_.end()) { |
| 47 | return; |
| 48 | } |
| 49 | // If we found the partial_run, we call the final callback, if it |
| 50 | // exists. |
| 51 | // It is guaranteed that run_it->second->final_callback is left empty |
| 52 | // after the std::move call. |
| 53 | done = std::move(run_it->second->final_callback); |
| 54 | if (!executor_status.ok()) { |
| 55 | run_it->second->final_status = executor_status; |
| 56 | } |
| 57 | callback_status = run_it->second->final_status; |
| 58 | run_it->second->executor_done = true; |
| 59 | } |
| 60 | if (done != nullptr) { |
| 61 | done(callback_status); |
| 62 | mutex_lock l(mu_); |
| 63 | step_id_to_partial_run_.erase(step_id); |
| 64 | } |
| 65 | } |
| 66 | |
| 67 | void PartialRunMgr::PartialRunDone(int step_id, StatusCallback done, |
| 68 | const Status& status) { |