Created
August 28, 2015 17:10
-
-
Save wckdouglas/4490ebc279b63f4b23d6 to your computer and use it in GitHub Desktop.
Job simitting
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/env python | |
| import commands | |
| import glob | |
| import time | |
| import os | |
| import sys | |
| maxJobLim = 46 | |
| joblist = glob.glob('./job_*.sge') | |
| command = 'qstat | grep $USER |wc -l' | |
| p = commands.getstatusoutput(command) | |
| jobnum = int(p[1]) | |
| log = 'submittedList.txt' | |
| logging = open(log,'w') | |
| for i in range(len(joblist)): | |
| p = commands.getstatusoutput(command) | |
| jobnum = int(p[1]) | |
| logging.write('Current job number: %i\n' %jobnum) | |
| if jobnum < maxJobLim: | |
| submit = 'qsub %s ' %(joblist[i]) | |
| os.system(submit) | |
| logging.write('submitted: '+joblist[i]+'\n') | |
| else: | |
| while jobnum > maxJobLim: | |
| time.sleep(600) | |
| p = commands.getstatusoutput(command) | |
| jobnum = int(p[1]) | |
| submit = 'qsub %s ' %(joblist[i]) | |
| os.system(submit) | |
| logging.write('submitted: '+joblist[i]+'\n') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment