From 89b34906c29f763a7214ec5db4a22e58fe92d421 Mon Sep 17 00:00:00 2001 From: Tatiana Korchuganova Date: Mon, 27 May 2024 14:48:27 +0200 Subject: [PATCH 1/2] art | show job metrics for tests for nlastnightlies=1 --- core/art/views.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/core/art/views.py b/core/art/views.py index 3135dcec..3c0b2947 100644 --- a/core/art/views.py +++ b/core/art/views.py @@ -382,7 +382,9 @@ def artJobs(request): request.session['viewParams']['subresults'] = 0 # add PanDA jobs metrics or not - if 'ntag' in request.session['requestParams'] or 'ntag_full' in request.session['requestParams']: + if 'ntag' in request.session['requestParams'] or 'ntag_full' in request.session['requestParams'] or ( + 'nlastnightlies' in request.session['requestParams'] and request.session['requestParams']['nlastnightlies'] == '1' + ): request.session['viewParams']['metrics'] = 1 else: request.session['viewParams']['metrics'] = 0 From 994c689d63654a59a8fd790fd46eb06804295bea Mon Sep 17 00:00:00 2001 From: Tatiana Korchuganova Date: Tue, 28 May 2024 10:42:36 +0200 Subject: [PATCH 2/2] slowtasks | add message if no tasks found --- core/dashboards/taskproblemexplorer.py | 146 +++++++++--------- .../templates/taskProblemExplorer.html | 6 + 2 files changed, 80 insertions(+), 72 deletions(-) diff --git a/core/dashboards/taskproblemexplorer.py b/core/dashboards/taskproblemexplorer.py index b877d1fd..2bfda641 100644 --- a/core/dashboards/taskproblemexplorer.py +++ b/core/dashboards/taskproblemexplorer.py @@ -176,86 +176,88 @@ def taskProblemExplorer(request): # plot queuetime, walltime, etc for task and jobs - error_summary_table = error_codes_analyser.get_errors_table() error_summary_table = json.dumps(error_summary_table, cls=DateEncoder) if not is_json_request(request): - - counts = count_occurrences(tasks, ['owner', ], output='list') - - plots = { - 'time_hist': { - 'name': 'time_hist', - 'type': 'bar_time', - 'title': 'Task submit time', - 'options': { - 'labels': ['Task submission time', 'Count'], - 'timeFormat': '%Y-%m-%d', + if len(tasks) > 0: + counts = count_occurrences(tasks, ['owner', ], output='list') + + plots = { + 'time_hist': { + 'name': 'time_hist', + 'type': 'bar_time', + 'title': 'Task submit time', + 'options': { + 'labels': ['Task submission time', 'Count'], + 'timeFormat': '%Y-%m-%d', + }, + 'data': [['Time'], ['Count']], }, - 'data': [['Time'], ['Count']], - }, - 'tasks_by_owner': { - 'name': 'tasks_by_owner', - 'type': 'pie', - 'title': 'Owners', - 'options': { - 'labels': ['Owner', 'Count'], + 'tasks_by_owner': { + 'name': 'tasks_by_owner', + 'type': 'pie', + 'title': 'Owners', + 'options': { + 'labels': ['Owner', 'Count'], + }, + 'data': group_low_occurrences(counts['owner'], threshold=0.005) if 'owner' in counts else [], }, - 'data': group_low_occurrences(counts['owner'], threshold=0.005) if 'owner' in counts else [], - }, - 'state_duration': { - 'name': 'state_duration', - 'type': 'pie', - 'title': 'Duration, days', - 'options': { - 'labels': ['State', 'Duration, days'], - 'size_mp': 0.3, + 'state_duration': { + 'name': 'state_duration', + 'type': 'pie', + 'title': 'Duration, days', + 'options': { + 'labels': ['State', 'Duration, days'], + 'size_mp': 0.3, + }, + 'data': [[state, round(dur, 3)] for state, dur in states_duration_summary.items() if dur > 0.0001], }, - 'data': [[state, round(dur, 3)] for state, dur in states_duration_summary.items() if dur > 0.0001], - }, - 'state_duration_hist': { - 'name': 'state_duration_hist', - 'type': 'bar_hist', - 'options': { - 'labels': ['Total time in task state, hours', 'Number of tasks'], - 'title': 'Task active state duration, hours', - 'size_mp': 0.7, + 'state_duration_hist': { + 'name': 'state_duration_hist', + 'type': 'bar_hist', + 'options': { + 'labels': ['Total time in task state, hours', 'Number of tasks'], + 'title': 'Task active state duration, hours', + 'size_mp': 0.7, + }, + 'data': {'columns': [], 'stats': [], } }, - 'data': {'columns': [], 'stats': [], } - }, - } - for time, count in build_time_histogram([t['creationdate'] for t in tasks]): - plots['time_hist']['data'][0].append(time.strftime(plots['time_hist']['options']['timeFormat'])) - plots['time_hist']['data'][1].append(count[0]) - stats, columns = build_stack_histogram(states_duration_lists, n_decimals=2, n_bin_max=100) - plots['state_duration_hist']['data']['columns'] = columns - plots['state_duration_hist']['data']['stats'] = stats - - timestamp_vars = ['modificationtime', 'statechangetime', 'starttime', 'creationdate', 'resquetime', - 'endtime', 'lockedtime', 'frozentime', 'ttcpredictiondate'] - for task in tasks: - for tp in task: - if tp in timestamp_vars and task[tp] is not None: - task[tp] = task[tp].strftime(settings.DATETIME_FORMAT) - if task[tp] is None: - task[tp] = '' - - # prepare data for datatable - task_list_table_headers = [ - 'jeditaskid', 'category', 'owner', 'attemptnr', 'age', 'superstatus', 'status', - 'problematic_transient_states', 'queued', 'running', 'troubling', - 'nfiles', 'nfilesfinished', 'nfilesfailed', 'pctfinished', 'errordialog', - ] - tasks_to_show = [] - for t in tasks: - tmp_list = [] - for h in task_list_table_headers: - if h in t: - tmp_list.append(t[h]) - else: - tmp_list.append("-") - tasks_to_show.append(tmp_list) + } + for time, count in build_time_histogram([t['creationdate'] for t in tasks]): + plots['time_hist']['data'][0].append(time.strftime(plots['time_hist']['options']['timeFormat'])) + plots['time_hist']['data'][1].append(count[0]) + stats, columns = build_stack_histogram(states_duration_lists, n_decimals=2, n_bin_max=100) + plots['state_duration_hist']['data']['columns'] = columns + plots['state_duration_hist']['data']['stats'] = stats + + timestamp_vars = ['modificationtime', 'statechangetime', 'starttime', 'creationdate', 'resquetime', + 'endtime', 'lockedtime', 'frozentime', 'ttcpredictiondate'] + for task in tasks: + for tp in task: + if tp in timestamp_vars and task[tp] is not None: + task[tp] = task[tp].strftime(settings.DATETIME_FORMAT) + if task[tp] is None: + task[tp] = '' + + # prepare data for datatable + task_list_table_headers = [ + 'jeditaskid', 'category', 'owner', 'attemptnr', 'age', 'superstatus', 'status', + 'problematic_transient_states', 'queued', 'running', 'troubling', + 'nfiles', 'nfilesfinished', 'nfilesfailed', 'pctfinished', 'errordialog', + ] + tasks_to_show = [] + for t in tasks: + tmp_list = [] + for h in task_list_table_headers: + if h in t: + tmp_list.append(t[h]) + else: + tmp_list.append("-") + tasks_to_show.append(tmp_list) + else: + tasks_to_show = [] + plots = {} data = { 'request': request, diff --git a/core/dashboards/templates/taskProblemExplorer.html b/core/dashboards/templates/taskProblemExplorer.html index 89ef4a62..0e22f23f 100644 --- a/core/dashboards/templates/taskProblemExplorer.html +++ b/core/dashboards/templates/taskProblemExplorer.html @@ -59,6 +59,12 @@ {% endif %} +{% else %} +
+
+

No slow tasks found!

+
+
{% endif %}