Ejemplo n.º 1
0
    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
Ejemplo n.º 2
0
    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}")
Ejemplo n.º 3
0
    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
Ejemplo n.º 4
0
 def __call__(self, ui: UI) -> bool:
     ui.update(self._controller.poll_status(self._jobid))
     return True
Ejemplo n.º 5
0
 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")
Ejemplo n.º 6
0
 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")
Ejemplo n.º 7
0
 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")