Пример #1
0
    def test_from_invalid_power_raises_error(self):
        power = 10

        with pytest.raises(InvalidPower) as error:
            Unit.from_power(power)

        assert error.match("Valid powers are")
Пример #2
0
    def test_invalid_suffix_raises_error(self):
        suffix = "OB"

        with pytest.raises(InvalidSuffix) as error:
            Unit.from_suffix(suffix)

        assert error.match("Valid suffixes are")
Пример #3
0
    def test_from_b_returns_bytes(self):
        suffix = "B"

        actual = Unit.from_suffix(suffix)
        expected = Unit.BYTES

        assert actual == expected
Пример #4
0
    def test_from_1_returns_kilo(self):
        power = 1

        actual = Unit.from_power(power)
        expected = Unit.KILO

        assert actual == expected
Пример #5
0
    def test_from_lowercase_mb_returns_mega(self):
        suffix = "mb"

        actual = Unit.from_suffix(suffix)
        expected = Unit.MEGA

        assert actual == expected
Пример #6
0
    def test_from_gb_returns_giga(self):
        suffix = "GB"

        actual = Unit.from_suffix(suffix)
        expected = Unit.GIGA

        assert actual == expected
Пример #7
0
        try:
            external_job_id = self._submit_cmd_and_get_external_job_id()
            parameters_to_status_script = self._get_parameters_to_status_script(
                external_job_id)
            OSLayer.print(parameters_to_status_script)
        except subprocess.CalledProcessError as error:
            raise BsubInvocationError(error)
        except AttributeError as error:
            raise JobidNotFoundError(error)


if __name__ == "__main__":
    workdir = Path().resolve()
    config_file = workdir / "lsf.yaml"
    if config_file.exists():
        with config_file.open() as stream:
            lsf_config = Config.from_stream(stream)
    else:
        lsf_config = Config()

    jobscript = sys.argv[-1]
    cluster_cmds = sys.argv[1:-1]
    memory_units = Unit.from_suffix(CookieCutter.get_lsf_unit_for_limits())
    lsf_submit = Submitter(
        jobscript=jobscript,
        memory_units=memory_units,
        lsf_config=lsf_config,
        cluster_cmds=cluster_cmds,
    )
    lsf_submit.submit()