Skip to content

Commit 7951e1d

Browse files
authored
add improved error messaging in Worker class (#741)
Signed-off-by: Michael Oviedo <[email protected]>
1 parent af60c87 commit 7951e1d

File tree

1 file changed

+25
-5
lines changed

1 file changed

+25
-5
lines changed

osbenchmark/worker_coordinator/worker_coordinator.py

+25-5
Original file line numberDiff line numberDiff line change
@@ -1125,11 +1125,31 @@ def receiveMsg_WakeupMessage(self, msg, sender):
11251125
elif self.executor_future is not None and self.executor_future.done():
11261126
e = self.executor_future.exception(timeout=0)
11271127
if e:
1128-
self.logger.exception("Worker[%s] has detected a benchmark failure. Notifying master...",
1129-
str(self.worker_id), exc_info=e)
1130-
# the exception might be user-defined and not be on the load path of the master worker_coordinator. Hence, it cannot be
1131-
# deserialized on the receiver so we convert it here to a plain string.
1132-
self.send(self.master, actor.BenchmarkFailure("Error in load generator [{}]".format(self.worker_id), str(e)))
1128+
currentTasks = self.client_allocations.tasks(self.current_task_index)
1129+
detailed_error = (
1130+
f"Benchmark operation failed:\n"
1131+
f"Worker ID: {self.worker_id}\n"
1132+
f"Task: {', '.join(t.task.task.name for t in currentTasks)}\n"
1133+
f"Workload: {self.workload.name if self.workload else 'Unknown'}\n"
1134+
f"Test Procedure: {self.workload.selected_test_procedure_or_default}\n"
1135+
f"Cause: {e.cause if hasattr(e, 'cause') and e.cause is not None else 'Unknown'}"
1136+
)
1137+
detailed_error += f"\nError: {str(e)}"
1138+
1139+
self.logger.exception(
1140+
"Worker[%s] has detected a benchmark failure:\n%s",
1141+
str(self.worker_id),
1142+
detailed_error,
1143+
exc_info=e
1144+
)
1145+
1146+
self.send(
1147+
self.master,
1148+
actor.BenchmarkFailure(
1149+
detailed_error,
1150+
str(e)
1151+
)
1152+
)
11331153
else:
11341154
self.logger.info("Worker[%s] is ready for the next task.", str(self.worker_id))
11351155
self.executor_future = None

0 commit comments

Comments
 (0)