def _try_prepare(self, env_prep: EnvironmentPreparation, ui: UI) -> bool: try: ui.info("Copying files...") env_prep.prepare() ui.success("Done") except (FileExistsError, FileNotFoundError) as err: self._do_rollback(env_prep, err, ui) return False return True
def cancel(self, ui: UI) -> None: batch_job = get_or_raise(self._batch_job, self._no_job_launched()) ui.info(f"Canceling job {batch_job.jobid}") batch_job.cancel() ui.success(f"Canceled job {batch_job.jobid}")
def __call__(self, ui: UI) -> bool: self._batch_job = self._controller.submit(self._batch_script) ui.launch(f"Launched job {self._batch_job.jobid}") return True
def __call__(self, ui: UI) -> bool: ui.update(self._controller.poll_status(self._jobid)) return True
def _clean_files(self, env_prep: EnvironmentPreparation, ui: UI) -> None: env_prep.files_to_clean(self._clean) ui.info("Cleaning files...") env_prep.clean() ui.success("Done")
def _collect_files(self, env_prep: EnvironmentPreparation, ui: UI) -> None: env_prep.files_to_collect(self._collect) ui.info("Collecting files...") env_prep.collect() ui.success("Done")
def _do_rollback(env_prep: EnvironmentPreparation, err: Exception, ui: UI) -> None: ui.error(get_error_message(err)) ui.info("Performing rollback") env_prep.rollback() ui.success("Done")