Skip to content
This repository has been archived by the owner on Jan 22, 2025. It is now read-only.

Commit

Permalink
Merge pull request #234 from girder/logging-bad-list-cli
Browse files Browse the repository at this point in the history
Improve logging when list_cli fails
  • Loading branch information
manthey authored May 30, 2024
2 parents 21b9fd0 + 7b9f1f3 commit 852f877
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
13 changes: 9 additions & 4 deletions slicer_cli_web/image_job.py
Original file line number Diff line number Diff line change
Expand Up @@ -298,10 +298,15 @@ def getCliData(name, client, job):
cli_dict = getDockerOutput(name, '--list_cli', client)
# contains nested dict
# {<cliname>:{type:<type>}}
if isinstance(cli_dict, bytes):
cli_dict = cli_dict.decode('utf8')
cli_dict = json.loads(cli_dict)

try:
if isinstance(cli_dict, bytes):
cli_dict = cli_dict.decode('utf8')
cli_dict = json.loads(cli_dict)
except Exception:
job = Job().updateJob(
job,
log='Failed to parse cli list. Output of list_cli was\n%r\n' % cli_dict)
raise
for key, info in cli_dict.items():
desc_type = info.get('desc-type', 'xml')
cli_desc = getDockerOutput(name, [key, f'--{desc_type}'], client)
Expand Down
2 changes: 1 addition & 1 deletion slicer_cli_web/models/exceptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ def __str__(self):
if isinstance(self.imageName, list):
return self.message + ' (image names [' + ','.join(self.imageName) + '])'
elif isinstance(self.imageName, str):
return self.message + ' (image name: ' + self.imageName + ' )'
return self.message + ' (image name: ' + self.imageName + ')'
else:
return self.message

Expand Down

0 comments on commit 852f877

Please sign in to comment.