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
fix(jinad): ensure log is ready on creating flow #2279
fix(jinad): ensure log is ready on creating flow #2279
Conversation
Codecov Report
@@ Coverage Diff @@
## master #2279 +/- ##
===========================================
- Coverage 90.42% 74.09% -16.33%
===========================================
Files 211 192 -19
Lines 11444 10889 -555
===========================================
- Hits 10348 8068 -2280
- Misses 1096 2821 +1725
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
Latency summaryCurrent PR yields:
Breakdown
Backed by latency-tracking. Further commits will update this comment. |
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.
Thanks for the awesome PR @mohamed--abdel-maksoud.
Few points:
- The adapter of jinad + fluentd to stream logs (jina dashboard) already takes care of Right after starting a flow, GET logs sends 404 #1812 on the frontend code.
- jinad supports flow creation even when fluentd is not installed, hence we cannot rely on a local folder creation to send back
flow_id
. - Current integration of fluentd with jinad is very simple as it is local file-based and we plan to move it to a more optimal solution soon.
About the changes to the logstream
endpoint, can you briefly explain how it would help us if we move away from WebSocketEndpoint
?
Thanks for the feedback @deepankarm
Sorry, I didn't notice that part, so it is solved in dashboard?
True, there should've been a condition on
beside being a more idiomatic way to do websockets in FastAPI, it allows us to pass query parameters (e.g. timeout). Which in turn allows unit-testing that endpoint. |
Good question. The initial implementation had bi-directional communication, hence the implementation was using websockets (and Since we are looking at an optimal place to store & stream fluentd logs anyway in near future, websocket based stream might be optimized/removed. I would definitely accept the PR if we only keep the websocket endpoint refactoring and remove the section with wait until |
Also, please rebase your branch with |
OK, I will update the PR this evening. Thanks for the review! |
daemon/api/endpoints/logs.py
Outdated
await self.disconnect(connection) | ||
|
||
|
||
@router.websocket("/logstream/{workspace_id}/{log_id}") |
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.
Hey @mohamed--abdel-maksoud , could you please use single quote?
b4f2b0a
to
881a06c
Compare
@deepankarm I did the requested changes, I also pulled latest master and rebased my branch, it says it is up to date, so I'm not sure what's missing in branch to pass CI. |
I think it's related to this issue: jitterbit/get-changed-files#4 |
@cristianmtr can you help here? |
daemon/api/endpoints/flow.py
Outdated
@@ -1,3 +1,4 @@ | |||
import asyncio |
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.
What is the motivation of adding this import?
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.
My bad, there used to be asyncio.sleep but I removed it.
Strange the linter didn't catch it!
Make sure you pull the |
Thanks, that was it. I totally forgot to sync with upstream. |
Nice work @mohamed--abdel-maksoud |
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👍
A minimal fix for #1812: right after creating a flow, the function keeps checking for the flow's log file (up to 1 minute).
If it is possible to have a tighter integration with
fluentd
, a better fix could be implemented.