@@ -54,7 +54,8 @@ def __init__(self, node_count: Optional[int] = None,
5454 processes_per_node : Optional [int ] = None ,
5555 cpu_cores_per_process : Optional [int ] = None ,
5656 gpu_cores_per_process : Optional [int ] = None ,
57- exclusive_node_use : bool = False ) -> None :
57+ exclusive_node_use : bool = False ,
58+ memory : Optional [int ] = None ) -> None :
5859 """
5960 Some of the properties of this class are constrained. Specifically,
6061 `process_count = node_count * processes_per_node`. Specifying all constrained properties
@@ -79,6 +80,7 @@ def __init__(self, node_count: Optional[int] = None,
7980 set to `False`, which is the default, the LRM is free to co-schedule multiple jobs
8081 on a given node if the number of cores requested by those jobs total less than the
8182 amount available on the node.
83+ :param memory: The total amount, in bytes, of memory requested for the job.
8284
8385 All constructor parameters are accessible as properties.
8486 """
@@ -88,6 +90,7 @@ def __init__(self, node_count: Optional[int] = None,
8890 self .cpu_cores_per_process = cpu_cores_per_process
8991 self .gpu_cores_per_process = gpu_cores_per_process
9092 self .exclusive_node_use = exclusive_node_use
93+ self .memory = memory
9194 self ._check_constraints ()
9295
9396 def _check_constraints (self ) -> None :
@@ -184,6 +187,19 @@ def computed_processes_per_node(self) -> int:
184187 assert self ._computed_ppn is not None
185188 return self ._computed_ppn
186189
190+ @property
191+ def memory_kb (self ) -> Optional [int ]:
192+ """
193+ Returns the memory limit specified by the `memory` property, but in KB.
194+
195+ :return: If the `memory` property is set on this object, returns `memory // 1024`. If the
196+ `memory` property is `None`, this method returns `None`.
197+ """
198+ if self .memory :
199+ return self .memory // 1024
200+ else :
201+ return None
202+
187203 @property
188204 def version (self ) -> int :
189205 """Returns the version of this `ResourceSpec`, which is 1 for this class."""
0 commit comments