Skip to content

Commit

Permalink
Use tmp-file for lsf submit
Browse files Browse the repository at this point in the history
  • Loading branch information
berland committed Mar 12, 2024
1 parent bbfdc08 commit d9e44d9
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions src/ert/scheduler/lsf_driver.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import shlex
import shutil
import stat
import tempfile
from pathlib import Path
from typing import (
Dict,
Expand Down Expand Up @@ -116,10 +117,18 @@ async def submit(
"#!/usr/bin/env bash\n"
f"cd {shlex.quote(str(runpath))}\n"
f"exec -a {shlex.quote(executable)} {executable} {shlex.join(args)}\n"
# f"{executable} {shlex.join(args)}\n"
)
script_path = runpath / "job_script.sh"
script_path.write_text(script, encoding="utf-8")
script_path: Optional[Path] = None
with tempfile.NamedTemporaryFile(
prefix="lsf_submit_",
suffix=".sh",
mode="w",
encoding="utf-8",
delete=False,
) as script_handle:
script_handle.write(script)
script_path = Path(script_handle.name)
assert script_path is not None
script_path.chmod(script_path.stat().st_mode | stat.S_IEXEC)

bsub_with_args: List[str] = (
Expand Down

0 comments on commit d9e44d9

Please sign in to comment.