| 20 | namespace tensorflow { |
| 21 | |
| 22 | bool PartialRunMgr::FindOrCreate(int step_id, |
| 23 | CancellationManager** cancellation_manager) { |
| 24 | mutex_lock l(mu_); |
| 25 | auto it = step_id_to_partial_run_.find(step_id); |
| 26 | if (it != step_id_to_partial_run_.end()) { |
| 27 | *cancellation_manager = it->second->cancellation_manager.get(); |
| 28 | return false; |
| 29 | } |
| 30 | |
| 31 | std::unique_ptr<PartialRunState> partial_run = |
| 32 | tensorflow::MakeUnique<PartialRunState>(); |
| 33 | partial_run->cancellation_manager = |
| 34 | tensorflow::MakeUnique<CancellationManager>(); |
| 35 | *cancellation_manager = partial_run->cancellation_manager.get(); |
| 36 | step_id_to_partial_run_[step_id] = std::move(partial_run); |
| 37 | return true; |
| 38 | } |
| 39 | |
| 40 | void PartialRunMgr::ExecutorDone(int step_id, const Status& executor_status) { |
| 41 | StatusCallback done; |