| 19 | namespace eager { |
| 20 | |
| 21 | Status RemoteExecuteNode::Run() { |
| 22 | EnqueueResponse* response = new EnqueueResponse; |
| 23 | |
| 24 | const gtl::InlinedVector<TensorHandle*, 4>& inputs = inputs_; |
| 25 | const gtl::InlinedVector<TensorHandle*, 2>& retvals = retvals_; |
| 26 | Device* device = device_; |
| 27 | |
| 28 | // Filled and used only when VLOG(3) is on. |
| 29 | string rpc_description; |
| 30 | if (VLOG_IS_ON(3)) { |
| 31 | std::vector<string> ops; |
| 32 | ops.reserve(request_->queue_size()); |
| 33 | for (const QueueItem& item : request_->queue()) { |
| 34 | if (item.has_operation()) { |
| 35 | ops.push_back(item.operation().name()); |
| 36 | } else { |
| 37 | ops.push_back(absl::StrCat("DeleteHandle(", |
| 38 | item.handle_to_decref().op_id(), ":", |
| 39 | item.handle_to_decref().output_num(), ")")); |
| 40 | } |
| 41 | } |
| 42 | rpc_description = |
| 43 | absl::StrCat("RemoteOperation(", absl::StrJoin(ops, ", "), ")"); |
| 44 | } |
| 45 | VLOG(3) << "Issuing: " << rpc_description; |
| 46 | |
| 47 | return eager_client_->StreamingEnqueueAsync( |
| 48 | request_.get(), response, |
| 49 | [inputs, retvals, response, device, |
| 50 | rpc_description](const Status& status) { |
| 51 | for (auto handle : inputs) { |
| 52 | handle->Unref(); |
| 53 | } |
| 54 | if (status.ok()) { |
| 55 | VLOG(3) << "Completed successfully: " << rpc_description; |
| 56 | } else { |
| 57 | VLOG(3) << "Failed: " << rpc_description << " with status " |
| 58 | << status.ToString(); |
| 59 | } |
| 60 | for (size_t i = 0; i < retvals.size(); ++i) { |
| 61 | if (status.ok()) { |
| 62 | Status s = retvals[i]->SetRemoteShape( |
| 63 | response->queue_response(0).shape(i), device); |
| 64 | if (!s.ok()) { |
| 65 | LOG(ERROR) << "Ignoring an error encountered when setting " |
| 66 | "remote shape of tensor handle: " |
| 67 | << retvals[i] << " with status: " << status.ToString() |
| 68 | << "\nThis should never happen. " |
| 69 | "Please file an issue with the TensorFlow Team."; |
| 70 | } |
| 71 | } else { |
| 72 | retvals[i]->Poison(status); |
| 73 | } |
| 74 | retvals[i]->Unref(); |
| 75 | } |
| 76 | delete response; |
| 77 | }); |
| 78 | } |
nothing calls this directly
no test coverage detected