You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by bb...@apache.org on 2023/03/01 15:44:06 UTC
[airflow] branch main updated: Lazy load Task Instance logs in UI (#29827)
This is an automated email from the ASF dual-hosted git repository.
bbovenzi pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/airflow.git
The following commit(s) were added to refs/heads/main by this push:
new 16977975eb Lazy load Task Instance logs in UI (#29827)
16977975eb is described below
commit 16977975eb7a61aa17e4b9ef1ed2e9aa4a8163d9
Author: MichaĆ Konarski <95...@users.noreply.github.com>
AuthorDate: Wed Mar 1 16:43:37 2023 +0100
Lazy load Task Instance logs in UI (#29827)
Task instance logs were previously eagerly loaded, which I believe wasn't
done intentionally. This commit chages the behaviour - now TI's previous
attempts logs are loaded lazily only after clicking on their tab.
---
airflow/www/static/js/ti_log.js | 21 +++++++++------------
1 file changed, 9 insertions(+), 12 deletions(-)
diff --git a/airflow/www/static/js/ti_log.js b/airflow/www/static/js/ti_log.js
index d884e296aa..d2e223b103 100644
--- a/airflow/www/static/js/ti_log.js
+++ b/airflow/www/static/js/ti_log.js
@@ -183,22 +183,19 @@ function setDownloadUrl(tryNumber) {
}
$(document).ready(() => {
- // Lazily load all past task instance logs.
- // TODO: We only need to have recursive queries for
- // latest running task instances. Currently it does not
- // work well with ElasticSearch because ES query only
- // returns at most 10k documents. We want the ability
- // to display all logs in the front-end.
- // An optimization here is to render from latest attempt.
- for (let i = TOTAL_ATTEMPTS; i >= 1; i -= 1) {
- // Only autoTailing the page when streaming the latest attempt.
- const autoTailing = i === TOTAL_ATTEMPTS;
- autoTailingLog(i, null, autoTailing);
- }
+ // Automatically load logs for the latest attempt
+ autoTailingLog(TOTAL_ATTEMPTS, null, true);
setDownloadUrl();
$("#ti_log_try_number_list a").click(function () {
const tryNumber = $(this).data("try-number");
+
+ // Load logs if not yet loaded for a given attempt
+ if (tryNumber !== TOTAL_ATTEMPTS && !$(this).data("loaded")) {
+ $(this).data("loaded", true);
+ autoTailingLog(tryNumber, null, false);
+ }
+
setDownloadUrl(tryNumber);
});
});