Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added carbon impact of cloud providers #58

Merged
merged 8 commits into from
Apr 5, 2023

Conversation

michaelshin
Copy link
Contributor

Changes made:

  • Moved providers.json to public folder
  • Only use the local providers.json if it is a dev build, else we use the json file found in the S3 bucket
  • Updated the schema to allow environmental impact of each provider and their regions
  • Updated the providers.json to store the environmental impact of each provider and their regions
  • Added utility functions to determine the carbon impact of using a certain instance
  • Added a bar graph and tooltip to demonstrate the carbon impact of a certain instance
  • Updated unit tests

Screenshot of changes:

Screenshot from 2023-04-04 11-38-46

@@ -46,6 +46,53 @@ const correctData = [
},
];

const correctDataWithOptionals = [
{
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Similar blocks of code found in 2 locations. Consider refactoring.

},
],
},
{
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Similar blocks of code found in 2 locations. Consider refactoring.

@@ -74,55 +121,25 @@ const incorrectData = [
},
];

test("Validate JSON file (URL) and return list of cloud providers and instances", async () => {
test("Validate JSON file without optional values against the schema", async () => {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Similar blocks of code found in 2 locations. Consider refactoring.

});


test("Validate JSON file with optional parameters against the schema", async () => {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Similar blocks of code found in 2 locations. Consider refactoring.

@@ -17,7 +17,7 @@ const habitatData = [
["RTX4000", 20.2342],
];

const correctData = [
const correctDataWithoutOptionals = [
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Similar blocks of code found in 2 locations. Consider refactoring.

@anurlybayev
Copy link
Contributor

Please do a demo of this on Thursday!

@@ -1,3 +1,28 @@
const GPU_POWER = {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

File utils.js has 266 lines of code (exceeds 250 allowed). Consider refactoring.

return (GPU_POWER.MAX_WATTS[gpuName] - GPU_POWER.MIN_WATTS[gpuName]) * 0.5 + GPU_POWER.MIN_WATTS[gpuName];
}

export function getCarbonDataOfInstance(time, instance, cloudProvider) {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function getCarbonDataOfInstance has 26 lines of code (exceeds 25 allowed). Consider refactoring.

<div className="innpv-subpanel-content">
<Container fluid>
<ResponsiveContainer width="100%" height={50*carbonData.length}>
<BarChart
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Similar blocks of code found in 2 locations. Consider refactoring.

@@ -1,3 +1,28 @@
const GPU_POWER = {
MIN_WATTS: {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Similar blocks of code found in 2 locations. Consider refactoring.

"p4": 9,
"p100": 36
},
MAX_WATTS: {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Similar blocks of code found in 2 locations. Consider refactoring.

@codeclimate
Copy link

codeclimate bot commented Apr 4, 2023

Code Climate has analyzed commit d3cc916 and detected 13 issues on this pull request.

Here's the issue category breakdown:

Category Count
Complexity 3
Duplication 10

View more on Code Climate.

@michaelshin michaelshin merged commit bcb49a2 into main Apr 5, 2023
@michaelshin michaelshin deleted the add-carbon-impact-cloud-providers branch April 27, 2023 19:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants