[GitHub] [airflow] mik-laj commented on a change in pull request #6552: [AIRFLOW-5850] Capture task logs in DockerSwarmOperator

2020-04-07 Thread GitBox
mik-laj commented on a change in pull request #6552: [AIRFLOW-5850] Capture 
task logs in DockerSwarmOperator
URL: https://github.com/apache/airflow/pull/6552#discussion_r405246084
 
 

 ##
 File path: airflow/providers/docker/operators/docker_swarm.py
 ##
 @@ -123,11 +129,43 @@ def _run_image(self):
 
 self.log.info('Service started: %s', str(self.service))
 
-status = None
 # wait for the service to start the task
 while not self.cli.tasks(filters={'service': self.service['ID']}):
 continue
-while True:
+
+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:  # pylint: disable=too-many-nested-blocks
+if self.enable_logging:
 
 Review comment:
   Thank you very much for this change. The code looks much better now.


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


[GitHub] [airflow] mik-laj commented on a change in pull request #6552: [AIRFLOW-5850] Capture task logs in DockerSwarmOperator

2020-01-27 Thread GitBox
mik-laj commented on a change in pull request #6552: [AIRFLOW-5850] Capture 
task logs in DockerSwarmOperator
URL: https://github.com/apache/airflow/pull/6552#discussion_r371165897
 
 

 ##
 File path: airflow/providers/docker/operators/docker_swarm.py
 ##
 @@ -123,11 +129,43 @@ def _run_image(self):
 
 self.log.info('Service started: %s', str(self.service))
 
-status = None
 # wait for the service to start the task
 while not self.cli.tasks(filters={'service': self.service['ID']}):
 continue
-while True:
+
+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:  # pylint: disable=too-many-nested-blocks
+if self.enable_logging:
 
 Review comment:
   Why do we need so many nested blocks?  Can you also create a new method that 
will not be performed when self.enable_logging == False?  When 
self.enable_logging = False, it is not necessary to call 
`self.cli.service_logs` also.
   
   


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