def sixtrack_job(self): ''''Controls sixtrack job execution. ''' if 'additional_input' in self.six_cfg.keys(): # inp = self.six_cfg["additional_input"] add_inputs = json.loads(self.six_cfg["additional_input"]) else: add_inputs = [] if self.boinc: # run sixtrack with a few turns fort_dic = self.sixtrack_prep_cfg(turnss=self.six_cfg['test_turn']) else: # run complete sixtrack job fort_dic = self.sixtrack_prep_cfg() # create and enter temp folder with self.sixtrack_temp_folder(symlink_parent=True, extra=add_inputs + self.cr_inputs): self._logger.info("Preparing the sixtrack input files!") # replace placeholders and concatenate self.sixtrack_prep_job(fort_dic, source_prefix=Path.cwd().parent, output_file='fort.3') # run sixtrack self.sixtrack_run('fort.6') # self.six_out.append('fort.6') # check and move output files if utils.check(self.six_out): for out in self.six_out: shutil.copy2(out, Path.cwd().parent / out) # move checkpoint files out of temp folder, if files are not # symlinks for cr_f in self.cr_files: cr_f = Path(cr_f) cr_f_parent = Path.cwd().parent / cr_f if cr_f.exists() and not cr_f_parent.exists(): shutil.copy2(cr_f, cr_f_parent) if not self.boinc: shutil.copy2(Path('fort.3'), Path.cwd().parent / 'fort.3') # leave and delete temp folder if self.boinc: if not self.sixtrack_check_tracking(six_stdout='fort.6'): raise Exception( f"The job {self.task_id} doesn't pass the test!") job_name = self.boinc_prep() # restore the desired number of turns fort_dic['turnss'] = self.fort_cfg['turnss'] self.sixtrack_prep_job(fort_dic, source_prefix=None, output_file='fort.3') self.boinc_submit(job_name)
def madx_job(self): """Controls madx job execution. """ # self.madx_copy_mask() # replace placeholders ready_mask = 'madx_in' self.madx_prep(output_file=ready_mask) # run job self.madx_run(ready_mask) # check the output if not utils.check(self.madx_out): content = 'MADX output files not found.' raise FileNotFoundError(content)