Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions superset/commands/report/execute.py
Original file line number Diff line number Diff line change
Expand Up @@ -507,6 +507,7 @@ def _get_log_data(self) -> HeaderDataType:
"dashboard_id": dashboard_id,
"owners": self._report_schedule.owners,
"slack_channels": slack_channels,
"execution_id": str(self._execution_id),
}
return log_data

Expand Down
6 changes: 5 additions & 1 deletion superset/reports/notifications/email.py
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,11 @@ def send(self) -> None:
header_data=content.header_data,
)
logger.info(
"Report sent to email, notification content is %s", content.header_data
"Report sent to email, task_id: %s, notification content is %s",
content.header_data.get("execution_id")
if content.header_data
else None,
content.header_data,
)
except SupersetErrorsException as ex:
raise NotificationError(
Expand Down
1 change: 1 addition & 0 deletions superset/utils/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,7 @@ class HeaderDataType(TypedDict):
chart_id: int | None
dashboard_id: int | None
slack_channels: list[str] | None
execution_id: str | None


class DatasourceDict(TypedDict):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,4 +117,4 @@ def test_report_with_header_data(
assert header_data.get("notification_format") == report_schedule.report_format
assert header_data.get("notification_source") == ReportSourceFormat.DASHBOARD
assert header_data.get("notification_type") == report_schedule.type
assert len(send_email_smtp_mock.call_args.kwargs["header_data"]) == 7
assert len(send_email_smtp_mock.call_args.kwargs["header_data"]) == 8
6 changes: 6 additions & 0 deletions tests/unit_tests/commands/report/execute_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ def test_log_data_with_chart(mocker: MockerFixture) -> None:
"dashboard_id": None,
"owners": [1, 2],
"slack_channels": None,
"execution_id": "execution_id_example",
}

assert result == expected_result
Expand Down Expand Up @@ -94,6 +95,7 @@ def test_log_data_with_dashboard(mocker: MockerFixture) -> None:
"dashboard_id": 123,
"owners": [1, 2],
"slack_channels": None,
"execution_id": "execution_id_example",
}

assert result == expected_result
Expand Down Expand Up @@ -128,6 +130,7 @@ def test_log_data_with_email_recipients(mocker: MockerFixture) -> None:
"dashboard_id": 123,
"owners": [1, 2],
"slack_channels": [],
"execution_id": "execution_id_example",
}

assert result == expected_result
Expand Down Expand Up @@ -162,6 +165,7 @@ def test_log_data_with_slack_recipients(mocker: MockerFixture) -> None:
"dashboard_id": 123,
"owners": [1, 2],
"slack_channels": ["channel_1", "channel_2"],
"execution_id": "execution_id_example",
}

assert result == expected_result
Expand Down Expand Up @@ -195,6 +199,7 @@ def test_log_data_no_owners(mocker: MockerFixture) -> None:
"dashboard_id": 123,
"owners": [],
"slack_channels": ["channel_1", "channel_2"],
"execution_id": "execution_id_example",
}

assert result == expected_result
Expand Down Expand Up @@ -230,6 +235,7 @@ def test_log_data_with_missing_values(mocker: MockerFixture) -> None:
"dashboard_id": None,
"owners": [1, 2],
"slack_channels": ["channel_1", "channel_2"],
"execution_id": "execution_id_example",
}

assert result == expected_result
Expand Down
2 changes: 2 additions & 0 deletions tests/unit_tests/reports/notifications/email_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ def test_render_description_with_html() -> None:
"chart_id": None,
"dashboard_id": None,
"slack_channels": None,
"execution_id": "test-execution-id",
},
)
email_body = (
Expand Down Expand Up @@ -91,6 +92,7 @@ def test_email_subject_with_datetime() -> None:
"chart_id": None,
"dashboard_id": None,
"slack_channels": None,
"execution_id": "test-execution-id",
},
)
subject = EmailNotification(
Expand Down
1 change: 1 addition & 0 deletions tests/unit_tests/reports/notifications/slack_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ def mock_header_data() -> HeaderDataType:
"chart_id": None,
"dashboard_id": None,
"slack_channels": ["some_channel"],
"execution_id": "test-execution-id",
}


Expand Down
Loading