Last active
August 29, 2015 14:04
-
-
Save acadien/112cd4ccb2e9264b51c0 to your computer and use it in GitHub Desktop.
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
#!/usr/bin/python | |
import sys,subprocess | |
#Simple code for starting jobs quick! Made for ATPESC 2014 | |
def usage(): | |
print "%s <directory/name> <# processors>"%(sys.argv[0]) | |
try: | |
job = str(sys.argv[1]) | |
nodes = int(sys.argv[2]) | |
except IndexError,ValueError: | |
usage() | |
exit(0) | |
outputFile="/".join(job.split("/")[:-1])+"/output" | |
subScriptName = "jobscript.sh" | |
jfile = open(subScriptName,"wa") | |
jfile.write("#!/bin/sh\nrunjob --block $COBALT_PARTNAME --np $(($COBALT_JOBSIZE*16)) --ranks-per-node 16 : %s"%job) | |
jfile.close() | |
command = "chmod a+x %s"%subScriptName | |
command = command.split() | |
subprocess.call(command) | |
command = "qsub --mode script -q Q.ATPESC -n %d -t 10 -o %s %s"%(nodes,outputFile,subScriptName) | |
command = command.split() | |
subprocess.call(command) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
todo: add proper argument parsing to handle timing or queues or what have you...