From c205323e101e0f376e85e89b17a4cfc9262b0119 Mon Sep 17 00:00:00 2001 From: Max Levine Date: Mon, 4 Mar 2019 16:42:23 -0500 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20support=20lsf=20encapsulated=20j?= =?UTF-8?q?obs=20(#24)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- tests/test_lsf.py | 6 +++++- toil_container/lsf.py | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/tests/test_lsf.py b/tests/test_lsf.py index 02f321f..c5a8d29 100644 --- a/tests/test_lsf.py +++ b/tests/test_lsf.py @@ -52,7 +52,7 @@ def test_build_bsub_line(): obtained = lsf.build_bsub_line(cpu=cpu, mem=mem, runtime=1, jobname="Test Job") if per_core_reservation(): - mem = float(mem) / 1024 ** 3 / int(cpu) + mem = float(mem) / 1024 ** 3 / int(cpu or 1) else: mem = old_div(float(mem), 1024 ** 3) @@ -87,6 +87,10 @@ def test_build_bsub_line(): del os.environ["TOIL_LSF_ARGS"] +def test_build_bsub_line_zero_cpus(): + lsf.build_bsub_line(cpu=0, mem=2147483648, runtime=1, jobname="Test Job") + + @SKIP_LSF def test_bsubline_works(): command = lsf.build_bsub_line(cpu=1, mem=2147483648, runtime=1, jobname="Test Job") diff --git a/toil_container/lsf.py b/toil_container/lsf.py index ca34f20..d8ed790 100644 --- a/toil_container/lsf.py +++ b/toil_container/lsf.py @@ -269,7 +269,7 @@ def build_bsub_line(cpu, mem, runtime, jobname): if mem: if os.getenv(_PER_SLOT_LSF_CONFIG) == "Y" or per_core_reservation(): - mem = float(mem) / 1024 ** 3 / int(cpu) + mem = float(mem) / 1024 ** 3 / int(cpu or 1) else: mem = old_div(float(mem), 1024 ** 3)