Skip to content

Commit

Permalink
Fix unable to have path object in argslist for localdriver
Browse files Browse the repository at this point in the history
  • Loading branch information
jonathan-eq committed Jan 21, 2025
1 parent e17b0b4 commit 4f7a90b
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/ert/scheduler/local_driver.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,9 @@ async def finish(self) -> None:
raise result
logger.info("All realization tasks finished")

async def _run(self, iens: int, executable: str, /, *args: str) -> None:
async def _run(self, iens: int, executable: str, /, *args: str | Path) -> None:
logger.debug(
f"Submitting realization {iens} as command '{executable} {' '.join(args)}'"
f"Submitting realization {iens} as command '{executable} {' '.join(str(arg) for arg in args)}'"
)
try:
proc = await self._init(
Expand Down
12 changes: 12 additions & 0 deletions tests/ert/unit_tests/scheduler/test_local_driver.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,3 +129,15 @@ async def test_that_killing_killed_job_does_not_raise():
await driver.kill(23)
await driver.kill(23)
assert driver.event_queue.empty()


@pytest.mark.timeout(10)
async def test_path_as_argument(tmp_path):
driver = LocalDriver()
os.chdir(tmp_path)

await driver.submit(42, "/usr/bin/env", "touch", Path(tmp_path) / "testfile")
assert await driver.event_queue.get() == StartedEvent(iens=42)
assert await driver.event_queue.get() == FinishedEvent(iens=42, returncode=0)

assert Path("testfile").exists()

0 comments on commit 4f7a90b

Please sign in to comment.