diff --git a/src/ert/scheduler/driver.py b/src/ert/scheduler/driver.py index 3f935f591ff..4b9a6ae46e2 100644 --- a/src/ert/scheduler/driver.py +++ b/src/ert/scheduler/driver.py @@ -49,7 +49,7 @@ async def submit( executable: str, /, *args: str, - name: str = "dummy", + name: str | None = None, runpath: Path | None = None, num_cpu: int | None = 1, realization_memory: int | None = 0, diff --git a/src/ert/scheduler/local_driver.py b/src/ert/scheduler/local_driver.py index 5936539e381..6db0bd838f8 100644 --- a/src/ert/scheduler/local_driver.py +++ b/src/ert/scheduler/local_driver.py @@ -29,7 +29,7 @@ async def submit( executable: str, /, *args: str, - name: str = "dummy", + name: str | None = None, runpath: Path | None = None, num_cpu: int | None = 1, realization_memory: int | None = 0, diff --git a/src/ert/scheduler/lsf_driver.py b/src/ert/scheduler/lsf_driver.py index 6a0960c4264..469ec46c81c 100644 --- a/src/ert/scheduler/lsf_driver.py +++ b/src/ert/scheduler/lsf_driver.py @@ -292,13 +292,15 @@ async def submit( executable: str, /, *args: str, - name: str = "dummy", + name: str | None = None, runpath: Path | None = None, num_cpu: int | None = 1, realization_memory: int | None = 0, ) -> None: if runpath is None: runpath = Path.cwd() + if name is None: + name = Path(executable).name arg_queue_name = ["-q", self._queue_name] if self._queue_name else [] arg_project_code = ["-P", self._project_code] if self._project_code else [] diff --git a/src/ert/scheduler/openpbs_driver.py b/src/ert/scheduler/openpbs_driver.py index 03683611004..9cf0f97703b 100644 --- a/src/ert/scheduler/openpbs_driver.py +++ b/src/ert/scheduler/openpbs_driver.py @@ -215,13 +215,15 @@ async def submit( executable: str, /, *args: str, - name: str = "dummy", + name: str | None = None, runpath: Path | None = None, num_cpu: int | None = 1, realization_memory: int | None = 0, ) -> None: if runpath is None: runpath = Path.cwd() + if name is None: + name = Path(executable).name arg_queue_name = ["-q", self._queue_name] if self._queue_name else [] arg_project_code = ["-A", self._project_code] if self._project_code else [] diff --git a/src/ert/scheduler/slurm_driver.py b/src/ert/scheduler/slurm_driver.py index 3a93cc43a69..3d5a4435543 100644 --- a/src/ert/scheduler/slurm_driver.py +++ b/src/ert/scheduler/slurm_driver.py @@ -155,13 +155,15 @@ async def submit( executable: str, /, *args: str, - name: str = "dummy", + name: str | None = None, runpath: Path | None = None, num_cpu: int | None = 1, realization_memory: int | None = 0, ) -> None: if runpath is None: runpath = Path.cwd() + if name is None: + name = Path(executable).name script = create_submit_script(runpath, executable, args, self.activate_script) script_path: Path | None = None diff --git a/tests/ert/unit_tests/scheduler/test_lsf_driver.py b/tests/ert/unit_tests/scheduler/test_lsf_driver.py index 088575ad618..369356b2f9f 100644 --- a/tests/ert/unit_tests/scheduler/test_lsf_driver.py +++ b/tests/ert/unit_tests/scheduler/test_lsf_driver.py @@ -1167,6 +1167,13 @@ async def test_submit_with_resource_requirement_with_bsub_capture(): assert "hname" not in Path("captured_bsub_args").read_text(encoding="utf-8") +@pytest.mark.usefixtures("capturing_bsub") +async def test_empty_job_name(): + driver = LsfDriver() + await driver.submit(0, "/bin/sleep") + assert " -J sleep " in Path("captured_bsub_args").read_text(encoding="utf-8") + + @pytest.mark.integration_test @pytest.mark.usefixtures("use_tmpdir") async def test_submit_with_num_cpu(pytestconfig, job_name): diff --git a/tests/ert/unit_tests/scheduler/test_openpbs_driver.py b/tests/ert/unit_tests/scheduler/test_openpbs_driver.py index 41f99b61c2f..f8745f54f6d 100644 --- a/tests/ert/unit_tests/scheduler/test_openpbs_driver.py +++ b/tests/ert/unit_tests/scheduler/test_openpbs_driver.py @@ -165,6 +165,13 @@ async def test_job_name(): assert " -Nsleepy " in Path("captured_qsub_args").read_text(encoding="utf-8") +@pytest.mark.usefixtures("capturing_qsub") +async def test_empty_job_name(): + driver = OpenPBSDriver() + await driver.submit(0, "/bin/sleep") + assert " -Nsleep " in Path("captured_qsub_args").read_text(encoding="utf-8") + + @pytest.mark.usefixtures("capturing_qsub") async def test_job_name_with_prefix(): driver = OpenPBSDriver(job_prefix="pre_") diff --git a/tests/ert/unit_tests/scheduler/test_slurm_driver.py b/tests/ert/unit_tests/scheduler/test_slurm_driver.py index b39875b2e67..16c6dfb783a 100644 --- a/tests/ert/unit_tests/scheduler/test_slurm_driver.py +++ b/tests/ert/unit_tests/scheduler/test_slurm_driver.py @@ -144,6 +144,15 @@ async def test_project_code_is_set(project_code): ) +@pytest.mark.usefixtures("capturing_sbatch") +async def test_empty_job_name(): + driver = SlurmDriver() + await driver.submit(0, "/bin/sleep") + assert "--job-name=sleep" in Path("captured_sbatch_args").read_text( + encoding="utf-8" + ) + + @pytest.mark.usefixtures("capturing_sbatch") @given(max_runtime=st.floats(min_value=1, max_value=999999999)) async def test_max_runtime_is_properly_formatted(max_runtime):