Skip to content

Commit

Permalink
[HLT] [PY3] Fix needed for python3: Use of subprocess instead of comm…
Browse files Browse the repository at this point in the history
…ands
  • Loading branch information
smuzaffar committed Oct 25, 2021
1 parent 5240778 commit e302d99
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 15 deletions.
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

0 comments on commit e302d99

Please sign in to comment.