Skip to content

Instantly share code, notes, and snippets.

@acadien
Last active August 29, 2015 14:04
Show Gist options
  • Save acadien/112cd4ccb2e9264b51c0 to your computer and use it in GitHub Desktop.
Save acadien/112cd4ccb2e9264b51c0 to your computer and use it in GitHub Desktop.
#!/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)
@acadien
Copy link
Author

acadien commented Aug 4, 2014

todo: add proper argument parsing to handle timing or queues or what have you...

@calewis
Copy link

calewis commented Aug 4, 2014

Should Add -O for rename

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment