Skip to content
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

migrate away from commands in das utility #26418

Merged
merged 2 commits into from Apr 10, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
10 changes: 6 additions & 4 deletions Utilities/General/python/cmssw_das_client.py
@@ -1,8 +1,8 @@
from commands import getstatusoutput
import time
import os
from json import loads, dumps
from types import GeneratorType
import subprocess

#Copied from das_client.py

Expand Down Expand Up @@ -79,6 +79,8 @@ def get_data(query, limit=None, threshold=None, idx=None, host=None, cmd=None):
if os.path.isfile(os.path.join(path, 'dasgoclient')):
cmd = "dasgoclient"
break
err, out = getstatusoutput("%s %s --query '%s'" % (cmd, cmd_opts, query))
if not err: return loads(out)
return {'status' : 'error', 'reason' : out}

p = subprocess.Popen("%s %s --query '%s'" % (cmd, cmd_opts, query),shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
stdout, stderr = p.communicate()
if not p.returncode: return loads(stdout)
return {'status' : 'error', 'reason' : stdout}