-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix das query #31
base: master
Are you sure you want to change the base?
fix das query #31
Conversation
@@ -10,8 +10,12 @@ def do_das_query(query): | |||
Execute das_client for the specified query, and return parsed JSON output | |||
""" | |||
|
|||
args = ['dasgoclient', '-json', '-format', 'json', '--query', query] | |||
result = subprocess.check_output(args) | |||
args = ['dasgoclient', '--format', 'json', '--query', query] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
according to dasgoclient -h
,
-format string
Compatibility option with python das_client, use json to get das_client behavior
so I would default to -json
- but the output is not identical: -json
gives just the ["data"]
part of the -format json
. The code that uses it is easy to adjust (actually it gets simpler), but the check in https://github.com/cp3-llbb/SAMADhi/pull/31/files#diff-e068c93f5ddd6d675874177f3be1ef45L58 , should become a simple if len(summary_results) > 1
then, I think.
try: | ||
result = subprocess.check_output(args) | ||
except subprocess.CalledProcessError as exc: | ||
result = exc.output |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it's safer to print a message that the query failed and exit, rather than work with the output of a failed query
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a few details... see the comments
Thanks a lot, dasgoclient is failing again, hoping it's a temporary problem I'll fix this tomorrow... |
Going through the list of open PRs: is this change still needed? If yes, could you address the review comments? If not we may close it. |
According to Valentin Y Kuznetsov (cms computing tools expert):
Also, are we keeping the exception block? If we don't want to, this is anyway to bear in mind in case of return codes different from zero...