Skip to content

Commit

Permalink
Log location and memory reservation (#3)
Browse files Browse the repository at this point in the history
* fix: LSF output; memory calculation.

* build: bump version

* fix: update lsf log path
  • Loading branch information
adthrasher authored May 23, 2023
1 parent 2c45c88 commit 3528ccc
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -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 <[email protected]>"]
license = "MIT"
Expand Down
9 changes: 5 additions & 4 deletions src/miniwdl_lsf/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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")
Expand Down

0 comments on commit 3528ccc

Please sign in to comment.