Skip to content
Snippets Groups Projects
Commit 71e2c40f authored by Jörn Künsemöller's avatar Jörn Künsemöller Committed by Reinder Kraaij
Browse files

TMSS-2903: add additonal percentages to failure report

parent 5042a63f
No related branches found
No related tags found
1 merge request!1293TMSS-2903: add additonal percentages to failure report
...@@ -673,7 +673,6 @@ class FailureReport(): ...@@ -673,7 +673,6 @@ class FailureReport():
.annotate(count=Count(f'{field_name}__value'), .annotate(count=Count(f'{field_name}__value'),
duration_lost_event=Sum(Coalesce(F('stop'), datetime.utcnow()) - F('start')))) duration_lost_event=Sum(Coalesce(F('stop'), datetime.utcnow()) - F('start'))))
for d in group_aggregates: for d in group_aggregates:
# determine total duration of affected scheduling units # determine total duration of affected scheduling units
system_events = self.system_events.filter(**{f'{field_name}__value': d[f'{field_name}__value']}) system_events = self.system_events.filter(**{f'{field_name}__value': d[f'{field_name}__value']})
...@@ -687,7 +686,17 @@ class FailureReport(): ...@@ -687,7 +686,17 @@ class FailureReport():
'percent_of_wall_time_lost_event': 100 * d['duration_lost_event'].total_seconds() / wall_time, 'percent_of_wall_time_lost_event': 100 * d['duration_lost_event'].total_seconds() / wall_time,
'percent_of_wall_time_lost_on_sky': total_on_sky_duration_lost.total_seconds() / wall_time if total_on_sky_duration_lost else 0}) 'percent_of_wall_time_lost_on_sky': total_on_sky_duration_lost.total_seconds() / wall_time if total_on_sky_duration_lost else 0})
total_failure_event_time = sum([d['duration_lost_event'] for d in group_aggregates])
total_failure_on_sky_time = sum([d['duration_lost_on_sky'] for d in group_aggregates])
total_failure_count = sum(d['count'] for d in group_aggregates)
for d in group_aggregates:
d.update({'percent_of_total_failure_time_lost_event': 100 * d['duration_lost_event'] / total_failure_event_time if total_failure_event_time else 0,
'percent_of_total_failure_time_lost_on_sky': 100 * d['duration_lost_on_sky'] / total_failure_on_sky_time if total_failure_on_sky_time else 0,
'percent_of_total_failure_count': 100 * d['count'] / total_failure_count if total_failure_count else 0})
aggregates[f'by_{field_name}'] = group_aggregates aggregates[f'by_{field_name}'] = group_aggregates
return aggregates return aggregates
def _get_lost_observing_time_histogram(self, ignore_time_range=True) -> {}: def _get_lost_observing_time_histogram(self, ignore_time_range=True) -> {}:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment