Rapl node capping daemon #21
No reviewers
Labels
No labels
bug
documentation
duplicate
enhancement
fix
good first issue
help wanted
invalid
major
question
testing
wontfix
No milestone
No project
No assignees
1 participant
Due date
No due date set.
Dependencies
No dependencies set.
Reference: spdf/elektron#21
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "raplDaemon"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Left to do in separate PRs:
Maybe we can put this in a separate repo since there's no dependencies on the main project.
I agree that we can place the rapl-daemon code in a separate repo.
I have commented on a few things. Apart from that, everything looks okay to me.
capable of changing
missing period at the end of the sentence.
missing period at end of sentence.
@ -0,0 +24,4 @@
func main() {
http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
fmt.Fprintf(w, "Unsupported endpoint %s", html.EscapeString(r.URL.Path))
error messages should be lowercase.
constraint_1 is the shorter window.
maybe just say cap percentage must be in the range (0, 100].
constraint_0 is the longer window.
Going by this we are intending to use the longer window for running average calculations.
So, change the variable name to
maxPowerFileLongWindow
?ditto.
overflow
sfits on a single line.
@ -0,0 +44,4 @@
maxPower, err := maxPower(filepath.Join(base, file.Name(), maxPowerFileLongWindow))
if err != nil {
failed = append(failed, file.Name())
fmt.Println("unable to retreive max power for zone ", err)
any reason for just printing the error and not returning it?
Basically, the question is whether we need to continue to attempt to powercap if an error occurs anywhere in the process.
@ -0,0 +53,4 @@
if err := capZone(filepath.Join(base, file.Name(), powerLimitFileLongWindow), powercap); err != nil {
failed = append(failed, file.Name())
fmt.Println("unable to write powercap value: ", err)
same here regarding whether the error to continue if error occurs or should we just return it.
I think it's safe to use spaces ("bad percentage") as the words are hyphenated by default.
Although, I do not mind the camelcasing.
@ -0,0 +83,4 @@
}
func TestCapZone(t *testing.T) {
const percentage float64 = .50
The payload declares
percentage
as an integer. So, we would never hit this scenario.Should the percentage in the payload be an integer?
@ -0,0 +24,4 @@
func main() {
http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
fmt.Fprintf(w, "Unsupported endpoint %s", html.EscapeString(r.URL.Path))
In this case this is some http content being served back to to the client that made the request. I did make it lower case though.
Can you expand on this comment?
@ -0,0 +44,4 @@
maxPower, err := maxPower(filepath.Join(base, file.Name(), maxPowerFileLongWindow))
if err != nil {
failed = append(failed, file.Name())
fmt.Println("unable to retreive max power for zone ", err)
Agreed, I don't know what the right path to take is here. If the file write fails, we could be left in an inconsistent state. The only options here are to bail and return an error right away, or to continue trying to cap the node and then returning an array of zones where were unable to cap the node in.
@ -0,0 +83,4 @@
}
func TestCapZone(t *testing.T) {
const percentage float64 = .50
The payload does indeed take an integer, but when we calculate powercap, I'd rather multiply by a fraction than to multiply by a (0,100] integer and then divide by 100. This is done in the next line and it's just for testing.
@ -0,0 +44,4 @@
maxPower, err := maxPower(filepath.Join(base, file.Name(), maxPowerFileLongWindow))
if err != nil {
failed = append(failed, file.Name())
fmt.Println("unable to retreive max power for zone ", err)
Any chance we can roll back the power limits set to the previous values if and when any of the file writes fail?
Actually, your way of representing the ranges is more explicit and clear. One is not well-versed with range expressions would still be able to understand your explanation. So, ignore my previous statement and leave it as is.
Either change overflows to overflow, or get rid of the "an".
@ -0,0 +44,4 @@
maxPower, err := maxPower(filepath.Join(base, file.Name(), maxPowerFileLongWindow))
if err != nil {
failed = append(failed, file.Name())
fmt.Println("unable to retreive max power for zone ", err)
If the write fails, we're sort of left in limbo. If the write to modify it failed, then most likely the write to restore the value will fail too. We can try reading it and seeing if that's the same value as before.
Good catch, fixed.
Fixed this, definitely a mistake on my part. Thanks for catching it!
I'll revert it
Good point, fixed.