o-nikolas commented on code in PR #29447:
URL: https://github.com/apache/airflow/pull/29447#discussion_r1146961565
##########
airflow/providers/amazon/aws/operators/ecs.py:
##########
@@ -471,39 +470,40 @@ def __init__(
self.awslogs_region = self.region
self.arn: str | None = None
+ self.started_by: str | None = None
+
self.retry_args = quota_retry
self.task_log_fetcher: EcsTaskLogFetcher | None = None
self.wait_for_completion = wait_for_completion
- @provide_session
- def execute(self, context, session=None):
+ def execute(self, context):
self.log.info(
"Running ECS Task - Task definition: %s - on cluster %s",
self.task_definition, self.cluster
)
self.log.info("EcsOperator overrides: %s", self.overrides)
if self.reattach:
- self._try_reattach_task(context)
+ # Generate deterministic UUID which refers to unique
TaskInstanceKey
+ ti: TaskInstance = context["ti"]
+ self.started_by = generate_uuid(*map(str, ti.key.primary))
+ if self.do_xcom_push:
+ ti.xcom_push("started_by", self.started_by)
Review Comment:
If the goal is to just allow the user to reference the statedby uuid, then I
think logging it and/or using an Operator extralink is much more user friendly
that putting it in XCOM.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]