diff --git a/airflow/providers/amazon/aws/log/cloudwatch_task_handler.py b/airflow/providers/amazon/aws/log/cloudwatch_task_handler.py index 126ed3ea84f7b..b210715cd6974 100644 --- a/airflow/providers/amazon/aws/log/cloudwatch_task_handler.py +++ b/airflow/providers/amazon/aws/log/cloudwatch_task_handler.py @@ -96,15 +96,15 @@ def _render_filename(self, ti, try_number): # Replace unsupported log group name characters return super()._render_filename(ti, try_number).replace(":", "_") - def set_context(self, ti): + def set_context(self, ti: TaskInstance, *, identifier: str | None = None): super().set_context(ti) - self.json_serialize = conf.getimport("aws", "cloudwatch_task_handler_json_serializer") + _json_serialize = conf.getimport("aws", "cloudwatch_task_handler_json_serializer") self.handler = watchtower.CloudWatchLogHandler( log_group_name=self.log_group, log_stream_name=self._render_filename(ti, ti.try_number), use_queues=not getattr(ti, "is_trigger_log_context", False), boto3_client=self.hook.get_conn(), - json_serialize_default=self.json_serialize, + json_serialize_default=_json_serialize, ) def close(self):