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 2022/08/09 16:28:22 UTC
[airflow] branch main updated: Add auto refresh to grid logs (#25621)
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 c954ce2126 Add auto refresh to grid logs (#25621)
c954ce2126 is described below
commit c954ce2126430ea3ebb56ac0a51a4762fb6d27c3
Author: pierrejeambrun <pi...@gmail.com>
AuthorDate: Tue Aug 9 18:28:14 2022 +0200
Add auto refresh to grid logs (#25621)
---
airflow/www/static/js/api/useTaskLog.tsx | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/airflow/www/static/js/api/useTaskLog.tsx b/airflow/www/static/js/api/useTaskLog.tsx
index b468c604af..43e7f957c2 100644
--- a/airflow/www/static/js/api/useTaskLog.tsx
+++ b/airflow/www/static/js/api/useTaskLog.tsx
@@ -19,6 +19,7 @@
import axios, { AxiosResponse } from 'axios';
import { useQuery } from 'react-query';
+import { useAutoRefresh } from 'src/context/autorefresh';
import { getMetaValue } from 'src/utils';
@@ -38,11 +39,14 @@ const useTaskLog = ({
url = taskLogApi.replace('_DAG_RUN_ID_', dagRunId).replace('_TASK_ID_', taskId).replace(/-1$/, taskTryNumber.toString());
}
+ const { isRefreshOn } = useAutoRefresh();
+
return useQuery(
['taskLogs', dagId, dagRunId, taskId, taskTryNumber, fullContent],
() => axios.get<AxiosResponse, string>(url, { headers: { Accept: 'text/plain' }, params: { full_content: fullContent } }),
{
placeholderData: '',
+ refetchInterval: isRefreshOn && (autoRefreshInterval || 1) * 1000,
},
);
};