jason810496 commented on code in PR #56043:
URL: https://github.com/apache/airflow/pull/56043#discussion_r2380751137
##########
providers/docker/src/airflow/providers/docker/operators/docker_swarm.py:
##########
@@ -218,9 +218,8 @@ def _run_service(self) -> None:
if self.service and self._service_status() == "complete":
self.tasks = self.cli.tasks(filters={"service":
self.service["ID"]})
for task in self.tasks:
- container_id = task["Status"]["ContainerStatus"]["ContainerID"]
- container = self.cli.inspect_container(container_id)
- self.containers.append(container)
+ docker_service = self.cli.inspect_service(task["ServiceID"])
+ self.containers.append(docker_service)
Review Comment:
Would it be better to check the key for better compatibility?
```suggestion
if "ServiceID" in task:
docker_service = self.cli.inspect_service(task["ServiceID"])
self.containers.append(docker_service)
elif "Status" in task and "ContainerStatus" in task["Status"]:
container_id = task["Status"]["ContainerStatus"]["ContainerID"]
container = self.cli.inspect_container(container_id)
self.containers.append(container)
```
--
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]