diff --git a/core/libs/job.py b/core/libs/job.py index b363e941..33a366cd 100644 --- a/core/libs/job.py +++ b/core/libs/job.py @@ -307,6 +307,9 @@ def calc_jobs_metrics(jobs, group_by='jeditaskid'): job['failed'] = 100 if 'jobstatus' in job and job['jobstatus'] == 'failed' else 0 job['attemptnr'] = job['attemptnr'] + 1 + # protection if cpuconsumptiontime is decimal in non Oracle DBs + if 'cpuconsumptiontime' in job and job['cpuconsumptiontime'] is not None: + job['cpuconsumptiontime'] = float(job['cpuconsumptiontime']) if job['category'] == 'run': if 'maxpss' in job and job['maxpss'] and isinstance(job['maxpss'], int) and ( @@ -318,12 +321,11 @@ def calc_jobs_metrics(jobs, group_by='jeditaskid'): job['walltime'] = get_job_walltime(job) job['queuetime'] = get_job_queuetime(job) - if job['walltime'] and 'cpuconsumptiontime' in job and ( - isinstance(job['cpuconsumptiontime'], int) and job['cpuconsumptiontime'] > 0) and ( + if job['walltime'] and 'cpuconsumptiontime' in job and job['cpuconsumptiontime'] is not None and ( 'actualcorecount' in job and isinstance(job['actualcorecount'], int) and job['actualcorecount'] > 0): job['efficiency'] = round(1.0*job['cpuconsumptiontime']/job['walltime']/job['actualcorecount'], 2) - job['cputime'] = round(job['cpuconsumptiontime'] / 60. / 60., 2) if 'cpuconsumptiontime' in job and isinstance(job['cpuconsumptiontime'], int) else 0 + job['cputime'] = round(job['cpuconsumptiontime'] / 60. / 60., 2) if 'cpuconsumptiontime' in job else 0 job['walltime'] = round(job['walltime'] / 60. / 60., 2) if job['walltime'] is not None else 0 job['queuetime'] = round(job['queuetime'] / 60. / 60., 2) if job['queuetime'] is not None else 0 @@ -496,6 +498,8 @@ def clean_job_list(request, jobl, do_add_metadata=False, do_add_errorinfo=False) 'actualcorecount' in job and isinstance(job['actualcorecount'], int) and job['actualcorecount'] > 0): job['maxpssgbpercore'] = round(job['maxpss']/1024./1024./job['actualcorecount'], 2) + if 'cpuconsumptiontime' in job and job['cpuconsumptiontime'] is not None: + job['cpuconsumptiontime'] = float(job['cpuconsumptiontime']) if ('cpuconsumptiontime' in job and job['cpuconsumptiontime'] and job['cpuconsumptiontime'] > 0) and ( 'actualcorecount' in job and job['actualcorecount'] is not None and job['actualcorecount'] > 0) and ( 'durationsec' in job and job['durationsec'] is not None and job['durationsec'] > 0): diff --git a/core/libs/jobconsumption.py b/core/libs/jobconsumption.py index 35fa6f57..189cd18e 100644 --- a/core/libs/jobconsumption.py +++ b/core/libs/jobconsumption.py @@ -225,7 +225,9 @@ def job_consumption_plots(jobs): job['duration'] = get_job_walltime(job) if 'queuetime' not in job: job['queuetime'] = get_job_queuetime(job) - + # protection if cpuconsumptiontime is decimal in non Oracle DBs + if 'cpuconsumptiontime' in job and job['cpuconsumptiontime'] is not None: + job['cpuconsumptiontime'] = float(job['cpuconsumptiontime']) if 'pilottiming' in job: job.update(parse_job_pilottiming(job['pilottiming'])) diff --git a/core/views.py b/core/views.py index 911e6a6b..a47e4dd9 100644 --- a/core/views.py +++ b/core/views.py @@ -8567,7 +8567,7 @@ def get_hc_tests(request): if wallclocktime is not None: test['wallclocktime'] = wallclocktime if wallclocktime > 0: - test['cpuefficiency'] = round(job['cpuconsumptiontime']/test['wallclocktime'], 3) + test['cpuefficiency'] = round(float(job['cpuconsumptiontime'])/test['wallclocktime'], 3) else: test['cpuefficiency'] = 0 else: