-
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
Adding SQList as client storage solution #159
Conversation
…er-controlled sources Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #159 +/- ##
==========================================
+ Coverage 89.33% 94.29% +4.96%
==========================================
Files 24 25 +1
Lines 2578 2647 +69
Branches 216 216
==========================================
+ Hits 2303 2496 +193
+ Misses 275 151 -124 ☔ 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.
Just a few comments, nothing majorly glaring from what I can see. So many tests tho -- very nice!
@@ -127,7 +127,7 @@ async def stop_job(job_id: str, request: Request) -> JSONResponse: | |||
|
|||
user_error_message = "" | |||
for client_info in job.clients_info: | |||
response = requests.get(url=f"http://{client_info.service_address}/api/client/stop/{client_info.pid}") | |||
response = requests.get(url=f"http://{client_info.service_address}/api/client/stop/{client_info.uuid}") |
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.
just making sure we want to change to uuid
for this over pid
?
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.
Yes, it's one of the goals of having storage on the client, so we don't pass things like PID and local file paths around.
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.
Ah okay gotcha. Thanks!
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.
Quick q: are we concerned at this stage (or at any stage) that we're writing these objects to local? I guess they're not very big objects and we're not writing that often are we?
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.
No, they are just supposed to contain meta-information about the flower clients so we can have some control over them on the FLorist side. This is not supposed to contain full application information or even be a fully trusted source of data, it's just a way to avoid sharing sensitive information with the server side of things. I tried to find the cheapest and easiest thread-safe way of doing that and SQLite was the best I found after I found out TinyDB is not thread-safe.
IMO it should only contain information about the client that is not allowed to be shared to the server. In this first case here, it will contain PID and a local file path to the client logs, but I can also see the local model file paths being stored here in the near future. Anything else that is not a problem being sent to the server should be sent to the server for storage on MongoDB.
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.
Thank you for this context! I remember you talking to us about TinyDB lacking concurrency (lol). Based on this context and your implementation, I think this is pretty good! 👏🏼
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.
looks good from my perspective!
PR Type
Feature
Short Description
Clickup Ticket(s): https://app.clickup.com/t/868bv4yn5
In this PR I am introducing SQLite as a solution for the FLorist client to store sensitive information about the FL client. List of changes:
florist/api/db/client_entities.py
which will contain both the SQLite entity definitions and the methods to connect and access the DB.florist/api/db/entities.py
toflorist/api/db/server_entities.py
pid
andlog_file_path
from theClientInfo
MongoDB entitypid
andlog_file_path
, it will now save those to the databasestop
andget_log
functions, change them to receive the client UUID instead of thepid
orlog_file_path
respectivellyset_pids
function toset_server_pid
as it now only saves the server's PID.Tests Added
Fully unit and integration tested