コード例 #1
0
    def run_simulation_with_PJ(self, sh_jobs_scripts):
        """
        running simulation from SWEEP dir using PJ
        """
        from qcg.pilotjob.api.job import Jobs
        jobs = Jobs()
        for sh_job_scripts in sh_jobs_scripts:
            sweep_dir_name = os.path.basename(os.path.dirname(sh_job_scripts))

            jobs.add(
                name="SWEEP_{}".format(sweep_dir_name),
                exec="bash",
                args=["-l", sh_job_scripts],
                stdout="{}/{}.stdout".format(os.path.dirname(sh_job_scripts),
                                             "${jname}__${uniq}"),
                stderr="{}/{}.stderr".format(os.path.dirname(sh_job_scripts),
                                             "${jname}__${uniq}"),
                numCores={"exact": self.cores},
                model="default")

            print("\nAdd job with :")
            print("name=SWEEP_{}".format(sweep_dir_name))
            print("args = [-l,{}]".format(sh_job_scripts))
            print("stdout = {}/{}.stdout".format(
                os.path.dirname(sh_job_scripts), "${jname}__${uniq}"))
            print("stderr = {}/{}.stderr".format(
                os.path.dirname(sh_job_scripts), "${jname}__${uniq}"))
            print("numCores=exact: {}".format(self.cores))

        ids = QCG_MANAGER.submit(jobs)
        # wait until submited jobs finish
        QCG_MANAGER.wait4(ids)

        print("\nAll new SWEEP dirs are finished...\n")
コード例 #2
0
ファイル: PJ.py プロジェクト: djgroen/FabFlee
for i in range(NUM_INSTANCES):
    for SUBMODEL in ['macro', 'micro']:
        cmd = '%s run_mscale.py --submodel %s --data_dir=%s --instance_index %d --coupling_type %s --num_instances %d --weather_coupling %s' % (
            PYTHON_CMD, SUBMODEL, DATA_DIR, INSTANCE_INDEX, COUPLING_TYPE,
            NUM_INSTANCES, WEATHER_COUPLING)

        print("\tAdd job with cmd = %s" % (cmd))

        TaskID = 'TaskID%d_%s' % (INSTANCE_INDEX + 1, SUBMODEL)
        stderr = 'log_task/%s_${jname}__${uniq}.stderr' % (TaskID)
        stdout = 'log_task/%s_${jname}__${uniq}.stdout' % (TaskID)

        jobs.add(name=TaskID,
                 exec='bash',
                 args=['-c', cmd],
                 stdout=stdout,
                 stderr=stderr,
                 numCores={'exact': INSTANCE_CORES},
                 model='default')
    INSTANCE_INDEX = INSTANCE_INDEX + 1

ids = m.submit(jobs)

# wait until submited jobs finish
m.wait4(ids)

# get detailed information about submited and finished jobs
print("jobs details:\n%s\n" % str(m.info(ids)))

m.finish()
m.kill_manager_process()