Skip to content

Commit

Permalink
Merge pull request #340 from PanDAWMS/tk
Browse files Browse the repository at this point in the history
slowtasks | add message if no tasks found
  • Loading branch information
tkorchug authored May 28, 2024
2 parents b3f2774 + 994c689 commit 7b75b9a
Show file tree
Hide file tree
Showing 3 changed files with 83 additions and 73 deletions.
4 changes: 3 additions & 1 deletion core/art/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -384,7 +384,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
Expand Down
146 changes: 74 additions & 72 deletions core/dashboards/taskproblemexplorer.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
6 changes: 6 additions & 0 deletions core/dashboards/templates/taskProblemExplorer.html
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,12 @@
</div>
{% endif %}
</div>
{% else %}
<div class="card bp-container-simple info">
<div class="card-divider">
<p>No slow tasks found!</p>
</div>
</div>
{% endif %}


Expand Down

0 comments on commit 7b75b9a

Please sign in to comment.