From f6bf66e798c2480c4893ba03bed4f9310caef64a Mon Sep 17 00:00:00 2001 From: Matthew Evans Date: Fri, 14 Jul 2023 13:39:36 +0200 Subject: [PATCH 1/2] Fix name for `ntasks` in slurm template --- src/qtoolkit/io/slurm.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/qtoolkit/io/slurm.py b/src/qtoolkit/io/slurm.py index 8d81ad7..8f35f4c 100644 --- a/src/qtoolkit/io/slurm.py +++ b/src/qtoolkit/io/slurm.py @@ -128,7 +128,7 @@ class SlurmIO(BaseSchedulerIO): #SBATCH --partition=$${partition} #SBATCH --job-name=$${job_name} #SBATCH --nodes=$${nodes} -#SBATCH --ntasks=$${ntasks} +#SBATCH --ntasks=$${number_of_tasks} #SBATCH --ntasks-per-node=$${ntasks_per_node} #SBATCH --cpus-per-task=$${cpus_per_task} #SBATCH --mem=$${mem} @@ -342,7 +342,6 @@ def _parse_scontrol_cmd_output(self, stdout): def _get_jobs_list_cmd( self, job_ids: list[str] | None = None, user: str | None = None ) -> str: - if user and job_ids: raise ValueError("Cannot query by user and job(s) in SLURM") @@ -394,7 +393,6 @@ def parse_jobs_list_output(self, exit_code, stdout, stderr) -> list[QJob]: jobs_list = [] for data in jobdata_raw: if len(data) != num_fields: - msg = f"Wrong number of fields. Found {len(jobdata_raw)}, expected {num_fields}" # TODO should this raise or just continue? and should there be # a logging of the errors? From a3c7c00e324e2c63ffd1845e78401658f5285a0d Mon Sep 17 00:00:00 2001 From: Matthew Evans Date: Fri, 14 Jul 2023 13:49:29 +0200 Subject: [PATCH 2/2] Use `ntasks` as the internal variable name --- src/qtoolkit/io/slurm.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/qtoolkit/io/slurm.py b/src/qtoolkit/io/slurm.py index 8f35f4c..7e8fc2b 100644 --- a/src/qtoolkit/io/slurm.py +++ b/src/qtoolkit/io/slurm.py @@ -128,7 +128,7 @@ class SlurmIO(BaseSchedulerIO): #SBATCH --partition=$${partition} #SBATCH --job-name=$${job_name} #SBATCH --nodes=$${nodes} -#SBATCH --ntasks=$${number_of_tasks} +#SBATCH --ntasks=$${ntasks} #SBATCH --ntasks-per-node=$${ntasks_per_node} #SBATCH --cpus-per-task=$${cpus_per_task} #SBATCH --mem=$${mem} @@ -555,11 +555,11 @@ def _convert_qresources(self, resources: QResources) -> dict: nodes, processes, processes_per_node = resources.get_processes_distribution() if processes: - header_dict["number_of_tasks"] = processes + header_dict["ntasks"] = processes if processes_per_node: header_dict["ntasks_per_node"] = processes_per_node if nodes: - header_dict["number_of_nodes"] = nodes + header_dict["nodes"] = nodes if resources.threads_per_process: header_dict["cpus_per_task"] = resources.threads_per_process