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

add farmerbot #509

Merged
merged 58 commits into from
Dec 26, 2023
Merged

add farmerbot #509

merged 58 commits into from
Dec 26, 2023

Conversation

rawdaGastan
Copy link
Collaborator

farmerbot/cmd/farmerbot.go Outdated Show resolved Hide resolved
farmerbot/slice/contains.go Outdated Show resolved Hide resolved
farmerbot/server/farmerbot.go Outdated Show resolved Hide resolved
farmerbot/server/farmerbot.go Outdated Show resolved Hide resolved
farmerbot/server/farmerbot.go Outdated Show resolved Hide resolved
farmerbot/models/config.go Outdated Show resolved Hide resolved
@rawdaGastan rawdaGastan marked this pull request as draft November 28, 2023 23:28
@rawdaGastan rawdaGastan marked this pull request as ready for review November 30, 2023 16:13
Copy link
Member

@muhamadazmy muhamadazmy left a comment

Choose a reason for hiding this comment

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

I feel this is still too complex and not clear as it should. Most of my comments about architecture which i still think is far from optimal. And i feel like i need to re add the same comments from last PR.

In general please consider the following:

  • Shared internal state is a no no. If you feel u need to share internal state then u are doing something wrong
  • again, state is private, no object need to expose his internal state, if u do so then you are doing something wrong.
  • Use small and parameterised functions for example PeriodicWakeUp(&node) against PeriodicWakeup() the first one is better, because it checks this specific node if it can be waked up or not.
  • Smaller functions, leads to clearer and smaller function names.

farmerbot/internal/farmerbot.go Outdated Show resolved Hide resolved
farmerbot/internal/farmerbot.go Outdated Show resolved Hide resolved
farmerbot/internal/farmerbot.go Outdated Show resolved Hide resolved
farmerbot/internal/types.go Show resolved Hide resolved
farmerbot/internal/farmerbot.go Outdated Show resolved Hide resolved
farmerbot/internal/power_manager.go Outdated Show resolved Hide resolved
farmerbot/internal/power_manager.go Outdated Show resolved Hide resolved
farmerbot/internal/power_manager.go Outdated Show resolved Hide resolved
farmerbot/internal/power_manager.go Outdated Show resolved Hide resolved
farmerbot/internal/state.go Show resolved Hide resolved
@rawdaGastan rawdaGastan marked this pull request as ready for review December 20, 2023 13:18
@xmonader
Copy link
Contributor

It might be bit too much, but can we check the close issues (and the open ones) https://github.com/threefoldtech/farmerbot/issues (ofc we can ignore anything related to typescript or rmb-peer .. etc) to make sure things are already covered

Copy link
Contributor

@xmonader xmonader left a comment

Choose a reason for hiding this comment

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

Added a partial list of change requests, will be checking the mechanics tmw inshallah

farmerbot/README.md Outdated Show resolved Hide resolved
farmerbot/README.md Outdated Show resolved Hide resolved
farmerbot/README.md Outdated Show resolved Hide resolved
farmerbot/README.md Show resolved Hide resolved
farmerbot/parser/parser.go Show resolved Hide resolved
farmerbot/internal/types.go Outdated Show resolved Hide resolved
farmerbot/internal/types.go Outdated Show resolved Hide resolved
farmerbot/internal/types.go Show resolved Hide resolved
farmerbot/internal/types.go Outdated Show resolved Hide resolved
farmerbot/internal/substrate.go Outdated Show resolved Hide resolved
Copy link
Contributor

@xmonader xmonader left a comment

Choose a reason for hiding this comment

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

Review is finished, I still have some questions on the behavior, but all in all: great job 💯. We are still missing the part of running this as a docker container too.

farmerbot/internal/constants.go Outdated Show resolved Hide resolved
farmerbot/internal/constants.go Outdated Show resolved Hide resolved
farmerbot/internal/constants.go Outdated Show resolved Hide resolved
farmerbot/internal/constants.go Outdated Show resolved Hide resolved
farmerbot/cmd/root.go Outdated Show resolved Hide resolved
farmerbot/internal/find_node.go Outdated Show resolved Hide resolved
farmerbot/internal/farmerbot.go Show resolved Hide resolved
farmerbot/internal/farmerbot.go Outdated Show resolved Hide resolved
farmerbot/internal/farmerbot.go Outdated Show resolved Hide resolved
farmerbot/internal/farmerbot.go Outdated Show resolved Hide resolved
Copy link
Contributor

@MarioBassem MarioBassem left a comment

Choose a reason for hiding this comment

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

a really great work.
i'm yet to finish the reivew, but i have some small questions and notes for now

farmerbot/README.md Outdated Show resolved Hide resolved
farmerbot/internal/find_node.go Show resolved Hide resolved
possibleNodes[i].ID < possibleNodes[j].ID // for tests
})

nodeFound := possibleNodes[0]
Copy link
Contributor

Choose a reason for hiding this comment

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

i think we still need the possible nodes list. a power on call for the first node may fail for any reason, and maybe it's best to check with other suitable nodes if that's the case

Copy link
Contributor

Choose a reason for hiding this comment

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

Problem here is, booting another node is also subject to the same thing and can get worse for the rest of the offline nodes even. I don't think that should be the behavior, the node may take 1-30 mins too boot, while the farmerbot iteration is every 5mins :D

continue
}

if !node.canClaimResources(nodeOptionsCapacity, f.config.Power.OverProvisionCPU) {
Copy link
Contributor

Choose a reason for hiding this comment

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

how do we make sure that the local state of nodes is not invalidated somehow? a user could deploy contracts on any of the monitored nodes and consume it's resources, which invalidates the state, no?

Copy link
Contributor

Choose a reason for hiding this comment

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

the state is rebuilt every 5mins, we can have a 10% buffer around it for optimistic calculations

Copy link
Contributor

Choose a reason for hiding this comment

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

will always get real time

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

farmerbot/internal/farmerbot.go Outdated Show resolved Hide resolved
farmerbot/internal/farmerbot.go Outdated Show resolved Hide resolved
farmerbot/internal/farmerbot.go Show resolved Hide resolved
@xmonader xmonader merged commit 04d9f86 into development Dec 26, 2023
19 of 20 checks passed
@rawdaGastan rawdaGastan deleted the development_farmerbot branch December 26, 2023 15:10
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.

4 participants