From dcf6284b5f09368692fbeec4d479850baefe5678 Mon Sep 17 00:00:00 2001 From: Ash Berlin-Taylor Date: Thu, 7 Apr 2022 14:38:53 +0100 Subject: [PATCH] Correctly fetch logs for mapped task instances (#22818) We weren't passing the map_index param down to the server GitOrigin-RevId: 6f525e0a14e0da0992006b268865b58bad0959d2 --- airflow/www/static/js/ti_log.js | 7 +++++-- airflow/www/templates/airflow/ti_log.html | 1 + 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/airflow/www/static/js/ti_log.js b/airflow/www/static/js/ti_log.js index eac91e3cf3..919c42f9df 100644 --- a/airflow/www/static/js/ti_log.js +++ b/airflow/www/static/js/ti_log.js @@ -25,6 +25,7 @@ import { formatDateTime } from './datetime_utils'; const executionDate = getMetaValue('execution_date'); const dagId = getMetaValue('dag_id'); const taskId = getMetaValue('task_id'); +const mapIndex = getMetaValue('map_index'); const logsWithMetadataUrl = getMetaValue('logs_with_metadata_url'); const DELAY = parseInt(getMetaValue('delay'), 10); const AUTO_TAILING_OFFSET = parseInt(getMetaValue('auto_tailing_offset'), 10); @@ -60,8 +61,9 @@ window.scrollBottomLogs = scrollBottom; // Streaming log with auto-tailing. function autoTailingLog(tryNumber, metadata = null, autoTailing = false) { - console.debug(`Auto-tailing log for dag_id: ${dagId}, task_id: ${taskId}, \ - execution_date: ${executionDate}, try_number: ${tryNumber}, metadata: ${JSON.stringify(metadata)}`); + console.debug(`Auto-tailing log for dag_id: ${dagId}, task_id: ${taskId}, ` + + `execution_date: ${executionDate}, map_index: ${mapIndex}, try_number: ${tryNumber}, ` + + `metadata: ${JSON.stringify(metadata)}`); return Promise.resolve( $.ajax({ @@ -69,6 +71,7 @@ function autoTailingLog(tryNumber, metadata = null, autoTailing = false) { data: { dag_id: dagId, task_id: taskId, + map_index: mapIndex, execution_date: executionDate, try_number: tryNumber, metadata: JSON.stringify(metadata), diff --git a/airflow/www/templates/airflow/ti_log.html b/airflow/www/templates/airflow/ti_log.html index 734c16084e..6fbf1ea12e 100644 --- a/airflow/www/templates/airflow/ti_log.html +++ b/airflow/www/templates/airflow/ti_log.html @@ -23,6 +23,7 @@ {% block head_meta %} {{ super() }} + {# Time interval to wait before next log fetching. Default 2s. #}