| 1683 | } |
| 1684 | |
| 1685 | Status MasterSession::Extend(const ExtendSessionRequest* req, |
| 1686 | ExtendSessionResponse* resp) { |
| 1687 | UpdateLastAccessTime(); |
| 1688 | std::unique_ptr<GraphExecutionState> extended_execution_state; |
| 1689 | { |
| 1690 | mutex_lock l(mu_); |
| 1691 | if (closed_) { |
| 1692 | return errors::FailedPrecondition("Session is closed."); |
| 1693 | } |
| 1694 | |
| 1695 | if (graph_version_ != req->current_graph_version()) { |
| 1696 | return errors::Aborted("Current version is ", graph_version_, |
| 1697 | " but caller expected ", |
| 1698 | req->current_graph_version(), "."); |
| 1699 | } |
| 1700 | |
| 1701 | CHECK(execution_state_); |
| 1702 | TF_RETURN_IF_ERROR( |
| 1703 | execution_state_->Extend(req->graph_def(), &extended_execution_state)); |
| 1704 | |
| 1705 | CHECK(extended_execution_state); |
| 1706 | // The old execution state will be released outside the lock. |
| 1707 | execution_state_.swap(extended_execution_state); |
| 1708 | ++graph_version_; |
| 1709 | resp->set_new_graph_version(graph_version_); |
| 1710 | } |
| 1711 | return Status::OK(); |
| 1712 | } |
| 1713 | |
| 1714 | WorkerCacheInterface* MasterSession::get_worker_cache() const { |
| 1715 | if (worker_cache_) { |
no test coverage detected