| 1080 | } |
| 1081 | |
| 1082 | std::string Driver::toString() const { |
| 1083 | std::stringstream out; |
| 1084 | out << "{Driver." << driverCtx()->pipelineId << "." << driverCtx()->driverId |
| 1085 | << ": "; |
| 1086 | if (state_.isTerminated) { |
| 1087 | out << "terminated, "; |
| 1088 | } |
| 1089 | if (state_.hasBlockingFuture) { |
| 1090 | std::string blockedOp = (blockedOperatorId_ < operators_.size()) |
| 1091 | ? operators_[blockedOperatorId_]->toString() |
| 1092 | : "<unknown op>"; |
| 1093 | out << "blocked (" << blockingReasonToString(blockingReason_) << " " |
| 1094 | << blockedOp << "), "; |
| 1095 | } else if (state_.isEnqueued) { |
| 1096 | out << "enqueued "; |
| 1097 | } else if (state_.isOnThread()) { |
| 1098 | out << "running "; |
| 1099 | } else { |
| 1100 | out << "unknown state"; |
| 1101 | } |
| 1102 | |
| 1103 | out << "{Operators: "; |
| 1104 | std::vector<std::string> opStrs; |
| 1105 | opStrs.reserve(operators_.size()); |
| 1106 | std::ranges::transform( |
| 1107 | operators_, std::back_inserter(opStrs), [](const auto& op) { |
| 1108 | return op->toString(); |
| 1109 | }); |
| 1110 | out << folly::join(", ", opStrs); |
| 1111 | out << "}"; |
| 1112 | const auto ocs = opCallStatus(); |
| 1113 | if (!ocs.empty()) { |
| 1114 | out << "{OpCallStatus: executing " |
| 1115 | << ocs.formatCall(findOperatorNoThrow(ocs.opId), ocs.method) << " for " |
| 1116 | << ocs.callDuration() << "ms}"; |
| 1117 | } |
| 1118 | out << "}"; |
| 1119 | return out.str(); |
| 1120 | } |
| 1121 | |
| 1122 | folly::dynamic Driver::toJson() const { |
| 1123 | folly::dynamic obj = folly::dynamic::object; |
no test coverage detected