Skip to content

Commit

Permalink
Merge pull request #411 from PanDAWMS/tania_dev
Browse files Browse the repository at this point in the history
core | add check for error diag
  • Loading branch information
tkorchug authored Nov 21, 2024
2 parents 6120c2a + 664ae0f commit 20e5a9e
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
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

0 comments on commit 20e5a9e

Please sign in to comment.