From 3528cccbffb697ff45944d9de790107241d7bb91 Mon Sep 17 00:00:00 2001 From: Andrew Thrasher Date: Tue, 23 May 2023 10:23:55 -0400 Subject: [PATCH] Log location and memory reservation (#3) * fix: LSF output; memory calculation. * build: bump version * fix: update lsf log path --- pyproject.toml | 2 +- src/miniwdl_lsf/__init__.py | 9 +++++---- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 3195b6d..5e81f6e 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "miniwdl-lsf" -version = "0.1.0" +version = "0.1.1" description = "miniwdl lsf backend using singularity" authors = ["Andrew Thrasher "] license = "MIT" diff --git a/src/miniwdl_lsf/__init__.py b/src/miniwdl_lsf/__init__.py index f2b26e7..b76dda6 100755 --- a/src/miniwdl_lsf/__init__.py +++ b/src/miniwdl_lsf/__init__.py @@ -88,15 +88,16 @@ def _lsf_invocation(self): ] # Redirect LSF logs to files - bsub_args.extend(["-o", os.path.join(self.host_dir, "stdout.lsf")]) - bsub_args.extend(["-e", os.path.join(self.host_dir, "stderr.lsf")]) + bsub_args.extend(["-o", os.path.join(self.host_dir, f"stdout{self.try_counter if self.try_counter > 1 else ''}.lsf")]) + bsub_args.extend(["-e", os.path.join(self.host_dir, f"stderr{self.try_counter if self.try_counter > 1 else ''}.lsf")]) cpu = self.runtime_values.get("cpu", None) if cpu is not None: bsub_args.extend(["-n", str(cpu)]) bsub_args.extend(["-R span[hosts=1]"]) - memory = self.runtime_values.get("memory_reservation", None) + # Get memory reservation for job in bytes + memory = self.runtime_values.get("memory_reservation", 0) if memory is not None: # LSF memory specifications are per-core. # WDL (bioinformatics) tasks often specify memory per job. @@ -107,7 +108,7 @@ def _lsf_invocation(self): memory_divisor = cpu # Round to the nearest megabyte. - bsub_args.extend(["-M", f"{round((memory / (1024 ** 2)) / memory_divisor)}M"]) + bsub_args.extend(["-M", f"{round((memory / (1000 ** 2)) / memory_divisor)}M"]) if self.cfg.has_section("lsf"): extra_args = self.cfg.get("lsf", "extra_args")