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/29 12:13:20 UTC

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

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



##########
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:
       According to this: https://docker-py.readthedocs.io/en/stable/api.html#docker.api.image.ImageApiMixin.pull:
   > decode (bool) – Decode the JSON data from the server into dicts. Only applies with stream=True
   




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