File indexing completed on 2024-04-06 12:32:56
0001
0002
0003
0004
0005
0006
0007 from __future__ import print_function
0008 import subprocess,os,sys
0009
0010 def main():
0011
0012 ps_stdouterr=subprocess.Popen("ps -efww|grep cmsScimarkLaunch|grep -v grep|grep -v 'sh -c'",shell=True,stdout=subprocess.PIPE, stderr=subprocess.STDOUT).stdout
0013 if ps_stdouterr:
0014 ps_lines=ps_stdouterr.readlines()
0015
0016 if ps_lines:
0017 for line in ps_lines:
0018 tokens=line.split()
0019
0020 PID=tokens[1]
0021
0022 core=tokens[9]
0023 print("Found process:\n%s"%line[:-1])
0024
0025 print("Killing process with PID %s"%PID)
0026 kill_stdouterr=subprocess.Popen("kill %s"%PID,shell=True,stdout=subprocess.PIPE, stderr=subprocess.STDOUT).stdout.read()
0027 print(kill_stdouterr)
0028
0029
0030 if os.path.exists("cmsScimark_%s.log"%core):
0031
0032 mkdir_stdouterr=subprocess.Popen("mkdir cmsScimarkResults_cpu%s"%core,shell=True,stdout=subprocess.PIPE, stderr=subprocess.STDOUT).stdout.read()
0033 print(mkdir_stdouterr)
0034
0035 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()
0036 print(harvest_stdouterr)
0037 else:
0038 print("No cmsScimark_%s.log file was found for cpu%s, log might be in another directory!"%(core,core))
0039 else:
0040 print("No cmsScimarkLaunch processes found in the ps -ef output")
0041 return 0
0042
0043 if __name__ == "__main__":
0044 sys.exit(main())