| 314 | } |
| 315 | |
| 316 | Status RemoteCopyNode::Run() { |
| 317 | if (ctx_->UseSendTensorRPC() && send_device_->IsLocal() && |
| 318 | !recv_device_->IsLocal()) { |
| 319 | return StartRemoteSendTensor(); |
| 320 | } |
| 321 | Status s = StartSend(); |
| 322 | if (!s.ok()) { |
| 323 | Abort(s); |
| 324 | return s; |
| 325 | } |
| 326 | |
| 327 | // StartRecv() takes care of doing the right thing to dst handle. |
| 328 | // No need to poison it after this point. |
| 329 | s = StartRecv(); |
| 330 | if (!s.ok() && errors::IsCancelled(s)) { |
| 331 | Status send_status = captured_state_->GetSendStatus(); |
| 332 | if (!send_status.ok()) { |
| 333 | // In this case, Recv is cancelled because the Send op failed. Return the |
| 334 | // status of the Send op instead. |
| 335 | s = send_status; |
| 336 | } |
| 337 | } |
| 338 | |
| 339 | src_->Unref(); |
| 340 | ctx_->Unref(); |
| 341 | return s; |
| 342 | } |
| 343 | |
| 344 | void RemoteCopyNode::Abort(Status status) { |
| 345 | captured_state_->dst()->Poison(status); |
no test coverage detected