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
Original file line number Diff line number Diff line change
Expand Up @@ -517,7 +517,7 @@ def execute(self, context):
if self.reattach:
# Generate deterministic UUID which refers to unique TaskInstanceKey
ti: TaskInstance = context["ti"]
self._started_by = generate_uuid(*map(str, ti.key.primary))
self._started_by = generate_uuid(*map(str, [ti.dag_id, ti.task_id, ti.run_id, ti.map_index]))
self.log.info("Try to find run with startedBy=%r", self._started_by)
self._try_reattach_task(started_by=self._started_by)

Expand Down
1 change: 1 addition & 0 deletions providers/amazon/tests/system/amazon/aws/example_ecs.py
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,7 @@ def clean_logs(group_name: str):
# [START howto_operator_ecs_run_task]
run_task = EcsRunTaskOperator(
task_id="run_task",
reattach=True,
cluster=existing_cluster_name,
task_definition=register_task.output,
overrides={
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -622,6 +622,10 @@ def test_reattach_successful(
"""Test reattach on first running Task ARN."""
mock_ti = mock.MagicMock(name="MockedTaskInstance")
mock_ti.key.primary = ("mock_dag", "mock_ti", "mock_runid", 42)
mock_ti.dag_id = "mock_dag"
mock_ti.task_id = "mock_ti"
mock_ti.run_id = "mock_runid"
mock_ti.map_index = 42
fake_uuid = "01-02-03-04"
uuid_mock.return_value = fake_uuid

Expand Down