Skip to content

Commit

Permalink
Merge pull request #37208 from iarspider/patch-4
Browse files Browse the repository at this point in the history
edmPickEvents improvements
  • Loading branch information
cmsbuild committed Mar 15, 2022
2 parents a521db3 + ee6037b commit 84df093
Showing 1 changed file with 24 additions and 8 deletions.
32 changes: 24 additions & 8 deletions PhysicsTools/Utilities/scripts/edmPickEvents.py
Expand Up @@ -124,15 +124,31 @@ def getFileNames_dasgoclient(event):
cmd = ['dasgoclient', '-query', query, '-json']
proc = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
files = []
err = proc.stderr.read()
if err:
print("DAS error: %s" % err)
try:
out, err = proc.communicate(timeout=15)
except TimeoutExpired:
proc.kill()
out, err = proc.communicate()
exit_code = proc.returncode
if err or (exit_code != 0):
print("DAS query error: return code {0}\n--- Standard output---".format(exit_code))
print(out.decode('utf8'))
print("--- Standard error---")
print(err.decode('utf8'))
print("--- End ---")
exit(1)
else:
for row in json.load(proc.stdout):
for rec in row.get('file', []):
fname = rec.get('name', '')
if fname:
files.append(fname)
try:
for row in json.loads(out):
for rec in row.get('file', []):
fname = rec.get('name', '')
if fname:
files.append(fname)
except json.decoder.JSONDecodeError:
print("dasgoclient returned invalid JSON:")
print(out.decode('utf8'))
print("--- End ---")
exit(1)
return files

def fullCPMpath():
Expand Down

0 comments on commit 84df093

Please sign in to comment.