-
Notifications
You must be signed in to change notification settings - Fork 0
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 a Redis hook to update status #40
Conversation
for more information, see https://pre-commit.ci
for more information, see https://pre-commit.ci
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #40 +/- ##
==========================================
+ Coverage 90.01% 91.57% +1.55%
==========================================
Files 20 20
Lines 591 700 +109
Branches 11 11
==========================================
+ Hits 532 641 +109
Misses 59 59 ☔ View full report in Codecov by Sentry. |
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.
All in all, it looks pretty good to me! I only included a few small suggestions and also a few clarifying questions. Once you have a chance to respond, I will take another pass through and if nothing comes up we can get this merged in :)
@jewelltaylor thanks for the review! I've addressed your comments, please check again. |
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.
LGTM! As always, sweet tests :)
PR Type
Feature
Short Description
Clickup Ticket(s): https://app.clickup.com/t/8688aj7hy
First of all, sorry for the lengthy PR :)
The functionality is a bit complex and also I used the opportunity to do some refactoring. Below is the list of things in this PR.
Refactoring:
metrics.py
Job
entity. The idea is to kinda follow the DAO design pattern and have all database operations centralized inside the modules in thedb
folder.pymongo.MongoClient
database connection (in addition to the Motor one) because FastAPI'sBackgroundTask
does not work withasync
functions 😢Main work:
RedisMetricsReporter
get_subscriber
function inmetrics.py
server_uuid
andserver_metrics
to theJob
, as well asuuid
andmetrics
toClientInfo
.training/start
endpoint to:NOT_STARTED
IN_PROGRESS
once the training is kicked offserver_uuid
. It will have a listener to that channel which will keep checking if the metrics havefit_end
and once they do, change the status of the job toFINISHED_SUCCESSFULLY
and save the client and server metrics in the database.Tests Added
Fully integration- and unit-tested, so a whole lot.