Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

core | add check for error diag #411

Merged
merged 2 commits into from
Nov 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions core/libs/job.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,9 +138,12 @@ def get_job_info(job):

# add diag with error code = 0 or any error code for not failed jobs
diag_no_error_list = [
(c['name'], job[c['error']], job[c['diag']]) for c in const.JOB_ERROR_CATEGORIES if c['error'] in job and c['diag'] and len(job[c['diag']]) > 0 and (
(job[c['error']] == 0 or job[c['error']] == '0') or ('jobstatus' in job and job['jobstatus'] not in ('failed', 'holding'))
)
(c['name'], job[c['error']], job[c['diag']])
for c in const.JOB_ERROR_CATEGORIES
if c['error'] in job and c['diag'] and c['diag'] in job and job[c['diag']] and len(job[c['diag']]) > 0
and (
job[c['error']] in (0, '0') or ('jobstatus' in job and job['jobstatus'] not in ('failed', 'holding'))
)
]
if len(diag_no_error_list) > 0:
for d in diag_no_error_list:
Expand Down
6 changes: 4 additions & 2 deletions core/libs/user.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ def prepare_user_dash_plots(tasks, **kwargs):
plots_dict['ntasks_by_status']['data'][task['status']] = 0
plots_dict['ntasks_by_status']['data'][task['status']] += 1

if task['age'] > 0:
if 'age' in task and task['age'] is not None and task['age'] > 0:
if task['status'] not in plots_dict['age_hist']['data']['data_raw']:
plots_dict['age_hist']['data']['data_raw'][task['status']] = []
plots_dict['age_hist']['data']['data_raw'][task['status']].append((task['age']))
Expand Down Expand Up @@ -218,7 +218,9 @@ def humanize_metrics(metrics):

for key, thresholds in metrics_thresholds.items():
if key in md:
metric_defs[md]['class'].extend([c for c, crange in thresholds.items() if metric_defs[md]['value'] >= crange[0] and metric_defs[md]['value'] < crange[1]])
metric_defs[md]['class'].extend(
[c for c, crange in thresholds.items() if crange[0] <= metric_defs[md]['value'] < crange[1]]
)

metric_defs[md]['class'] = metric_defs[md]['class'][0] if len(metric_defs[md]['class']) > 0 else 'ok'
metrics_list.append(metric_defs[md])
Expand Down