| 203 | } |
| 204 | |
| 205 | void XrtTfContext::ReportError(absl::Span<const OperationId> op_ids, |
| 206 | Status status) { |
| 207 | auto shared_error = std::make_shared<Status>(status); |
| 208 | absl::flat_hash_set<OperationId> visited(op_ids.begin(), op_ids.end()); |
| 209 | std::stack<Operation*> stack; |
| 210 | for (OperationId op_id : op_ids) { |
| 211 | stack.push(LookupOperation(op_id)); |
| 212 | } |
| 213 | while (!stack.empty()) { |
| 214 | Operation* op = stack.top(); |
| 215 | stack.pop(); |
| 216 | VLOG(10) << "Reporting error for " << op->id; |
| 217 | for (const std::shared_ptr<XrtRecvTensorFuture>& future : |
| 218 | op->tensor_futures) { |
| 219 | VLOG(10) << "Reporting error for " << op->id << " future"; |
| 220 | future->call_options_.StartCancel(); |
| 221 | future->Notify(status); |
| 222 | } |
| 223 | for (OperationId consumer_id : op->consumers) { |
| 224 | Operation* consumer = LookupOperation(consumer_id); |
| 225 | stack.push(consumer); |
| 226 | } |
| 227 | DeleteOperation(op->id); |
| 228 | } |
| 229 | } |
| 230 | |
| 231 | XrtTfContext::Operation* XrtTfContext::AddOperation() { |
| 232 | OperationId id = ++next_op_id_; |
no test coverage detected