def write_submit_phil(self, submit_phil_path, target_phil_path): import libtbx.load_env from xfel.ui.db.task import task_types, task_dispatchers submit_root = libtbx.env.find_in_repositories("xfel/ui/db/cfgs") d = dict( dry_run=self.app.params.dry_run, dispatcher=task_dispatchers[task_types.index(self.task.type)], run_num=self.run.run, output_dir=self.app.params.output_folder, trial=self.trial.trial, rungroup=self.rungroup.rungroup_id, task=self.task.id, nproc=self.app.params.mp.nproc, nproc_per_node=self.app.params.mp.nproc_per_node, queue=self.app.params.mp.queue or None, env_script=self.app.params.mp.env_script[0] if len(self.app.params.mp.env_script) > 0 and len(self.app.params.mp.env_script[0]) > 0 else None, method=self.app.params.mp.method, htcondor_executable_path=self.app.params.mp.htcondor. executable_path, target=target_phil_path, # always use mpi for 'lcls' use_mpi=self.app.params.mp.method != 'local' or (self.app.params.mp.method == 'local' and self.app.params.facility.name == 'lcls')) with open(submit_phil_path, "w") as phil: for line in open( os.path.join(submit_root, "submit_xfel_merge.phil")).readlines(): phil.write(line.format(**d))
def write_submit_phil(self, submit_phil_path, target_phil_path): import libtbx.load_env from xfel.ui.db.task import task_types, task_dispatchers submit_root = libtbx.env.find_in_repositories("xfel/ui/db/cfgs") d = dict( dry_run=self.app.params.dry_run, dispatcher=task_dispatchers[task_types.index(self.task.type)], run_num=self.run.run, output_dir=self.app.params.output_folder, trial=self.trial.trial, rungroup=self.rungroup.rungroup_id, task=self.task.id, nproc=self.app.params.mp.nproc, nproc_per_node=self.app.params.mp.nproc_per_node, queue=self.app.params.mp.queue or None, env_script=self.app.params.mp.env_script[0] if len(self.app.params.mp.env_script) > 0 and len(self.app.params.mp.env_script[0]) > 0 else None, method=self.app.params.mp.method, htcondor_executable_path=self.app.params.mp.htcondor. executable_path, nersc_shifter_image=self.app.params.mp.shifter.shifter_image, sbatch_script_template=self.app.params.mp.shifter. sbatch_script_template, srun_script_template=self.app.params.mp.shifter. srun_script_template, nersc_partition=self.app.params.mp.shifter.partition, nersc_jobname=self.app.params.mp.shifter.jobname, nersc_project=self.app.params.mp.shifter.project, nersc_constraint=self.app.params.mp.shifter.constraint, nersc_reservation=self.app.params.mp.shifter.reservation, nersc_staging=self.app.params.mp.shifter.staging, target=target_phil_path, # always use mpi for 'lcls' use_mpi=self.app.params.mp.method != 'local' or (self.app.params.mp.method == 'local' and self.app.params.facility.name == 'lcls'), mpi_command=self.app.params.mp.mpi_command, nnodes=self.app.params.mp.nnodes_scale or self.app.params.mp.nnodes, wall_time=self.app.params.mp.wall_time, extra_options="\n".join([ "extra_options = %s" % opt for opt in self.app.params.mp.extra_options ]), ) with open(submit_phil_path, "w") as phil: for line in open( os.path.join(submit_root, "submit_xfel_merge.phil")).readlines(): phil.write(line.format(**d))