-
Notifications
You must be signed in to change notification settings - Fork 2
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
Redux integration and error handling #71
Conversation
johncalesp
commented
May 8, 2023
- Modified Habitat and Energy messages to handle error messages from deepview profile
- Added new component for recommendations (commented for now until its complete)
- Added redux for state management (for now only number of iterations is in the store. Will add more in next PR)
- Modified unit testing
- Added limit to throughput silder (now its 65 % of GPU memory)
import { useSelector, useDispatch } from "react-redux"; | ||
import { setIterationsValues } from "../redux/slices/trainingScheduleSlice"; | ||
|
||
const Iterations = () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Function Iterations
has 110 lines of code (exceeds 25 allowed). Consider refactoring.
(item) => item[0] === "demo" && item[1] === 1 | ||
); | ||
if (habitatData.error) { |
There was a problem hiding this comment.
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.
@@ -131,6 +144,22 @@ const EnergyConsumption = ({ energyData, numIterations }) => { | |||
}; | |||
}); | |||
} | |||
if (energyData.error) { |
There was a problem hiding this comment.
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.
["demo",1] | ||
] | ||
const noHabitatData = { | ||
predictions: [ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Identical blocks of code found in 2 locations. Consider refactoring.
["A4000", 14.537657], | ||
["RTX4000", 20.04405], | ||
], | ||
habitat: { |
There was a problem hiding this comment.
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.
event.data.habitat.length === 0 || | ||
(event.data.habitat[0][0] === "unavailable" && | ||
event.data.habitat[0][1] === -1.0) | ||
event.data.habitat.predictions && |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TODO: in a future PR, we can use redux to get the states
I would put the recommendations view in a separate PR and rename this PR to focus on adding redux and handling the error messages |
const { container } = render(<ProviderPanel numIterations={numIterations} habitatData={noHabitatData} additionalProviders={""}/>); | ||
json: jest.fn().mockResolvedValue(correctData), | ||
}); | ||
const { container } = render( |
There was a problem hiding this comment.
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.
@@ -68,7 +71,11 @@ jest.mock("recharts", () => { | |||
|
|||
test("Shows loading spinner when there is no habitat data", () => { | |||
// ARRANGE | |||
render(<DeploymentTab numIterations={numIterations} habitatData={[]} />); | |||
render( |
There was a problem hiding this comment.
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.
@@ -103,7 +109,11 @@ jest.mock("recharts", () => { | |||
|
|||
test("No energy data: shows only loading spinner", () => { | |||
// ARRANGE | |||
render(<EnergyConsumption energyData={{}} numIterations={numIterations} />); | |||
render( |
There was a problem hiding this comment.
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.
Code Climate has analyzed commit d9f452c and detected 20 issues on this pull request. Here's the issue category breakdown:
View more on Code Climate. |