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

[HLT] Fix needed for python3: Use of subprocess instead of commands #35817

Merged
merged 1 commit into from
Oct 26, 2021
Merged
Show file tree
Hide file tree
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
8 changes: 4 additions & 4 deletions HLTrigger/Tools/python/PDRates.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#! /usr/bin/env python
#! /usr/bin/env python3
from __future__ import print_function
import sys, imp
import os
import commands
import subprocess

from optparse import OptionParser

Expand Down Expand Up @@ -32,7 +32,7 @@ def PrimaryDatasets(Run):

dbs_cmd = """ dbs search --query='find primds.name
where run=%d and dataset like */RAW' """ % (Run)
rows = commands.getoutput(dbs_cmd)
rows = subprocess.getoutput(dbs_cmd)
lines = rows.split("\n")
j=0
print("\nThe primary datasets for this run are: \n")
Expand All @@ -52,7 +52,7 @@ def RateInPD(Run,PrimaryDataset,lsMin,lsMax,printLS=False):
where run=%d and dataset like /%s/*/RAW
and lumi >= %d and lumi <= %d
and file.status=VALID '""" % (Run, PrimaryDataset,lsMin, lsMax)
rows = commands.getoutput(dbs_cmd)
rows = subprocess.getoutput(dbs_cmd)
lines = rows.split("\n")
j=0
LumiSections = []
Expand Down
6 changes: 3 additions & 3 deletions HLTrigger/Tools/python/getHLTPrescaleColumns.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#!/usr/bin/env python
#!/usr/bin/env python3
from __future__ import print_function
from __future__ import absolute_import
from sys import stderr, exit
import commands
import subprocess

from optparse import OptionParser
parser = OptionParser(usage="usage: %prog [options] Trigger_Path")
Expand All @@ -22,7 +22,7 @@
def getPrescalesFromKey(key):
#stderr.write("\t%s ...\n" % key);
cmd = ( edmCfgFromDB +" --configName "+key + " | grep -i "+ path + " | tail -1 | awk ' $2 ==\"%s\" {print $NL}' " ) % path
res = commands.getoutput(cmd)
res = subprocess.getoutput(cmd)
res_split = res.split()
psMap = {}
aa=""
Expand Down
3 changes: 1 addition & 2 deletions HLTrigger/Tools/python/getHLTkey.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
#!/usr/bin/env python
#!/usr/bin/env python3
from __future__ import print_function
from __future__ import absolute_import
from sys import stderr, exit
import commands


#
Expand Down
6 changes: 3 additions & 3 deletions HLTrigger/Tools/python/getHLTprescales.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#!/usr/bin/env python
#!/usr/bin/env python3
from __future__ import print_function
from __future__ import absolute_import
from sys import stderr, exit
import commands
import subprocess

from optparse import OptionParser
parser = OptionParser(usage="usage: %prog [options] Trigger_Path")
Expand All @@ -22,7 +22,7 @@
def getPrescalesFromKey(key):
#stderr.write("\t%s ...\n" % key);
cmd = ( edmCfgFromDB +" --configName "+key + " | grep -i "+ path + " | tail -1 | awk ' $2 ==\"%s\" {print $NL}' " ) % path
res = commands.getoutput(cmd)
res = subprocess.getoutput(cmd)
res_split = res.split()
psCols = []
if len(res)>0:
Expand Down
6 changes: 3 additions & 3 deletions HLTrigger/Tools/python/makeHLTPrescaleTable.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#!/usr/bin/env python
#!/usr/bin/env python3
from __future__ import print_function
from __future__ import absolute_import
from sys import stderr, exit
import commands, os
import subprocess, os

from optparse import OptionParser
parser = OptionParser(usage=
Expand Down Expand Up @@ -69,7 +69,7 @@ def getProcessObjectFromConfDB(hlt_key):
# print >> stderr,"\t%s ..." % hlt_key
cmd = "edmConfigFromDB --orcoff --configName " + hlt_key
# print >> stderr, "cmd=",cmd
res = commands.getoutput(cmd)
res = subprocess.getoutput(cmd)

# potentially dangerous: we're running python code here
# which we get from an external process (confDB).
Expand Down