diff --git a/SAS/TMSS/frontend/tmss_webapp/src/routes/Report/cycle/report.category.observations.js b/SAS/TMSS/frontend/tmss_webapp/src/routes/Report/cycle/report.category.observations.js index bf776d5b221e8d5963ac9cf29615c545fe3f1a09..01952e2da0db554bdc8536ac2213a4154176a774 100644 --- a/SAS/TMSS/frontend/tmss_webapp/src/routes/Report/cycle/report.category.observations.js +++ b/SAS/TMSS/frontend/tmss_webapp/src/routes/Report/cycle/report.category.observations.js @@ -95,10 +95,10 @@ class CycleCategoryObservations extends Component{ this.props.data.map(repData => { let cycleData = {} cycleData['cycle'] = repData.cycle; - cycleData['prio_A'] = repData.observation_hours_per_category.total_duration_A; - cycleData['prio_B'] = repData.observation_hours_per_category.total_duration_B; - cycleData['ddt_com_reg'] = repData.observation_hours_per_category.total_duration_ddt; - cycleData['unavailable'] = repData.observation_hours_per_category.total_duration_unavailable; + cycleData['prio_A'] = repData.observation_hours_per_category.total_duration_successful_A; + cycleData['prio_B'] = repData.observation_hours_per_category.total_duration_successful_B; + cycleData['ddt_com_reg'] = repData.observation_hours_per_category["DDT Com Rep"]; + cycleData['unavailable'] = repData.observation_hours_per_category["System Unavailability"]; cycleData['failed'] = repData.observation_hours_per_category.total_duration_failed; cycleData['idle'] = repData.observation_hours_per_category.total_duration_idle; reportData.push(cycleData); 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 2027e1dd191c89a89f2d947d94986636c18999d9..bb345c59ed062b7daa08ef196fc8bf2a9dd3020d 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 @@ -6,6 +6,7 @@ import { Bar } from 'react-chartjs-2'; import ReportService from '../../services/report.service'; import UnitConverter from '../../utils/unit.converter'; +import UIConstants from '../../utils/ui.constants'; /** * Component to get report data and display them for a Project. @@ -68,21 +69,21 @@ class ProjectReport extends Component { let subs = projectReport["SUBs"][subStatus]; for (const sub of subs) { let reportSub = _.cloneDeep(sub); - reportSub.status = subStatus; + // reportSub.status = subStatus; suStatsList.push(reportSub); } } suStatsList = _.orderBy(suStatsList, ['id']); for (const reportSub of suStatsList) { - if (reportSub.duration) { - reportSub.observingTime = (reportSub.duration/timeFactor).toFixed(2); - totalSUBObsTime += reportSub.duration; + if (reportSub.observed_duration) { + reportSub.observingTime = (reportSub.observed_duration/timeFactor).toFixed(2); + totalSUBObsTime += reportSub.observed_duration; reportSub.observingTimeInc = (totalSUBObsTime / timeFactor).toFixed(2); reportSub.observingTimeLeft = ((projectObservingTime - totalSUBObsTime)/timeFactor).toFixed(2); reportSub.observingTimeIncPercent = (totalSUBObsTime/projectObservingTime*100).toFixed(2); } // For testing set duration as processDuration - reportSub.processDuration = reportSub.duration; + reportSub.processDuration = reportSub.observed_duration; if (reportSub.processDuration) { reportSub.processTime = (reportSub.processDuration/timeFactor).toFixed(2); totalProcessTime += reportSub.processDuration; @@ -91,13 +92,17 @@ class ProjectReport extends Component { reportSub.processTimeIncPercent = (totalProcessTime / projectProcessTime *100).toFixed(2); } // For testing set dummy value for LTA dataproducts - reportSub["LTA dataproducts"] = {size__sum: 10737418240}; - if (reportSub["LTA dataproducts"]) { - reportSub.ingestDataSize = ((reportSub["LTA dataproducts"]["size__sum"] || 0)/dataSizeFactor).toFixed(2); - totalLTAStorage += reportSub["LTA dataproducts"]["size__sum"]; + // reportSub["LTA dataproducts"] = {size__sum: 10737418240}; + // if (reportSub["LTA dataproducts"]) { + reportSub.ingestDataSize = ((reportSub["ingested_data_size"] || 0)/dataSizeFactor).toFixed(2); + totalLTAStorage += reportSub["ingested_data_size"]; reportSub.ingestDataIncPercent = (totalLTAStorage / projectLTAStorage * 100).toFixed(2); - } - delete reportSub["LTA dataproducts"]; + // } + // delete reportSub["LTA dataproducts"]; + reportSub.ingestDate = reportSub.ingested_date?moment.utc(reportSub.ingested_date).format(UIConstants.CALENDAR_DEFAULTDATE_FORMAT):""; + reportSub.execDate = moment.utc(reportSub.start).format(UIConstants.CALENDAR_DEFAULTDATE_FORMAT); + reportSub.observationSASId = reportSub["SAS ID"]["observation control"].join(); + reportSub.pipelinseSASId = (reportSub["SAS ID"]["preprocessing pipeline"].concat(reportSub["SAS ID"]["pulsar pipeline"])).join(", "); } let observTimeUtilization = {type: 'Observing', value: parseFloat((totalSUBObsTime/timeFactor).toFixed(2)), @@ -122,6 +127,59 @@ class ProjectReport extends Component { } + getTargetData() { + const projectObservingTime = this.state.projectResources["LOFAR Observing Time"]?this.state.projectResources["LOFAR Observing Time"].value:0; + const timeFactor = UnitConverter.resourceUnitMap["time"].conversionFactor; + const sapsData = this.state.reportData["SAPs exposure"]; + const targets = _.keys(sapsData); + let targetReports = []; + for (let target of targets) { + let targetReport = {name: _.startCase(target)}; + targetReport.exposure = parseFloat(sapsData[target] / timeFactor).toFixed(2); + targetReport.expPercent = parseFloat(sapsData[target] / projectObservingTime * 100 ).toFixed(2); + targetReports.push(targetReport); + } + let targetBarData = { + labels: _.map(targetReports, 'name'), + datasets: [ + { label: 'Exposure', + data: _.map(targetReports, 'expPercent'), + backgroundColor: [ + '#44a3ce', + '#44a3ce', + '#44a3ce' + ] + } + ] + }; + let targetBarOptions = { + indexAxis: 'y', + elements: { + bar: { borderWidth: 1 }, + }, + scales: { + x: { max: 100 } + }, + responsive: true, + plugins: { + legend: { position: 'right' }, + title: { + display: true, + text: 'Target Exposure', + }, + tooltip: { + callbacks: { + label: function(tooltipItem, data) { + const itemData = _.find(targetReports, ['name', tooltipItem.label]); + return `${itemData?itemData.expPercent:""}% (${itemData?itemData.exposure:""} hrs)`; + } + } + } + } + }; + return {barData: targetBarData, barOptions: targetBarOptions}; + } + /** * Renders the SU table header component * @returns Component @@ -173,7 +231,7 @@ class ProjectReport extends Component { const project = this.props.project; let barData = {}, barOptions = {}; const resourceUtilization = this.state.resourceUtilization; - + const targetData = reportData?this.getTargetData():null; // Resource Utilization bar chart data set with options if (resourceUtilization.length > 0) { barData = { @@ -291,6 +349,12 @@ class ProjectReport extends Component { </tbody> </table> </div> + {targetData && + <div className="target-exposure" id={`${this.props.project.name}-target-exposure`} + style={{paddingTop: "10px", paddingBottom: "10px"}}> + <Bar data={targetData.barData} options={targetData.barOptions} width="50%" height="10"/> + </div> + } </div> </> } diff --git a/SAS/TMSS/frontend/tmss_webapp/src/routes/Report/project.report.main.js b/SAS/TMSS/frontend/tmss_webapp/src/routes/Report/project.report.main.js index 6412c28ce9a0bd76e71ac59e001c67c950adf742..ddf04ee5411093e210ccf06f7c04920f319e01b5 100644 --- a/SAS/TMSS/frontend/tmss_webapp/src/routes/Report/project.report.main.js +++ b/SAS/TMSS/frontend/tmss_webapp/src/routes/Report/project.report.main.js @@ -20,7 +20,7 @@ import ProjectReport from './project.report'; // report data and title for displaying in reports and while exporting them. const SU_DETAILS_COLUMNS = [{name: "su_name", headerTitle: "SU Name & Link in TMSS", propertyName: "name"}, {name: "su_status", headerTitle: "SU Status Failed / Success ", propertyName: "status"}, - {name: "su_execDate", headerTitle: "SU Execution Date", propertyName: "exec_date"}, + {name: "su_execDate", headerTitle: "SU Execution Date", propertyName: "execDate"}, {name: "observTime", headerTitle: "Time Observed (hr)", propertyName: "observingTime"}, {name: "observTimeInc", headerTitle: "Time Observed Incremental (hr)", propertyName: "observingTimeInc"}, {name: "observTimeLeft", headerTitle: "Time left for Observing (hr)", propertyName: "observingTimeLeft"}, diff --git a/SAS/TMSS/frontend/tmss_webapp/src/services/report.service.js b/SAS/TMSS/frontend/tmss_webapp/src/services/report.service.js index ed6a9e0e719ab143c72d9b1510ce8bc35bca929e..81185d3cc482a01f9d3b9b59d77af0b63d080e76 100644 --- a/SAS/TMSS/frontend/tmss_webapp/src/services/report.service.js +++ b/SAS/TMSS/frontend/tmss_webapp/src/services/report.service.js @@ -9,7 +9,7 @@ const ReportService = { const response = await axios.get(`/api/project/${project}/report/`); reportData = response.data; // TODO: TEST DATA to be removed - reportData = { + /*reportData = { "project": "test_for_report", "quota": [ { @@ -73,7 +73,7 @@ const ReportService = { "target1": 7200.0, "target2": 3200.0 } - } + }*/ } catch(error) { console.error(error); reportData.error = error; @@ -92,7 +92,6 @@ const ReportService = { getCyclesReport: async(cycleList) => { try { const response = await axios.get(`/api/util/cycles_report/?cycles=${cycleList.join(',')}`); - // return response.data; const testData = { "Cycle 12": { "cycle": "Cycle 12", @@ -165,10 +164,12 @@ const ReportService = { "prognosis": 960 }, "observation_hours_per_category": { + "DDT Com rep": 80, + "System unavailability":null, "total_duration_failed": 100, "total_duration_idle": 200, - "total_duration_A": 500, - "total_duration_B": 300 + "total_duration_successful_A": 500, + "total_duration_successful_B": 300 }, "weekly_efficiency": { "weeks": [ @@ -473,10 +474,12 @@ const ReportService = { "prognosis": 95 }, "observation_hours_per_category": { + "DDT Com rep": 40, + "System unavailability":null, "total_duration_failed": 10, "total_duration_idle": 20, - "total_duration_A": 100, - "total_duration_B": 50 + "total_duration_successful_A": 100, + "total_duration_successful_B": 50 }, "weekly_efficiency": { "weeks": [ @@ -781,10 +784,12 @@ const ReportService = { "prognosis": 95 }, "observation_hours_per_category": { + "DDT Com rep": 60, + "System unavailability":null, "total_duration_failed": 10, "total_duration_idle": 20, - "total_duration_A": 100, - "total_duration_B": 50 + "total_duration_successful_A": 100, + "total_duration_successful_B": 50 }, "weekly_efficiency": { "weeks": [ @@ -1089,10 +1094,12 @@ const ReportService = { "prognosis": 95 }, "observation_hours_per_category": { + "DDT Com rep": 60, + "System unavailability":null, "total_duration_failed": 10, "total_duration_idle": 20, - "total_duration_A": 100, - "total_duration_B": 50 + "total_duration_successful_A": 100, + "total_duration_successful_B": 50 }, "weekly_efficiency": { "weeks": [ @@ -1325,10 +1332,11 @@ const ReportService = { } }, "failures": {months: [{month: "2020-06-01", total_failed: 1200}, {month: "2020-07-01", total_failed: 1300}]} - } + }, + "Cycle 16": {"cycle": "Cycle 16", "telescope_time_distribution": {"UNASSIGNED": {"durations": {"total": 720.0, "succeeded": 720.0, "succeeded_perc": 1.0, "failed": 0, "failed_perc": 0.0, "idle": 0.0, "idle_perc": 0.0}}, "FILLER": {"durations": {"total": 0, "succeeded": 0, "succeeded_perc": null, "failed": 0, "failed_perc": null, "idle": 0, "idle_perc": null}}, "REGULAR": {"durations": {"total": 0, "succeeded": 0, "succeeded_perc": null, "failed": 0, "failed_perc": null, "idle": 0, "idle_perc": null}}, "USER_SHARED_SUPPORT": {"durations": {"total": 0, "succeeded": 0, "succeeded_perc": null, "failed": 0, "failed_perc": null, "idle": 0, "idle_perc": null}}, "COMMISSIONING": {"durations": {"total": 0, "succeeded": 0, "succeeded_perc": null, "failed": 0, "failed_perc": null, "idle": 0, "idle_perc": null}}, "DDT": {"durations": {"total": 0, "succeeded": 0, "succeeded_perc": null, "failed": 0, "failed_perc": null, "idle": 0, "idle_perc": null}}, "TEST": {"durations": {"total": 0, "succeeded": 0, "succeeded_perc": null, "failed": 0, "failed_perc": null, "idle": 0, "idle_perc": null}}}, "average_efficiency": {"target": 0.65, "efficiency": 0.01}, "completion_level": {"target": 0.0, "total": 720.0, "succeeded": 720.0, "succeeded_perc": 1.0, "prognosis": 0.0}, "observation_hours_per_category": {"total_duration": 720.0, "total_duration_successful": 720.0, "total_duration_failed": 0, "total_duration_idle": 0.0, "DDT Com Rep": 0, "System Unavailability": null, "total_duration_successful_A": 720.0, "successful_A_perc": 1.0, "total_duration_successful_B": 0, "successful_B_perc": 0.0, "successful_perc": 1.0, "idle_perc": 0.0, "failed_perc": 0.0, "ddt_com_rep_perc": 0.0, "system_unavailability_perc": null}, "weekly_efficiency": {"weeks": [{"week": "2021-06-01", "efficiency": null}, {"week": "2021-06-08", "efficiency": null}, {"week": "2021-06-15", "efficiency": null}, {"week": "2021-06-22", "efficiency": null}, {"week": "2021-06-29", "efficiency": null}, {"week": "2021-07-06", "efficiency": null}, {"week": "2021-07-13", "efficiency": null}, {"week": "2021-07-20", "efficiency": null}, {"week": "2021-07-27", "efficiency": null}, {"week": "2021-08-03", "efficiency": null}, {"week": "2021-08-10", "efficiency": null}, {"week": "2021-08-17", "efficiency": 1.0}, {"week": "2021-08-24", "efficiency": null}, {"week": "2021-08-31", "efficiency": null}, {"week": "2021-09-07", "efficiency": null}, {"week": "2021-09-14", "efficiency": null}, {"week": "2021-09-21", "efficiency": null}, {"week": "2021-09-28", "efficiency": null}, {"week": "2021-10-05", "efficiency": null}, {"week": "2021-10-12", "efficiency": null}, {"week": "2021-10-19", "efficiency": null}, {"week": "2021-10-26", "efficiency": null}, {"week": "2021-11-02", "efficiency": null}, {"week": "2021-11-09", "efficiency": null}, {"week": "2021-11-16", "efficiency": null}, {"week": "2021-11-23", "efficiency": null}]}, "data_ingested_per_site_and_category": {"Interferometric Observation": {"size__sum": 0}, "Beamformed Observation": {"size__sum": null}, "Preprocessing Pipeline": {"size__sum": null}, "Pulsar Pipeline": {"size__sum": null}}, "projects_summary": [{"project": "normal", "quota": [{"id": 2, "resource_type_id": "LTA Storage", "value": 1000000000000.0}], "SUBs": {"successful": [], "failed": []}, "durations": {"total": 2160.0, "total_not_cancelled": 2160.0, "total_succeeded": 0, "total_failed": 0, "total_observed": 0, "total_observed_succeeded": 0, "total_observed_failed": 0, "total_succeeded_A": 0, "total_observed_succeeded_A": 0, "total_succeeded_B": 0, "total_observed_succeeded_B": 0, "not_cancelled_perc": 1.0, "succeeded_perc": 0.0, "failed_perc": 0.0, "observed_perc": 0.0, "observed_succeeded_perc": 0.0, "observed_failed_perc": 0.0}, "LTA dataproducts": {"size__sum": null}, "SAPs exposure": {"Polaris": 120.0}}, {"project": "low", "quota": [{"id": 3, "resource_type_id": "LTA Storage", "value": 1000000000000.0}], "SUBs": {"successful": [], "failed": []}, "durations": {"total": 87720.0, "total_not_cancelled": 87720.0, "total_succeeded": 0, "total_failed": 0, "total_observed": 0, "total_observed_succeeded": 0, "total_observed_failed": 0, "total_succeeded_A": 0, "total_observed_succeeded_A": 0, "total_succeeded_B": 0, "total_observed_succeeded_B": 0, "not_cancelled_perc": 1.0, "succeeded_perc": 0.0, "failed_perc": 0.0, "observed_perc": 0.0, "observed_succeeded_perc": 0.0, "observed_failed_perc": 0.0}, "LTA dataproducts": {"size__sum": null}, "SAPs exposure": {"target1": 28800.0, "target2": 28800.0}}, {"project": "high", "quota": [{"id": 1, "resource_type_id": "LTA Storage", "value": 1099511627776.0}, {"id": 4, "resource_type_id": "LOFAR Observing Time", "value": 72000.0}, {"id": 5, "resource_type_id": "CEP Processing Time", "value": 72000.0}], "SUBs": {"successful": [{"id": 1, "name": "Obs high 1", "status": "finished", "start": "2021-08-18T21:35:22", "stop": "2021-08-18T21:47:22", "duration": 720.0, "observed_duration": 720.0, "target": "Observation", "SAS ID": {"observation control": [2000000], "preprocessing pipeline": [2000003], "pulsar pipeline": []}, "ingested_date": null, "ingested_data_size": null}], "failed": []}, "durations": {"total": 12720.0, "total_not_cancelled": 12720.0, "total_succeeded": 720.0, "total_failed": 0, "total_observed": 720.0, "total_observed_succeeded": 720.0, "total_observed_failed": 0, "total_succeeded_A": 720.0, "total_observed_succeeded_A": 720.0, "total_succeeded_B": 0, "total_observed_succeeded_B": 0, "not_cancelled_perc": 1.0, "succeeded_perc": 0.06, "failed_perc": 0.0, "observed_perc": 0.06, "observed_succeeded_perc": 0.06, "observed_failed_perc": 0.0}, "LTA dataproducts": {"size__sum": null}, "SAPs exposure": {"target1": 7200.0, "target2": 7200.0, "B0329+54": 120.0, "Polaris": 120.0}}], "usage_mode": {"all modes": {"total": null, "observing": null, "idle/test": null}, "stand-alone mode": {"total": null, "no project": null, "project": null, "mixed/no project": null}, "ILT mode": {"total": null, "observing": null, "idle/test": null}}, "failures": {"months": [{"month": "2021-06-01", "total": 0, "total_failed": 0, "failed_perc": null}, {"month": "2021-07-01", "total": 0, "total_failed": 0, "failed_perc": null}, {"month": "2021-08-01", "total": 720.0, "total_failed": 0, "failed_perc": 0.0}, {"month": "2021-09-01", "total": 0, "total_failed": 0, "failed_perc": null}, {"month": "2021-10-01", "total": 0, "total_failed": 0, "failed_perc": null}, {"month": "2021-11-01", "total": 0, "total_failed": 0, "failed_perc": null}]}} } - - return _.filter(testData, data => { return cycleList.indexOf(data.cycle)>=0 }) ; + return response.data; + // return _.filter(testData, data => { return cycleList.indexOf(data.cycle)>=0 }) ; } catch(error) { console.error(error); return null;