# cluster_utils.py can be found here: https://gist.github.com/wasade/7047486 %run cluster_utils.ipy ### uncomment to toss existing saved environment # drop_env() if recover(): recover_env() print "Recovered environment. If you had running jobs that you'd like to recover monitoring on, please execute 'recover_jobs()'" else: create_env("awesome") # submission wrapper submit = lambda cmd: submit_qsub(cmd, job_name=prj_name, queue='memroute', extra_args='-l pvmem=8gb') # Some example commands to use some_commands = {'Hostname':'sleep %(delay)d; hostname', 'My Favorite Script':'print_qiime_config.py', 'Workflow':"sleep %(delay)d; echo 'sleep %(delay)d; hostname' | qsub -k oe -N %(prefix)s"} # note, outer quotes need to be " jobs = [submit(some_commands['Hostname'] % {'delay':i}) for i in range(30,50)] res = wait_on(jobs) awesome_prefix = 'ipynb_ex' register_items(awesome_prefix=awesome_prefix) # maintain this variable if the session dies # submit 5 jobs, each of which submit one more jobs = [submit(some_commands['Workflow'] % {'delay':i, 'prefix':'_'.join([awesome_prefix, str(i)])}) for i in range(10,15)] res = wait_on(jobs, additional_prefix=awesome_prefix) for j in res: print job_run_details(*j)