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

update thresholds logic in the farmerbot and create independent checks for each cloud unit utilization #819

Merged
merged 12 commits into from
Apr 30, 2024

Conversation

xmonader
Copy link
Contributor

@xmonader xmonader commented Feb 12, 2024

update thresholds logic in the farmerbot and create independent checks for each cloud unit utilization.

Description

update thresholds logic in the farmerbot and create independent checks for each cloud unit utilization.

Changes

  • update thresholds logic in the farmerbot and create independent checks for each cloud unit utilization.
  • helpers to calculate demands
  • helpers to select underutilized nodes
  • helpers to check if demands is met in the current conditions of used and total resources

Related Issues

Checklist

  • Tests included
  • Build pass
  • Documentation
  • Code format and docstring

Updated report

Screenshot from 2024-02-26 11-55-20

…ting the demand and filtering nodes that can be powered on or turned off to reduce the waste of resources as long as they meet the defined threshold
farmerbot/internal/power.go Outdated Show resolved Hide resolved
…d high resources, return error if nodes length is zero in high usage case
return f.powerOn(sub, nodeID)
log.Info().Uint32("nodeID", uint32(node.ID)).Msg("Too much resource usage. Turning on node")
if err := f.powerOn(sub, uint32(node.ID)); err != nil {
return fmt.Errorf("couldn't power on node %v with error: %w", node.ID, err)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Should we return? Or continue?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

we should continue indeed you're right

@scottyeager
Copy link

scottyeager commented Mar 19, 2024

Anything blocking here? Would be nice to get this merged, since the current implementation means that in many cases new nodes won't be woken when they are needed.

Copy link
Contributor

@Omarabdul3ziz Omarabdul3ziz left a comment

Choose a reason for hiding this comment

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

looks good to me, just some small comments.

farmerbot/internal/power.go Outdated Show resolved Hide resolved
farmerbot/internal/power.go Outdated Show resolved Hide resolved
}

// Check if this node can contribute to the remaining demand
contribute := false
Copy link
Contributor

Choose a reason for hiding this comment

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

do you think it is a good idea to find the least number of nodes to wakeup?
i am thinking of in some cases maybe node1 satisfy cru only and it will be added to selectedNodes to power on, then node2 will satisfy the rest of resources and it also can satisfy the initial demand of cru, so instead of powering on both, node2 will be enough.

Copy link
Collaborator

Choose a reason for hiding this comment

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

I discussed it with @muhamadazmy. I think it is ok (your suggestion is right) to power on the next node that fits requirements. Of course, we don't guarantee if it will be used or not.

Copy link
Contributor

@Eslam-Nawara Eslam-Nawara left a comment

Choose a reason for hiding this comment

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

Nice work, agree with Omar comments :)

Copy link
Contributor

@Omarabdul3ziz Omarabdul3ziz left a comment

Choose a reason for hiding this comment

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

LGTM

@rawdaGastan rawdaGastan merged commit d1973fe into development Apr 30, 2024
39 checks passed
@rawdaGastan rawdaGastan deleted the development_farmerbot_usageunits branch April 30, 2024 08:55
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.

None yet

5 participants