def __init__(self, init_spython_client=True, **kw): super(SingularityRunner, self).__init__(**kw) self._spawned_containers = set() self._s = None if SingularityRunner._in_docker(): log.fail( ("You seem to be running Popper in a Docker container.\n" "Singularity cannot be executed this way.\n" "Either run Popper without Singularity or install Popper " "through PIP.\n" "Instructions are available here:\n" "https://github.com/getpopper/popper/" "blob/master/docs/installation.md")) if self._config.reuse: log.fail("Reuse not supported for SingularityRunner.") if not init_spython_client: return singularity_executables = ["singularity"] for exe in singularity_executables: assert_executable_exists(exe) self._s = spython.main.Client self._s.quiet = True
def __init__(self, **kw): super(SlurmRunner, self).__init__(**kw) self._spawned_jobs = set() slurm_executables = ["sbatch", "srun", "scancel", "mpirun"] for exe in slurm_executables: assert_executable_exists(exe)
def __init__(self, **kw): super(SingularityRunner, self).__init__(init_spython_client=False, **kw) if self._config.reuse: log.fail("Reuse not supported for SingularityRunner.") singularity_executables = ["singularity"] for exe in singularity_executables: assert_executable_exists(exe)
def __init__(self, init_podman_client=True, **kw): super(PodmanRunner, self).__init__(**kw) self._spawned_containers = set() if not init_podman_client: return podman_executables = ["podman"] for exe in podman_executables: assert_executable_exists(exe) try: _, _, self._p_info = HostRunner._exec_cmd(["podman", "info"], logging=False) self._p_version = HostRunner._exec_cmd(["podman", "version"], logging=False) except Exception as e: log.debug(f"Podman error: {e}") log.fail("Unable to connect to podman, is it installed?") log.debug(f"Podman info: {pu.prettystr(self._p_info)}")
def test_assert_executable_exists(self): pu.assert_executable_exists("ls") self.assertRaises(SystemExit, pu.assert_executable_exists, "abcd")
def test_assert_executable_exists(self): pu.assert_executable_exists('ls') self.assertRaises(SystemExit, pu.assert_executable_exists, 'abcd')