CMS 3D CMS Logo

Functions
cmsScimarkStop Namespace Reference

Functions

def main ()
 

Function Documentation

◆ main()

def cmsScimarkStop.main ( )

Definition at line 10 of file cmsScimarkStop.py.

10 def main():
11  #Use ps -ef to look for cmsScimarkLaunch processes
12  ps_stdouterr=subprocess.Popen("ps -efww|grep cmsScimarkLaunch|grep -v grep|grep -v 'sh -c'",shell=True,stdout=subprocess.PIPE, stderr=subprocess.STDOUT).stdout
13  if ps_stdouterr:
14  ps_lines=ps_stdouterr.readlines()
15  #print ps_lines
16  if ps_lines:
17  for line in ps_lines:
18  tokens=line.split()
19  #Look up the PID
20  PID=tokens[1]
21  #Look up the cpu core
22  core=tokens[9]
23  print("Found process:\n%s"%line[:-1]) #to eliminate the extra \n
24  #Kill the PID
25  print("Killing process with PID %s"%PID)
26  kill_stdouterr=subprocess.Popen("kill %s"%PID,shell=True,stdout=subprocess.PIPE, stderr=subprocess.STDOUT).stdout.read()
27  print(kill_stdouterr)
28  #Harvest the cmsScimark scores
29  #Look for the cmsScimark log:
30  if os.path.exists("cmsScimark_%s.log"%core):
31  #Create the results dir
32  mkdir_stdouterr=subprocess.Popen("mkdir cmsScimarkResults_cpu%s"%core,shell=True,stdout=subprocess.PIPE, stderr=subprocess.STDOUT).stdout.read()
33  print(mkdir_stdouterr)
34  #Execute the harvesting scrip cmsScimarkParser.py (it is in the release)
35  harvest_stdouterr=subprocess.Popen("cmsScimarkParser.py -i cmsScimark_%s.log -o cmsScimarkResults_cpu%s"%(core,core),shell=True,stdout=subprocess.PIPE, stderr=subprocess.STDOUT).stdout.read()
36  print(harvest_stdouterr)
37  else:
38  print("No cmsScimark_%s.log file was found for cpu%s, log might be in another directory!"%(core,core))
39  else:
40  print("No cmsScimarkLaunch processes found in the ps -ef output")
41  return 0
42 

References print().

cmsScimarkStop.main
def main()
Definition: cmsScimarkStop.py:10
print
void print(TMatrixD &m, const char *label=nullptr, bool mathematicaFormat=false)
Definition: Utilities.cc:46