00011 :
00012 exitcode=0
00013
00014 cmsScimarkStop.main()
00015
00016
00017 scripts=['cmsPerfSuite.py',
00018 'cmsRelvalreportInput.py',
00019 'cmsRelvalreport.py',
00020 'cmsDriver.py',
00021 'cmsRun',
00022 'cmsScimark2',
00023 'cmsIgProf_Analysis.py',
00024 'igprof-analyse',
00025 'perfreport'
00026 ]
00027
00028
00029 print "Looking for processes by user %s"%user
00030 checkProcesses=subprocess.Popen("ps -efww|grep %s"%user,bufsize=4096,shell=True,stdout=subprocess.PIPE,stderr=subprocess.STDOUT)
00031 for line in checkProcesses.stdout:
00032 for executable in scripts:
00033
00034 if executable in line:
00035 print "Found process %s"%line
00036 print "Killing it!"
00037 PID=line.split()[1]
00038 kill_stdouterr=subprocess.Popen("kill %s"%PID,shell=True,stdout=subprocess.PIPE, stderr=subprocess.STDOUT).stdout.read()
00039 print kill_stdouterr
00040
00041
00042 i=0
00043 while i<100:
00044 exitcode=0
00045 checkProcesses=subprocess.Popen("ps -efww|grep %s"%user,bufsize=4096,shell=True,stdout=subprocess.PIPE,stderr=subprocess.STDOUT)
00046 for line in checkProcesses.stdout:
00047 for executable in scripts:
00048 if executable in line:
00049 print "Something funny going on! It seems I could not kill process:\n%s"%line
00050 print "SORRY!"
00051 exitcode=-1
00052 if exitcode>=0:
00053 print "Finally killed all jobs!"
00054 break
00055 i+=1
00056 time.sleep(2)
00057
00058 return exitcode