hredestig commented on a change in pull request #6552: AIRFLOW-5850: Capture task logs in DockerSwarmOperator URL: https://github.com/apache/airflow/pull/6552#discussion_r345737656
########## File path: airflow/contrib/operators/docker_swarm_operator.py ########## @@ -127,7 +133,37 @@ def _run_image(self): # wait for the service to start the task while not self.cli.tasks(filters={'service': self.service['ID']}): continue + + logs = self.cli.service_logs(self.service['ID'], follow=True, stdout=True, stderr=True, is_tty=self.tty) + line = '' + _stream_logs = self.enable_logging # Status of the service_logs' generator while True: + if self.enable_logging: + while _stream_logs: + try: + log = next(logs) + # TODO: Remove this clause once https://github.com/docker/docker-py/issues/931 is fixed + except (requests.exceptions.ConnectionError) as e: Review comment: `except requests.exceptions.ConnectionError` ---------------------------------------------------------------- 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. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services