| 2111 | } |
| 2112 | |
| 2113 | Status MasterSession::PostRunCleanup(MasterSession::ReffedClientGraph* rcg, |
| 2114 | uint64 step_id, |
| 2115 | const RunOptions& run_options, |
| 2116 | PerStepState* pss, |
| 2117 | const std::unique_ptr<ProfileHandler>& ph, |
| 2118 | const Status& run_status, |
| 2119 | RunMetadata* out_run_metadata) { |
| 2120 | Status s = run_status; |
| 2121 | if (s.ok()) { |
| 2122 | pss->end_micros = Env::Default()->NowMicros(); |
| 2123 | if (rcg->collective_graph_key() != |
| 2124 | BuildGraphOptions::kNoCollectiveGraphKey) { |
| 2125 | env_->collective_executor_mgr->RetireStepId(rcg->collective_graph_key(), |
| 2126 | step_id); |
| 2127 | } |
| 2128 | // Schedule post-processing and cleanup to be done asynchronously. |
| 2129 | rcg->ProcessStats(step_id, pss, ph.get(), run_options, out_run_metadata); |
| 2130 | } else if (errors::IsCancelled(s)) { |
| 2131 | mutex_lock l(mu_); |
| 2132 | if (closed_) { |
| 2133 | if (garbage_collected_) { |
| 2134 | s = errors::Cancelled( |
| 2135 | "Step was cancelled because the session was garbage collected due " |
| 2136 | "to inactivity."); |
| 2137 | } else { |
| 2138 | s = errors::Cancelled( |
| 2139 | "Step was cancelled by an explicit call to `Session::Close()`."); |
| 2140 | } |
| 2141 | } |
| 2142 | } |
| 2143 | Ref(); |
| 2144 | rcg->Ref(); |
| 2145 | rcg->CleanupPartitionsAsync(step_id, [this, rcg](const Status& s) { |
| 2146 | if (!s.ok()) { |
| 2147 | LOG(ERROR) << "Cleanup partition error: " << s; |
| 2148 | } |
| 2149 | rcg->Unref(); |
| 2150 | MarkRunCompletion(); |
| 2151 | Unref(); |
| 2152 | }); |
| 2153 | return s; |
| 2154 | } |
| 2155 | |
| 2156 | Status MasterSession::DoRunWithLocalExecution( |
| 2157 | CallOptions* opts, const RunStepRequestWrapper& req, |
nothing calls this directly
no test coverage detected