Skip to content

Commit

Permalink
Fixed mem_per_cpu setting in job class (#243)
Browse files Browse the repository at this point in the history
* Fixed mem_per_cpu setting.

* Fixed settings with mem_per_cp mentions.
  • Loading branch information
JonaOtto authored and tazend committed Sep 11, 2022
1 parent b997755 commit f778e9d
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions pyslurm/pyslurm.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -659,7 +659,7 @@ cdef class config:
Ctl_dict['max_dbd_msgs'] = self.__Config_ptr.max_dbd_msgs
Ctl_dict['max_job_cnt'] = self.__Config_ptr.max_job_cnt
Ctl_dict['max_job_id'] = self.__Config_ptr.max_job_id
Ctl_dict['max_mem_per_cp'] = self.__Config_ptr.max_mem_per_cpu
Ctl_dict['max_mem_per_cpu'] = self.__Config_ptr.max_mem_per_cpu
Ctl_dict['max_step_cnt'] = self.__Config_ptr.max_step_cnt
Ctl_dict['max_tasks_per_node'] = self.__Config_ptr.max_tasks_per_node
Ctl_dict['min_job_age'] = self.__Config_ptr.min_job_age
Expand Down Expand Up @@ -1062,16 +1062,16 @@ cdef class partition:

if record.max_mem_per_cpu & slurm.MEM_PER_CPU:
if record.max_mem_per_cpu == slurm.MEM_PER_CPU:
Part_dict['max_mem_per_cp'] = "UNLIMITED"
Part_dict['max_mem_per_cpu'] = "UNLIMITED"
Part_dict['max_mem_per_node'] = None
else:
Part_dict['max_mem_per_cp'] = record.max_mem_per_cpu & (~slurm.MEM_PER_CPU)
Part_dict['max_mem_per_cpu'] = record.max_mem_per_cpu & (~slurm.MEM_PER_CPU)
Part_dict['max_mem_per_node'] = None
elif record.max_mem_per_cpu == 0:
Part_dict['max_mem_per_cp'] = None
Part_dict['max_mem_per_cpu'] = None
Part_dict['max_mem_per_node'] = "UNLIMITED"
else:
Part_dict['max_mem_per_cp'] = None
Part_dict['max_mem_per_cpu'] = None
Part_dict['max_mem_per_node'] = record.max_mem_per_cpu

if record.max_nodes == slurm.INFINITE:
Expand Down Expand Up @@ -2068,12 +2068,12 @@ cdef class job:

if self._record.pn_min_memory & slurm.MEM_PER_CPU:
self._record.pn_min_memory &= (~slurm.MEM_PER_CPU)
Job_dict['mem_per_cp'] = True
Job_dict['mem_per_cpu'] = True
Job_dict['min_memory_cp'] = self._record.pn_min_memory
Job_dict['mem_per_node'] = False
Job_dict['min_memory_node'] = None
else:
Job_dict['mem_per_cp'] = False
Job_dict['mem_per_cpu'] = False
Job_dict['min_memory_cp'] = None
Job_dict['mem_per_node'] = True
Job_dict['min_memory_node'] = self._record.pn_min_memory
Expand Down Expand Up @@ -2521,8 +2521,8 @@ cdef class job:

if job_opts.get("realmem"):
desc.pn_min_memory = job_opts.get("realmem")
elif job_opts.get("mem_per_cp"):
desc.pn_min_memory = job_opts.get("mem_per_cp") | slurm.MEM_PER_CPU
elif job_opts.get("mem_per_cpu"):
desc.pn_min_memory = job_opts.get("mem_per_cpu") | slurm.MEM_PER_CPU

if job_opts.get("tmpdisk"):
desc.pn_min_tmp_disk = job_opts.get("tmpdisk")
Expand Down Expand Up @@ -5285,10 +5285,10 @@ cdef class slurmdb_jobs:

if job.req_mem & slurm.MEM_PER_CPU:
JOBS_info['req_mem'] = job.req_mem & (~slurm.MEM_PER_CPU)
JOBS_info['req_mem_per_cp'] = True
JOBS_info['req_mem_per_cpu'] = True
else:
JOBS_info['req_mem'] = job.req_mem
JOBS_info['req_mem_per_cp'] = False
JOBS_info['req_mem_per_cpu'] = False

JOBS_info['requid'] = job.requid
JOBS_info['resvid'] = job.resvid
Expand Down

0 comments on commit f778e9d

Please sign in to comment.