def qsub_cmd_gen(template, job_name, i, sid, fODF, im, data_path,
                 cmd_file_path=cmd_file_path, python_path=python_path,
                 bashcmd=bashcmd, mem=25):
    reload(template)
    template = sge.getsourcelines(template)[0]

    # Name the job and generate the parameters for each job
    if job_name[0:2] != "im":
        params_dict = dict(i=i, sid=sid, fODF=fODF, im=im,
                        data_path=data_path)
        name = '%s_%s_%s%s'%(job_name,fODF,shorthand_im,i)
    else:
        params_dict = dict(i=i, sid=sid, im=im,
                        data_path=data_path)
        name = '%s_%s%s'%(job_name,shorthand_im,i)

    code = sge.add_params(template,params_dict)
    cmd_file = os.path.join(cmd_file_path, '%s.py'%name)
    print("Generating: %s"%cmd_file)

    sge.py_cmd(ssh,
               code,
               file_name=cmd_file,
               python=python_path)

    cmd_file = os.path.join(cmd_file_path, '%s.py'%name)
    batch_sge.append(sge.qsub_cmd(
        '%s %s'%(bashcmd, cmd_file), name, mem_usage=mem))
import os
import nibabel as ni
import numpy as np
import osmosis.io as oio
from osmosis.parallel import sge

import osmosis.parallel.kfold_xval_precision_template as mb_template
reload(mb_template)
template = sge.getsourcelines(mb_template)[0]

ssh = sge.SSH(hostname='proclus.stanford.edu', username='******', port=22)

batch_sge = []
for i in np.arange(65):
    params_dict = dict(i=i)
    code = sge.add_params(template, params_dict)
    name = 'kfold_xval_sph_cc_m%s' % (i)
    cmd_file = '/home/klchan13/pycmd/%s.py' % name
    print("Generating: %s" % cmd_file)

    sge.py_cmd(ssh,
               code,
               file_name=cmd_file,
               python='/home/klchan13/anaconda/bin/python')

    cmd_file = '/home/klchan13/pycmd/%s.py' % name
    batch_sge.append(
        sge.qsub_cmd('/home/klchan13/bashcmd.sh %s' % cmd_file,
                     name,
                     email='*****@*****.**'))
Exemplo n.º 3
0
import nibabel as ni
import numpy as np
import osmosis.io as oio
from osmosis.parallel import sge

import osmosis.parallel.mb_predict_template_smm as mb_template
reload(mb_template)
template = sge.getsourcelines(mb_template)[0]


ssh = sge.SSH(hostname='proclus.stanford.edu',username='******', port=22)

batch_sge = []
for i in range(65): 
    params_dict = dict(i=i)
    code = sge.add_params(template,params_dict)
    name = 'multi_bi_exp_rs%s'%(i)
    cmd_file = '/home/klchan13/pycmd/%s.py'%name
    print("Generating: %s"%cmd_file)
                        
    sge.py_cmd(ssh,
               code,
               file_name=cmd_file,
               python='/home/klchan13/anaconda/bin/python')

    cmd_file = '/home/klchan13/pycmd/%s.py'%name
    batch_sge.append(sge.qsub_cmd(
        '/home/klchan13/bashcmd.sh %s'%cmd_file,name))

# Add some header stuff:
batch_sge = ['#!/bin/bash'] + batch_sge