Task statistics returned only after the first tasks complete
Fixes
@@ -562,8 +562,8 @@ class QueueManager:
na_format = ''
float_format = ',.2f'
if self.statistics.total_completed_tasks == 0:
- success_rate = "(N/A yet)"
- success_format = na_format
+ task_stats_str = "Task statistics unavailable until first tasks return"
+ worker_stats_str = None
else:
success_rate = self.statistics.total_successful_tasks / self.statistics.total_completed_tasks * 100
success_format = float_format
@@ -575,15 +575,19 @@ class QueueManager:
# Handle efficiency calculations
if log_efficiency:
# Efficiency calculated as:
- # sum_task(task_wall_time * nthread / task) / sum_time(number_running_worker * nthread / worker * interval)
+ # sum_task(task_wall_time * nthread / task)
+ # -------------------------------------------------------------
+ # sum_time(number_running_worker * nthread / worker * interval)
if self.statistics.total_core_hours_consumed == 0 or self.statistics.total_core_hours_possible == 0:
efficiency_of_running = "(N/A yet)"
efficiency_of_potential = "(N/A yet)"
efficiency_format = na_format
else:
- efficiency_of_running = (self.statistics.total_core_hours / self.statistics.total_core_hours_consumed
+ efficiency_of_running = (self.statistics.total_core_hours /
+ self.statistics.total_core_hours_consumed
* 100)
- efficiency_of_potential = (self.statistics.total_core_hours / self.statistics.total_core_hours_possible
+ efficiency_of_potential = (self.statistics.total_core_hours /
+ self.statistics.total_core_hours_possible
* 100)
efficiency_format = float_format
worker_stats_str += f", Core Usage Efficiency: {efficiency_of_running:{efficiency_format}}%"
@@ -592,6 +596,7 @@ class QueueManager:
f"{efficiency_of_potential:{efficiency_format}}%")
self.logger.info(task_stats_str)
+ if worker_stats_str is not None:
self.logger.info(worker_stats_str)
try:
