Example #1
0
def write_pbs1(run,ftype,psfnum,shnum,ccd,cmd,walltime,vers,nobuffer):
    sfile=files.get_script_path(run=run,psfnum=psfnum,shnum=shnum,
                                ccd=ccd,ftype=ftype)
    pbsfile=sfile.replace(".sh",".pbs")

    base=os.path.basename(pbsfile).replace('.pbs','')

    if nobuffer:
        python='python -u'
    else:
        python='python'

    print 'writing:',pbsfile
    with open(pbsfile,'w') as fobj:
        d={'python':python,
           'cmd':cmd,
           'vers':vers,
           'run':run, 
           'psfnum':psfnum,
           'shnum':shnum,
           'ccd':ccd,
           'base':base,
           'walltime':walltime}

        text=_pbs1_template % d
        fobj.write(text)
Example #2
0
def write_script(run,ftype,psfnum,shnum,ccd,cmd,vers,nobuffer):
    sfile=files.get_script_path(run=run,psfnum=psfnum,shnum=shnum,
                                ccd=ccd,ftype=ftype)

    logfile=sfile.replace('.sh','.out')

    if nobuffer:
        python='python -u'
    else:
        python='python'
    print 'writing:',sfile
    with open(sfile,'w') as fobj:
        d={'python':python,
           'cmd':cmd,
           'vers':vers,
           'run':run, 
           'psfnum':psfnum,
           'shnum':shnum,
           'ccd':ccd,
           'logfile':logfile}

        text=_template % d
        fobj.write(text)

    os.system('chmod u+x "%s"' % sfile)