00001
00002
00003 import os
00004 import sys
00005 import time
00006
00007 if(len(sys.argv)<2):
00008 print("example: checking_jobs.py tag [seconds]")
00009 sys.exit()
00010 else:
00011 tag = str(sys.argv[1])
00012
00013 if(len(sys.argv)==3):
00014 seconds = int(sys.argv[2])
00015 else:
00016 seconds = 60
00017
00018 os.system("qstat | grep " + tag + " > checking_jobs_" + tag + ".txt")
00019 while(os.path.getsize("checking_jobs_" + tag + ".txt") > 1):
00020 time.sleep(seconds)
00021 os.system("qstat | grep " + tag + " > checking_jobs_" + tag + ".txt")
00022 time.sleep(seconds)
00023 os.system("qstat | grep " + tag + " >> checking_jobs_" + tag + ".txt")
00024
00025 os.system("rm checking_jobs_" + tag + ".txt")
00026 print("Jobs tagged with \"" + tag + "\" are finished.")
00027 os.system("display ~/home/shell/sub/z.gif &")