CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Functions
cmsScimarkStop Namespace Reference

Functions

def main
 

Function Documentation

def cmsScimarkStop.main ( )

Definition at line 10 of file cmsScimarkStop.py.

References print().

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