diff --git a/src/bartender/schedulers/slurm.py b/src/bartender/schedulers/slurm.py index 6b99a10..b47e997 100644 --- a/src/bartender/schedulers/slurm.py +++ b/src/bartender/schedulers/slurm.py @@ -89,6 +89,7 @@ async def submit(self, description: JobDescription) -> str: # noqa: D102): # must be on a shared filesystem or remote filesystem script = self._submit_script(description) command = "sbatch" + logger.debug(f"Submitting job with stdin: \n{script}") (returncode, stdout, stderr) = await self.runner.run( command, args=[], diff --git a/src/bartender/web/api/applications/submit.py b/src/bartender/web/api/applications/submit.py index fe6e56a..6ef3aac 100644 --- a/src/bartender/web/api/applications/submit.py +++ b/src/bartender/web/api/applications/submit.py @@ -63,8 +63,8 @@ async def submit( # noqa: WPS211 job_dir, payload, context.applications[application], - application, - submitter.username, + application=application, + submitter=submitter.username, ) destination_name = context.destination_picker( diff --git a/tests/schedulers/helpers.py b/tests/schedulers/helpers.py index e495131..500880b 100644 --- a/tests/schedulers/helpers.py +++ b/tests/schedulers/helpers.py @@ -10,7 +10,7 @@ def prepare_input(job_dir: Path) -> JobDescription: return JobDescription( command="echo -n hello && wc input > output", job_dir=job_dir, - submitter="test", + submitter="testsubmitter", application="hellowc", ) diff --git a/tests/schedulers/test_slurm.py b/tests/schedulers/test_slurm.py index b142026..01c2669 100644 --- a/tests/schedulers/test_slurm.py +++ b/tests/schedulers/test_slurm.py @@ -1,3 +1,4 @@ +import logging from asyncio import new_event_loop from pathlib import Path from typing import Generator @@ -69,11 +70,15 @@ def slurm_server() -> Generator[SlurmContainer, None, None]: async def test_ok_running_job_with_input_and_output_file( tmp_path: Path, slurm_server: SlurmContainer, + caplog: pytest.LogCaptureFixture, ) -> None: + caplog.set_level(logging.DEBUG, "bartender.schedulers.slurm") job_dir = tmp_path try: ssh_config = slurm_server.get_config() - scheduler = SlurmScheduler(SlurmSchedulerConfig(ssh_config=ssh_config)) + scheduler = SlurmScheduler( + SlurmSchedulerConfig(ssh_config=ssh_config, submitter_as_account=True), + ) description = prepare_input(job_dir) fs = slurm_server.get_filesystem() localized_description = fs.localize_description(description, job_dir.parent) @@ -87,6 +92,8 @@ async def test_ok_running_job_with_input_and_output_file( await fs.download(localized_description, description) assert_output(job_dir) + assert "--job-name=hellowc" in caplog.text + assert "--account=testsubmitter" in caplog.text finally: await scheduler.close() @@ -113,6 +120,7 @@ async def test_ok_running_job_without_iofiles( await fs.download(localized_description, description) assert_output_without_iofiles(job_dir) + finally: await scheduler.close()