You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by GitBox <gi...@apache.org> on 2019/04/20 08:04:27 UTC

[GitHub] [airflow] potiuk commented on a change in pull request #5137: [AIRFLOW-4363] Add try-catch for retrieving `status` from cli in docker operator

potiuk commented on a change in pull request #5137: [AIRFLOW-4363] Add try-catch for retrieving `status` from cli in docker operator
URL: https://github.com/apache/airflow/pull/5137#discussion_r277127822
 
 

 ##########
 File path: airflow/operators/docker_operator.py
 ##########
 @@ -198,9 +198,21 @@ def execute(self, context):
         if self.force_pull or len(self.cli.images(name=self.image)) == 0:
             self.log.info('Pulling docker image %s', self.image)
             for l in self.cli.pull(self.image, stream=True):
-                output = json.loads(l.decode('utf-8').strip())
-                if 'status' in output:
-                    self.log.info("%s", output['status'])
+                try:
 
 Review comment:
   That's exactly the point. when you use decode=True, you get output as dictionaries already - there is no need to do json.loads(l.decode(... So you do not need try/catch at all and the whole code can be simplified.

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services