Exemplo n.º 1
0
def main():
    options,args = parser.parse_args(sys.argv[1:])

    if len(args) < 2:
        parser.print_help()
        sys.exit(45)

    run=args[0]
    ftype=args[1]
    nprocess=int(options.nprocess)


    nodes,ppn=get_specification(nprocess)

    conf = files.read_config(run)

    cmd=get_cmd(ftype,options)

    sdir = files.get_script_dir(run=run, ftype=ftype)
    if not os.path.exists(sdir):
        os.makedirs(sdir)

    write_pbs_all(run,ftype,nodes,ppn)

    for psfnum in files.PSFNUMS:
        for shnum in files.SHNUMS:
            write_pbs(run,ftype,psfnum,shnum)
            for ccd in files.CCDS:
                if options.pbs1:
                    write_pbs1(run,ftype,psfnum,shnum,ccd,cmd,
                               options.walltime1,options.vers,
                               options.nobuffer)
                else:
                    write_script(run,ftype,psfnum,shnum,ccd,cmd,options.vers,
                                 options.nobuffer)
Exemplo n.º 2
0
 def __init__(self, run, **keys):
     self.run=run
     self.conf=files.read_config(self.run)
Exemplo n.º 3
0
def main():
    options, args = parser.parse_args(sys.argv[1:])

    if len(args) < 2:
        parser.print_help()
        sys.exit(45)

    run = args[0]
    ftype = args[1]

    conf = files.read_config(run)

    cmd = get_cmd(ftype, options)

    groups = ""
    if options.groups is not None:
        groups = "group: [%s]" % options.groups
    notgroups = ""
    if options.notgroups is not None:
        notgroups = "notgroup: [%s]" % options.notgroups

    wqd = files.get_wq_dir(run=run, ftype=ftype)
    if not os.path.exists(wqd):
        os.makedirs(wqd)

    for psfnum in files.PSFNUMS:
        for shnum in files.SHNUMS:
            if options.byexp:
                wqfile = files.get_wq_path(run=run, psfnum=psfnum, shnum=shnum, ftype=ftype)
                job_name = "%s-p%s-s%s-%s" % (run, psfnum, shnum, ftype)

                print "writing:", wqfile
                with open(wqfile, "w") as fobj:
                    d = {
                        "job_name": job_name,
                        "cmd": cmd,
                        "run": run,
                        "psfnum": psfnum,
                        "shnum": shnum,
                        "groups": groups,
                        "notgroups": notgroups,
                        "vers": options.vers,
                        "pri": options.priority,
                    }

                    text = _wqtemplate_byexp % d
                    fobj.write(text)

            else:
                for ccd in files.CCDS:
                    wqfile = files.get_wq_path(run=run, psfnum=psfnum, shnum=shnum, ccd=ccd, ftype=ftype)
                    job_name = "%s-p%s-s%s-%02d-%s" % (run, psfnum, shnum, ccd, ftype)

                    print "writing:", wqfile
                    with open(wqfile, "w") as fobj:
                        d = {
                            "job_name": job_name,
                            "cmd": cmd,
                            "run": run,
                            "psfnum": psfnum,
                            "shnum": shnum,
                            "ccd": ccd,
                            "groups": groups,
                            "notgroups": notgroups,
                            "vers": options.vers,
                            "pri": options.priority,
                        }

                        text = _wqtemplate_byccd % d
                        fobj.write(text)