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")
def test_from_b_returns_bytes(self): suffix = "B" actual = Unit.from_suffix(suffix) expected = Unit.BYTES assert actual == expected
def test_from_gb_returns_giga(self): suffix = "GB" actual = Unit.from_suffix(suffix) expected = Unit.GIGA assert actual == expected
def test_from_lowercase_mb_returns_mega(self): suffix = "mb" actual = Unit.from_suffix(suffix) expected = Unit.MEGA assert actual == expected
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()