-
Notifications
You must be signed in to change notification settings - Fork 44
Adds PowerControl class and integrates power control data #172
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
Adds PowerControl class and integrates power control data #172
Conversation
|
Wow, fantastic. I'll have a look in the next days. Thank you for putting in the work ⭐️ |
7edcdf1 to
ed14135
Compare
|
I also added special case for Supermicro PSU models which do not provide the power capacity through Redfish API. |
… power data processing Refactor session handling and enhance vendor detection from chassis data
19615fe to
d20575f
Compare
|
Added fallback for vendor identification. |
cr_module/power.py
Outdated
| _supermicro_power_supply_specs = { | ||
| "PWS-2K22A-1R": {"capacity_in_watt": 2200, "efficiency_percent": 96}, | ||
| "PWS-1K21P-1R": {"capacity_in_watt": 1200, "efficiency_percent": 92}, | ||
| "PWS-2K02P-1R": {"capacity_in_watt": 2000, "efficiency_percent": 91}, | ||
| "PWS-2K02F-1R": {"capacity_in_watt": 2000, "efficiency_percent": 94}, | ||
| "PWS-1K03B-1R": {"capacity_in_watt": 1000, "efficiency_percent": None}, | ||
| "PWS-407P-1R": {"capacity_in_watt": 400, "efficiency_percent": None}, | ||
| # Add more as needed... | ||
| } | ||
|
|
||
|
|
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.
I would say, this would fit petter into classes/vendor.py
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.
Yes, it makes sense, of course. Would using config files/external resources useful here to handle this kind of data?
cr_module/power.py
Outdated
| model = ps.get("Model") or part_number | ||
| last_power_output = ps.get("LastPowerOutputWatts") or ps.get("PowerOutputWatts") | ||
| capacity_in_watt = ps.get("PowerCapacityWatts") | ||
| efficiency_percent = ps.get("EfficiencyPercent", None) |
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.
the None in the end could be removed as it is the default.
cr_module/classes/redfish.py
Outdated
| chassis = self.get_system_properties("chassis") | ||
| if len(chassis) > 0: | ||
| # try to get vendor from first chassis | ||
| chassis_data = self.get(chassis[0]) | ||
| if chassis_data is not None: | ||
| vendor_string = chassis_data.get("Manufacturer", None) |
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.
this could probably be compacted to:
vendor_string = grab(self.get_system_properties, "chassis.0.Manufacturer")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.
The problem here is that we don’t have the chassis data at this point. We have to fetch it from Redfish first.
So I have updated the code to be more concise using grab, but still we have to call the GET first. Or am I missing something?
Streamlined the Chassis retrieval code.
08b9d88 to
f4aeee0
Compare
Referring to issue #171, I provide a patch for this.
PowerControlget_single_chassi_powerfunction, similarly toPowerSupply.I got a bit confused about how to deal with
dictsubelements which get rendered as strings (but they are not valid JSON because of quoting issues).In particular, I am referring to the following elements in
PowerControl.