00010 :
00011
00012 ps_stdouterr=subprocess.Popen("ps -efww|grep cmsScimarkLaunch|grep -v grep|grep -v 'sh -c'",shell=True,stdout=subprocess.PIPE, stderr=subprocess.STDOUT).stdout
00013 if ps_stdouterr:
00014 ps_lines=ps_stdouterr.readlines()
00015
00016 if ps_lines:
00017 for line in ps_lines:
00018 tokens=line.split()
00019
00020 PID=tokens[1]
00021
00022 core=tokens[9]
00023 print "Found process:\n%s"%line[:-1]
00024
00025 print "Killing process with PID %s"%PID
00026 kill_stdouterr=subprocess.Popen("kill %s"%PID,shell=True,stdout=subprocess.PIPE, stderr=subprocess.STDOUT).stdout.read()
00027 print kill_stdouterr
00028
00029
00030 if os.path.exists("cmsScimark_%s.log"%core):
00031
00032 mkdir_stdouterr=subprocess.Popen("mkdir cmsScimarkResults_cpu%s"%core,shell=True,stdout=subprocess.PIPE, stderr=subprocess.STDOUT).stdout.read()
00033 print mkdir_stdouterr
00034
00035 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()
00036 print harvest_stdouterr
00037 else:
00038 print "No cmsScimark_%s.log file was found for cpu%s, log might be in another directory!"%(core,core)
00039 else:
00040 print "No cmsScimarkLaunch processes found in the ps -ef output"
00041 return 0