-
Notifications
You must be signed in to change notification settings - Fork 5
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
Implement persistent, local reputation + integration with the external Reputation System #214
Conversation
shadeofblue
commented
Mar 14, 2024
•
edited
Loading
edited
- Add Tortoise ORM + Aerich migration system
- Add FactoryBoy to facilitate easy creation of complex mock data structures
- Reputation schema, models + seed data, based on the previously-hardcoded values
- Add an adminstrative CLI tool to manage aerich migrations for the reputation db
- Add CLI to the new reputation module to manage and display the reputation data
- add ability to update the local reputation from the remote Reputation System
- Port provider blacklist plugin to the new reputation
- Port provider scorer plugin to the new, reputation-system-based reputation
- Automatically update the reputation from the external source on webserver start
- Add factories for Demand and Proposal resources
- Add a unit tests to the provider blacklist
- Add a unit test to the reputation scorer
fix initialization
* add blacklist queryset methods to `NodeReputation` * add `with_network` decorator to optimise reputation system's cli commands * add reputation system context to the webserver * use the local reputation blacklist in `network_stats`
* optimize the reputation list query
dc7dce7
to
feedd22
Compare
fdb26c4
to
076a719
Compare
* introducing factoryboy + Proposal/Demand factories + blacklist unit tests
076a719
to
7249c02
Compare
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.
Most of it looks very good, I added few comments and I am curious what you think about them.
@lucekdudek updated the code with the suggestions that I could :) |
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.
Approved, please consider changing that argument name.
…am_weights` for the sake of clarity
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'm a fan of weights on stuff that comes from external reputation, neat!
Also, a handful of code-style and asyncio-related stuff.
ray_on_golem/reputation/service.py
Outdated
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.
More typing on methods would be useful.
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 honestly think it wouldn't make much difference in case of this particular class... especially that the original methods it uses are not typed either...
Co-authored-by: approxit <[email protected]>
@approxit updated the pull request with your suggestions |
ray_on_golem/server/main.py
Outdated
@@ -171,14 +171,14 @@ async def reputation_service_ctx(app: web.Application) -> None: | |||
updaters = [ | |||
ReputationUpdater(network) for network in ["polygon", "mumbai", "goerli", "holesky"] | |||
] | |||
update_tasks = [asyncio.create_task(updater.update()) for updater in updaters] | |||
update_tasks = [ | |||
create_task_with_logging(updater.update(), trace_id="reputation_service_ctx") |
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 trick with trace_id
works when its values are unique. In that way, logs can differentiate task instances from each other. Refer to its usecases with get_trace_id_name
.
ray_on_golem/reputation/updater.py
Outdated
def reputation_uri(self): | ||
return f"{REPUTATION_SYSTEM_URI}{REPUTATION_SYSTEM_PROVIDER_SCORES}?network={self._network}" | ||
self.reputation_uri = ( | ||
URL(REPUTATION_SYSTEM_URI) |
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.
Instead of parsing yarl.URL
here, let's just keep it as a value of constant instead - as we do for many other constants - rich object instead of raw naive value.