You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by "bbovenzi (via GitHub)" <gi...@apache.org> on 2025/02/11 19:35:47 UTC
[I] AIP-84 | Fix Task Logs [airflow]
bbovenzi opened a new issue, #46657:
URL: https://github.com/apache/airflow/issues/46657
(no comment)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] AIP-84 | Get Logs - Improve the formatting of the content response [airflow]
Posted by "bbovenzi (via GitHub)" <gi...@apache.org>.
bbovenzi commented on issue #46657:
URL: https://github.com/apache/airflow/issues/46657#issuecomment-2652172777
Are you suggesting that we pass the continuation token in the response header and then the body is just text?
If so, I'd really like to avoid that because nowhere else do we expect the API consumer to have to look at the response header.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] AIP-84 | Get Logs - Improve the formatting of the content response [airflow]
Posted by "potiuk (via GitHub)" <gi...@apache.org>.
potiuk commented on issue #46657:
URL: https://github.com/apache/airflow/issues/46657#issuecomment-2666482705
> I'm using a pydantic model to do the parsing now in https://github.com/apache/airflow/pull/46827 (as that also converts time strings into dt objects for us) so that "should be fast as its using jiter under the hood"
I am not too concerned about the speed - I am much more concerned about memory. This comment was more after the "streaming" experience of it - or more precisely not loading whole log in memory and being able to handle log entries formatted in json retrieved with HTTP-RANGE requeests (i.e. broken json because we do not know where next log entry starts or because the json object is not completely available in HTTP-RANGE), I have not looked at the details (sorry) - so maybe it's already handled, sorry if I am adding noise, but we discussed in the past (also connected with https://github.com/apache/airflow/issues/45079) that we wanted to do partial retrieval of the logs. I am **not sure** if that's already in, but I think by default Pydantic Models won't do partial rendering and whether we already do partial log retrieval but as far as I know there is a special handling needed to make partial rendering works with Pydantic models.
But again - maybe it's already in, or planned.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] AIP-84 | Get Logs - Improve the formatting of the content response [airflow]
Posted by "Lee-W (via GitHub)" <gi...@apache.org>.
Lee-W closed issue #46657: AIP-84 | Get Logs - Improve the formatting of the content response
URL: https://github.com/apache/airflow/issues/46657
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] AIP-84 | Get Logs - Improve the formatting of the content response [airflow]
Posted by "jason810496 (via GitHub)" <gi...@apache.org>.
jason810496 commented on issue #46657:
URL: https://github.com/apache/airflow/issues/46657#issuecomment-2663163563
> logs endpoint currently has to load log files from multiple sources and interleave/sort them by date (worker, triggerer, scheduler can all produce logs for a TI) so it's not as stright forward as just "serve up this one file" sadly.
Yes, I have looked into the part you mentioned before. I believe this is not the main issue and is unrelated to this specific discussion. The key aspect here is **changing how the `get_log` API reads from `task_log_reader`**.
https://github.com/apache/airflow/blob/main/airflow/api_fastapi/core_api/routes/public/log.py#L138-L146
> So while I too like `application/x-ndjson` I don't think it's a simple matter of just changing it to that.
From my perspective, this shouldn't be a major issue (at least from the API side; I'm unsure about the UI side). The `task_log_reader.read_log_stream` method is actually a generator, which is also how the legacy UI retrieves logs from the `text/plain` log response.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] AIP-84 | Get Logs - Improve the formatting of the content response [airflow]
Posted by "ashb (via GitHub)" <gi...@apache.org>.
ashb commented on issue #46657:
URL: https://github.com/apache/airflow/issues/46657#issuecomment-2668037123
Oh yeah, partial requests/range requests/ smaller number of lines etc needs a more in-depth overhaul of the entire log reading pipeline (which I think we should do)
It currently does a lot of things
- It reads form multiple sources
- It then parses each line to try and get the timestamp/date from it
- It sorts it
- Then due to what I think is another bug[1] it then dedupes the lines!
[1] the "bug" is that it looks at a local file, and then it also asks the remote log URL. So in the case of LocalExecutor in breeze/a single airflow pod, the webserver can read the file and it gets one set of logs there, and then it also hits the log http server and gets _the same content_ there. Deduping is a bit of hammer to fix this problem that we should come up with a more elegant solution around. But that falls into a wider "lets look at logging" issue than this is talking about
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] AIP-84 | Get Logs - Improve the formatting of the content response [airflow]
Posted by "potiuk (via GitHub)" <gi...@apache.org>.
potiuk commented on issue #46657:
URL: https://github.com/apache/airflow/issues/46657#issuecomment-2663288463
> From my perspective, this shouldn't be a major issue (at least from the API side; I'm unsure about the UI side). The task_log_reader.read_log_stream method is actually a generator, which is also how the legacy UI retrieves logs from the text/plain log response.
BTW. We've also discussed it before and **maybe** some optimizations can be (I am repeating myself) using some of the existing json parsers. There are a few - notably the super fast rust jiter which is part of Pydantic and offers partial json parsing / with streaming https://docs.rs/jiter/latest/jiter/. This has the feature of being able to parse incomplete JSON so we could chunk logs and use RANGE HTTP requests very efficiently without loading whole log in memory.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] AIP-84 | Get Logs - Improve the formatting of the content response [airflow]
Posted by "ashb (via GitHub)" <gi...@apache.org>.
ashb commented on issue #46657:
URL: https://github.com/apache/airflow/issues/46657#issuecomment-2664205949
I'm using a pydantic model to do the parsing now in [#46827](https://github.com/apache/airflow/pull/46827) (as that also converts time strings into dt objects for us) so that "should be fast as its using jiter under the hood"
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] AIP-84 | Get Logs - Improve the formatting of the content response [airflow]
Posted by "ashb (via GitHub)" <gi...@apache.org>.
ashb commented on issue #46657:
URL: https://github.com/apache/airflow/issues/46657#issuecomment-2651975697
Is it "realistic" to set the continuation token in a header? Could the UI read that?
It would be a lot less load to be able to pass the logs directly on without parsing+re-encoding if we could.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] AIP-84 | Get Logs - Improve the formatting of the content response [airflow]
Posted by "ashb (via GitHub)" <gi...@apache.org>.
ashb commented on issue #46657:
URL: https://github.com/apache/airflow/issues/46657#issuecomment-2654136460
> But the UI shouldn't have to rely on regex matching or looking for newline chars to try to interpret logs.
Yeah I agree with that. Though maybe it could look at the content type of the response: `text/plain` vs `application/x-ndjson` (not an "offical" mime type, but commonly used and that is the format logs themselves are in)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] AIP-84 | Get Logs - Improve the formatting of the content response [airflow]
Posted by "bbovenzi (via GitHub)" <gi...@apache.org>.
bbovenzi commented on issue #46657:
URL: https://github.com/apache/airflow/issues/46657#issuecomment-2654095743
I guess that's how it should work if you pass `accept: text/plain` in the request header. Which changing that header doesn't seem to change the API response at all.
Either way, the content response should either be JSON parsable or not. And the UI can then format the logs or simply render the text as-is. But the UI shouldn't have to rely on regex matching or looking for newline chars to try to interpret logs.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] AIP-84 | Get Logs - Improve the formatting of the content response [airflow]
Posted by "Lee-W (via GitHub)" <gi...@apache.org>.
Lee-W commented on issue #46657:
URL: https://github.com/apache/airflow/issues/46657#issuecomment-2662153809
I prefer using `application/x-ndjson` as well. 🤔
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] AIP-84 | Get Logs - Improve the formatting of the content response [airflow]
Posted by "Lee-W (via GitHub)" <gi...@apache.org>.
Lee-W commented on issue #46657:
URL: https://github.com/apache/airflow/issues/46657#issuecomment-2662233071
@bbovenzi would like to confirm what you think? Thanks!
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] AIP-84 | Get Logs - Improve the formatting of the content response [airflow]
Posted by "jason810496 (via GitHub)" <gi...@apache.org>.
jason810496 commented on issue #46657:
URL: https://github.com/apache/airflow/issues/46657#issuecomment-2668229238
> I am not too concerned about the speed - I am much more concerned about memory.
Hi @potiuk,
The Pydantic model that @ashb mentioned here is used for parsing per line, not for returning the entire log. Therefore, there won't be a significant difference compared to the current read log behavior.
I will resolve conflicts for my PR (#45079) once @ashb's change is merged.
---
After further review, I found that there is a **breaking change in the `_read` method**. Currently, 5 providers implement the `_read` interface, so a compatible interface is needed—perhaps something along these lines: ( The providers implemented `_read` method are also listed in the reference )
https://github.com/jason810496/airflow/blob/refactor/webserver-oom-for-large-log-read/airflow/utils/log/file_task_handler.py#L300-L336
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] AIP-84 | Get Logs - Improve the formatting of the content response [airflow]
Posted by "ashb (via GitHub)" <gi...@apache.org>.
ashb commented on issue #46657:
URL: https://github.com/apache/airflow/issues/46657#issuecomment-2653659416
>Are you suggesting that we pass the continuation token in the response header and then the body is just text?
That was my thought, yes.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] AIP-84 | Get Logs - Improve the formatting of the content response [airflow]
Posted by "ashb (via GitHub)" <gi...@apache.org>.
ashb commented on issue #46657:
URL: https://github.com/apache/airflow/issues/46657#issuecomment-2662768091
> Since application/json does not support streaming responses, using it could lead to OOM issues when serializing large logs.
@jason810496 This is correct, but the issue is that the logs endpoint currently has to load log files from multiple sources and interleave/sort them by date (worker, triggerer, scheduler can all produce logs for a TI) so it's not as stright forward as just "serve up this one file" sadly.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] AIP-84 | Get Logs - Improve the formatting of the content response [airflow]
Posted by "ashb (via GitHub)" <gi...@apache.org>.
ashb commented on issue #46657:
URL: https://github.com/apache/airflow/issues/46657#issuecomment-2662771898
The other issue with just streaming the resposne: we need to somehow give the UI a continuation token so that it can request the next chunk of logs.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] AIP-84 | Get Logs - Improve the formatting of the content response [airflow]
Posted by "jason810496 (via GitHub)" <gi...@apache.org>.
jason810496 commented on issue #46657:
URL: https://github.com/apache/airflow/issues/46657#issuecomment-2661428033
Hi, I'd be happy to work on this issue.
I have previously worked on a related issue:
[ [Resolve OOM When Reading Large Logs in Webserver] Refactor to Use K-Way Merge for Log Streams Instead of Sorting Entire Log Records #45129 ](https://github.com/apache/airflow/pull/45129) .
Additionally, I believe that `accept: text/plain` or `application/x-ndjson` would be more appropriate than `application/json` for the request header. Since `application/json` does not support **streaming** responses, using it could lead to OOM issues when serializing large logs.
To summarize, should we finalize the choice between `text/plain` and `application/x-ndjson` and also move the continuation token to a header as the acceptance criteria for this issue?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org