diff --git a/SAS/TMSS/backend/src/tmss/tmssapp/adapters/reports.py b/SAS/TMSS/backend/src/tmss/tmssapp/adapters/reports.py index 5b6cd1f63812138d4754c0eaaea9b7c163cdeb34..01a15f52e3b54c1a218e9684b49dd8c233895d7f 100644 --- a/SAS/TMSS/backend/src/tmss/tmssapp/adapters/reports.py +++ b/SAS/TMSS/backend/src/tmss/tmssapp/adapters/reports.py @@ -430,7 +430,7 @@ class ProjectReport(): Help method to retrieve durations and scheduling_units distinguished by success/fail. """ - durations = {'total_regular': 0, 'total_not_cancelled': 0, 'total_on_sky': 0, 'total_processed': 0, + durations = {'total_regular': 0, 'total_not_cancelled': 0, 'total_on_sky': 0, 'total_CPU_time_used': 0, 'total_observed': 0, 'total_observed_succeeded': 0, 'total_observed_failed': 0, 'total_observed_acceptance_pending': 0} @@ -453,7 +453,7 @@ class ProjectReport(): # Gather durations durations['total_regular'] += sub_info['duration'] # Regular sub.duration durations['total_on_sky'] += sub_info['on_sky_duration'] # OnSky sub.on_sky_duration - durations['total_processed'] += sub_info['processed_duration'] # CPU time used + durations['total_CPU_time_used'] += sub_info['CPU_time_used_duration'] # CPU time used if sub.status.value != models.SchedulingUnitStatus.Choices.CANCELLED.value: # Not cancelled SUBs durations['total_not_cancelled'] += sub_info['on_sky_duration'] durations['total_observed'] += sub_info['observed_duration'] # Total observed @@ -494,11 +494,11 @@ class ProjectReport(): sub_duration = sub.duration.total_seconds() if sub.duration else 0 sub_on_sky_duration = sub.on_sky_duration.total_seconds() if sub.on_sky_duration else 0 sub_observed_duration = sub.observed_duration.total_seconds() if sub.observed_duration else 0 - sub_processed_duration = self._get_processing_resources(sub=sub)['CPU_time_used'] + sub_CPU_time_used_duration = self._get_processing_resources(sub=sub)['CPU_time_used'] # Info about the SUB to be returned sub_info = {'id': sub.pk, 'name': sub.name, 'status': sub.status.value, 'start': sub_start_time, 'stop': sub_stop_time, 'duration': sub_duration, 'on_sky_duration': sub_on_sky_duration, - 'observed_duration': sub_observed_duration, 'processed_duration': sub_processed_duration} + 'observed_duration': sub_observed_duration, 'CPU_time_used_duration': sub_CPU_time_used_duration} # If we are interested only in durations (e.g., for project summaries), just return these pieces of info if durations_only: diff --git a/SAS/TMSS/frontend/tmss_webapp/src/__mocks__/cycle.service.data.js b/SAS/TMSS/frontend/tmss_webapp/src/__mocks__/cycle.service.data.js index c886d4f9adbf6c806acf0a74d21c1de918765f3e..aa792aed48f031c40dddd862aea31b5f686dacc2 100644 --- a/SAS/TMSS/frontend/tmss_webapp/src/__mocks__/cycle.service.data.js +++ b/SAS/TMSS/frontend/tmss_webapp/src/__mocks__/cycle.service.data.js @@ -1,3 +1,4 @@ +import SIPrefixFactor from './../utils/unit.converter' const CycleServiceMock= { project_categories: [{url: "Regular", value: 'Regular'}, {url: "User Shared Support", value: 'User Shared Support'}], @@ -98,7 +99,7 @@ const CycleServiceMock= { 'LOFAR Observing Time prio A': 3600, 'LOFAR Observing Time prio B': 3600, 'CEP Processing Time': 3600, - 'LTA Storage': 1000*1000*1000*1000, + 'LTA Storage': SIPrefixFactor ** 4, 'Number of triggers': 1, 'LOFAR Support Time': 3600 }, diff --git a/SAS/TMSS/frontend/tmss_webapp/src/__mocks__/project.service.data.js b/SAS/TMSS/frontend/tmss_webapp/src/__mocks__/project.service.data.js index 4060cd238bddbcf4fae9f0d862802bc3f537b539..e5a3ec280b5e7a54cff9f73e31bdf89d14d05bf9 100644 --- a/SAS/TMSS/frontend/tmss_webapp/src/__mocks__/project.service.data.js +++ b/SAS/TMSS/frontend/tmss_webapp/src/__mocks__/project.service.data.js @@ -1,4 +1,4 @@ - +import SIPrefixFactor from './../utils/unit.converter' const ProjectServiceMock= { project_categories: [{url: "Regular", value: 'Regular'}, {url: "User Shared Support", value: 'User Shared Support'}], @@ -163,7 +163,7 @@ const ProjectServiceMock= { 'LOFAR Observing Time prio A': 3600, 'LOFAR Observing Time prio B': 3600, 'CEP Processing Time': 3600, - 'LTA Storage': 1000*1000*1000*1000, + 'LTA Storage': SIPrefixFactor ** 4, 'Number of triggers': 1, 'LOFAR Support Time': 3600 }, diff --git a/SAS/TMSS/frontend/tmss_webapp/src/routes/Report/cycle/report.overview.js b/SAS/TMSS/frontend/tmss_webapp/src/routes/Report/cycle/report.overview.js index bb69a9038dfee10900f13a8e798e6b6056da0fc9..c0febc67b36f0698f1376ef695cb7a8f37aa7109 100644 --- a/SAS/TMSS/frontend/tmss_webapp/src/routes/Report/cycle/report.overview.js +++ b/SAS/TMSS/frontend/tmss_webapp/src/routes/Report/cycle/report.overview.js @@ -27,7 +27,7 @@ class CycleOverview extends Component{ projectData['cycle'] = repData.cycle; projectData['observingTime'] = (_.sumBy(cycleProjects, (projectSummary) => { return projectSummary.durations.total_observed_succeeded })/timeConversionFactor).toFixed(2); projectData['noOfTriggers'] = _.sumBy(cycleProjects, (projectSummary) => { return projectSummary.nr_of_used_triggers }); - projectData['processingTime'] = (_.sumBy(cycleProjects, (projectSummary) => { return projectSummary.durations.total_processed })/timeConversionFactor).toFixed(2); + projectData['processingTime'] = (_.sumBy(cycleProjects, (projectSummary) => { return projectSummary.durations.total_CPU_time_used })/timeConversionFactor).toFixed(2); projectData['ltaStorage'] = (_.sumBy(cycleProjects, (projectSummary) => { return projectSummary.LTA_dataproducts.size || 0 })/dataConversionFactor).toFixed(2); projectData['prioSuccessTime'] = (_.sumBy(cycleProjects, (projectSummary) => { return projectSummary.durations.total_observed_succeeded_A })/timeConversionFactor).toFixed(2); projectData['failedTime'] = (_.sumBy(cycleProjects, (projectSummary) => { return projectSummary.durations.total_observed_failed })/timeConversionFactor).toFixed(2); diff --git a/SAS/TMSS/frontend/tmss_webapp/src/routes/Report/cycle/report.project.summary.js b/SAS/TMSS/frontend/tmss_webapp/src/routes/Report/cycle/report.project.summary.js index 800c8dd531d0ac716c9d28a2ccb0bc27205e784e..2b3104296c2d8d12eab021aa9191984fb78f9d4c 100644 --- a/SAS/TMSS/frontend/tmss_webapp/src/routes/Report/cycle/report.project.summary.js +++ b/SAS/TMSS/frontend/tmss_webapp/src/routes/Report/cycle/report.project.summary.js @@ -24,7 +24,7 @@ class CycleProjectSummary extends Component{ projectData['cycle'] = repData.cycle; projectData['project'] = projData.project; projectData['durationObserved'] = (projData.durations.total_observed/timeConversionFactor).toFixed(2); - projectData['durationProcessed'] = (projData.durations.total_processed/timeConversionFactor).toFixed(2); + projectData['durationProcessed'] = (projData.durations.total_CPU_time_used/timeConversionFactor).toFixed(2); const saraData = projData.data_ingested_per_site?_.find(projData.data_ingested_per_site, {"cluster_name":"Sara"}):null; projectData['dataToSara'] = ((saraData?saraData.size:0)/dataConversionFactor).toFixed(2); const juelichData = projData.data_ingested_per_site?_.find(projData.data_ingested_per_site, {"cluster_name":"Juelich"}):null; diff --git a/SAS/TMSS/frontend/tmss_webapp/src/routes/Report/project.report.js b/SAS/TMSS/frontend/tmss_webapp/src/routes/Report/project.report.js index 809274baadbca08b5c8e17f70d40cc3c048520c2..128b45da421cb208f088a96d82ae484ab773722c 100644 --- a/SAS/TMSS/frontend/tmss_webapp/src/routes/Report/project.report.js +++ b/SAS/TMSS/frontend/tmss_webapp/src/routes/Report/project.report.js @@ -90,10 +90,10 @@ class ProjectReport extends Component { reportSub.observingTimeLeft = ((projectObservingTime - totalSUBObsTime)/timeFactor).toFixed(2); reportSub.observingTimeIncPercent = (totalSUBObsTime/projectObservingTime*100).toFixed(2); } - if (reportSub.processed_duration) { - reportSub.processTime = (reportSub.processed_duration/timeFactor).toFixed(2); + if (reportSub.CPU_time_used_duration) { + reportSub.processTime = (reportSub.CPU_time_used_duration/timeFactor).toFixed(2); if (reportSub.acceptance_status != 'failed'){ - totalProcessTime += reportSub.processed_duration; + totalProcessTime += reportSub.CPU_time_used_duration; } reportSub.processTimeInc = (totalProcessTime / timeFactor).toFixed(2); reportSub.processTimeLeft = ((projectProcessTime - totalProcessTime)/timeFactor).toFixed(2); diff --git a/SAS/TMSS/frontend/tmss_webapp/src/services/project.service.js b/SAS/TMSS/frontend/tmss_webapp/src/services/project.service.js index db86542f49b736927422d633205e0f45baa99863..df0aa76c87de80e6a05aafc3212c48fcaced5307 100644 --- a/SAS/TMSS/frontend/tmss_webapp/src/services/project.service.js +++ b/SAS/TMSS/frontend/tmss_webapp/src/services/project.service.js @@ -1,6 +1,6 @@ import _ from 'lodash'; -import UnitConverter from './../utils/unit.converter' +import { UnitConverter, SIPrefixFactor } from './../utils/unit.converter' import axios from "axios" @@ -59,7 +59,7 @@ const ProjectService = { 'LOFAR Observing Time prio A': 3600, 'LOFAR Observing Time prio B': 3600, 'CEP Processing Time': 3600, - 'LTA Storage': 1000*1000*1000*1000, + 'LTA Storage': SIPrefixFactor ** 4, 'Number of triggers': 1, 'LOFAR Support Time': 3600}); } catch (error) { diff --git a/SAS/TMSS/frontend/tmss_webapp/src/utils/unit.converter.js b/SAS/TMSS/frontend/tmss_webapp/src/utils/unit.converter.js index c2a1186b5eb350f0e246b93b349c884656f12559..525f1bbd238e9ef97728efb13e531aecd9a7c43b 100644 --- a/SAS/TMSS/frontend/tmss_webapp/src/utils/unit.converter.js +++ b/SAS/TMSS/frontend/tmss_webapp/src/utils/unit.converter.js @@ -1,24 +1,31 @@ import _, {round} from 'lodash'; import moment from "moment"; -const UnitConverter = { +// Note: While a binary factor is more commonly used for sizes, the correct binary prefix TiB is apparently confusing +// and our stakeholders expressed the wish to see things in TB, so we should use the implied SI prefix factor. Hence +// we should use the SIPrefixFactor throughout the frontend. +export const SIPrefixFactor = 1000; +export const binaryPrefixFactor = 1024; + +export const UnitConverter = { + resourceUnitMap: { 'time': {display: 'Hours', conversionFactor: 3600, mode: 'decimal', minFractionDigits: 0, maxFractionDigits: 2}, 'bytes': { display: 'TB', - conversionFactor: (1000 * 1000 * 1000 * 1000), + conversionFactor: (SIPrefixFactor ** 4), mode: 'decimal', minFractionDigits: 0, maxFractionDigits: 3 }, 'bytes_gb': { display: 'GB', - conversionFactor: (1000 * 1000 * 1000), + conversionFactor: (SIPrefixFactor ** 3), mode: 'decimal', minFractionDigits: 0, maxFractionDigits: 3 }, - 'gb': {display: 'TB', conversionFactor: (1000), mode: 'decimal', minFractionDigits: 0, maxFractionDigits: 3}, + 'gb': {display: 'TB', conversionFactor: (SIPrefixFactor), mode: 'decimal', minFractionDigits: 0, maxFractionDigits: 3}, 'number': { display: 'Numbers', conversionFactor: 1,