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 2020/04/22 01:36:54 UTC

[GitHub] [airflow] retornam commented on a change in pull request #8287: [AIRFLOW-4363] Fix JSON encoding error

retornam commented on a change in pull request #8287:
URL: https://github.com/apache/airflow/pull/8287#discussion_r412605062



##########
File path: airflow/providers/docker/operators/docker.py
##########
@@ -280,9 +279,10 @@ def execute(self, context):
         # Pull the docker image if `force_pull` is set or image does not exist locally
         if self.force_pull or not self.cli.images(name=self.image):
             self.log.info('Pulling docker image %s', self.image)
-            for line in self.cli.pull(self.image, stream=True, decode=True):
-                output = json.loads(line.decode('utf-8').strip())
-                if 'status' in output:
+            for output in self.cli.pull(self.image, stream=True, decode=True):
+                if isinstance(output, str):
+                    self.log.info("%s", output)
+                if isinstance(output, dict) and 'status' in output:

Review comment:
       The docker api docs aren't clear if it will only return a dict / a string. I added the string check  just in case that happens. 




----------------------------------------------------------------
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