From 6e4b9169b71ebc6ac765605fb8b8cdf8030df459 Mon Sep 17 00:00:00 2001 From: Laila Los <44241786+ElectronicBlueberry@users.noreply.github.com> Date: Thu, 1 Jun 2023 12:31:23 +0200 Subject: [PATCH] several tweaks and fixes make bar chart reactive and use ref for multiple instances of component typo fixes remove unused nesting from CarbonEmissionsIcon remove required from JobId --- .../JobMetrics/CarbonEmissions/BarChart.vue | 29 +++++++++++++--- .../CarbonEmissions/CarbonEmissions.test.js | 4 +-- .../CarbonEmissions/CarbonEmissions.vue | 2 +- .../CarbonEmissionsCalculations.vue | 30 ++++++++-------- .../CarbonEmissions/CarbonEmissionsIcon.vue | 34 ++++--------------- .../src/components/JobMetrics/JobMetrics.vue | 2 +- 6 files changed, 51 insertions(+), 50 deletions(-) diff --git a/client/src/components/JobMetrics/CarbonEmissions/BarChart.vue b/client/src/components/JobMetrics/CarbonEmissions/BarChart.vue index 8ae913bc6ad..874204797ab 100644 --- a/client/src/components/JobMetrics/CarbonEmissions/BarChart.vue +++ b/client/src/components/JobMetrics/CarbonEmissions/BarChart.vue @@ -1,12 +1,18 @@ diff --git a/client/src/components/JobMetrics/CarbonEmissions/CarbonEmissions.test.js b/client/src/components/JobMetrics/CarbonEmissions/CarbonEmissions.test.js index 5dbc918557d..c84af4d40c8 100644 --- a/client/src/components/JobMetrics/CarbonEmissions/CarbonEmissions.test.js +++ b/client/src/components/JobMetrics/CarbonEmissions/CarbonEmissions.test.js @@ -4,7 +4,7 @@ import { mount } from "@vue/test-utils"; const localVue = getLocalVue(); -const oneGibibyeMemoryInMebibyte = 1024; +const oneGibibyteMemoryInMebibyte = 1024; const oneHourInSeconds = 3600; const testServerInstance = { name: "some-server-name", @@ -22,7 +22,7 @@ describe("CarbonEmissions/CarbonEmissions.vue", () => { estimatedServerInstance: testServerInstance, jobRuntimeInSeconds: oneHourInSeconds, coresAllocated: 1, - memoryAllocatedInMebibyte: oneGibibyeMemoryInMebibyte, + memoryAllocatedInMebibyte: oneGibibyteMemoryInMebibyte, }, localVue, }); diff --git a/client/src/components/JobMetrics/CarbonEmissions/CarbonEmissions.vue b/client/src/components/JobMetrics/CarbonEmissions/CarbonEmissions.vue index 2b0fdc87bd3..2f79889ceff 100644 --- a/client/src/components/JobMetrics/CarbonEmissions/CarbonEmissions.vue +++ b/client/src/components/JobMetrics/CarbonEmissions/CarbonEmissions.vue @@ -114,7 +114,7 @@ const carbonEmissionsComparisons = computed(() => { const drivingInUS: CarbonComparison = { heading: "Distance driven in US", - explanation: "Distance driven in km in the US", + explanation: "Distance driven in miles in the US", value: prettyPrintValue({ // Multiply by 1.609 to convert km to miles value: parseFloat((totalCarbonEmissions / averagePassengerCarEmissionsUS / 1.609).toFixed(2)), diff --git a/client/src/components/JobMetrics/CarbonEmissions/CarbonEmissionsCalculations.vue b/client/src/components/JobMetrics/CarbonEmissions/CarbonEmissionsCalculations.vue index d2128a39b52..7f292f32246 100644 --- a/client/src/components/JobMetrics/CarbonEmissions/CarbonEmissionsCalculations.vue +++ b/client/src/components/JobMetrics/CarbonEmissions/CarbonEmissionsCalculations.vue @@ -63,18 +63,19 @@ const greenAlgorithmsUrl = "https://www.green-algorithms.org/"; cannot always assume this information is provided, we have two approaches:

-

- 1. In the case that the server's CPU specifications are known, we proceed as normal. -
- 2. When no information is provided, we estimate the server's configuration by matching your job's CPU - and/or memory usage to a comparable general purpose - AWS EC2 - instance. EC2 was chosen because its service provides numerous server configurations allowing us to - cover more real-world situations. - - (Click here to read further about general purpose EC2 machines). - -

+
    +
  1. In the case that the server's CPU specifications are known, we proceed as normal.
  2. +
  3. + When no information is provided, we estimate the server's configuration by matching your job's CPU + and/or memory usage to a comparable general purpose + AWS EC2 + instance. EC2 was chosen because its service provides numerous server configurations allowing us to + cover more real-world situations. + + (Click here to read further about general purpose EC2 machines) + +
  4. +

Once we have the information needed, we calculate the power usage of the CPU and memory in watts. For @@ -121,9 +122,8 @@ const greenAlgorithmsUrl = "https://www.green-algorithms.org/";

We compare the total carbon emissions of your job (per metric unit of CO2e) with - - carbon emission estimates calculated by the EPA. . When calculating the equivalent distance driven, we use the same reference values from the Green + carbon emission estimates calculated by the EPA. + When calculating the equivalent distance driven, we use the same reference values from the Green Algorithms Project's "Carbon emissions Calculator" tool.

diff --git a/client/src/components/JobMetrics/CarbonEmissions/CarbonEmissionsIcon.vue b/client/src/components/JobMetrics/CarbonEmissions/CarbonEmissionsIcon.vue index 0fdf3f8a569..05b4ad0c05c 100644 --- a/client/src/components/JobMetrics/CarbonEmissions/CarbonEmissionsIcon.vue +++ b/client/src/components/JobMetrics/CarbonEmissions/CarbonEmissionsIcon.vue @@ -20,33 +20,13 @@ const props = defineProps<{