kpathak13 commented on a change in pull request #5356: [AIRFLOW-4363] Fix Json
encoding error when retrieving `status` from cli in docker operator
URL: https://github.com/apache/airflow/pull/5356#discussion_r296028365
##########
File path: airflow/operators/docker_operator.py
##########
@@ -198,7 +198,7 @@ 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):
+ for l in self.cli.pull(self.image, stream=True, decode=True):
output = json.loads(l.decode('utf-8').strip())
Review comment:
```suggestion
if self.force_pull:
ignore = ["Downloading", "Extracting", "Waiting"]
self.log.info('Force pulling docker image %s', self.image)
for output in self.cli.pull(self.image, stream=True,
decode=True):
if 'status' in output and not any(w in output['status'] for
w in ignore):
self.log.info("%s", output['status'])
```
----------------------------------------------------------------
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:
[email protected]
With regards,
Apache Git Services