@@ -61,7 +61,9 @@ def __init__(self, ceUniqueID):
6161 self .taskID = 0
6262 self .processorsPerTask = {}
6363 self .userNumberPerTask = {}
64- self .ram = 1024 # Default RAM in GB (this is an arbitrary large value in case of no limit)
64+ self .ram = (
65+ 1024 # Available RAM for the node, in GB. The default value is an arbitrary large value in case of no limit
66+ )
6567 self .ramPerTask = {}
6668
6769 # This CE will effectively submit to another "Inner"CE
@@ -77,9 +79,8 @@ def _reset(self):
7779 self .processors = int (self .ceParameters .get ("NumberOfProcessors" , self .processors ))
7880 self .ceParameters ["MaxTotalJobs" ] = self .processors
7981 max_ram = int (self .ceParameters .get ("MaxRAM" , 0 ))
80- if max_ram > 0 :
81- self .ram = max_ram // 1024 # Convert from MB to GB
82- self .ceParameters ["MaxRAM" ] = self .ram
82+ if max_ram :
83+ self .ram = self .ceParameters ["MaxRAM" ]
8384 # Indicates that the submission is done asynchronously
8485 # The result is not immediately available
8586 self .ceParameters ["AsyncSubmission" ] = True
@@ -190,14 +191,18 @@ def _getMemoryForJobs(self, kwargs):
190191 """
191192
192193 # # job requirements
193- requestedMemory = kwargs .get ("MaxRAM " , 0 )
194+ requestedMemory = kwargs .get ("MinRAM " , 0 )
194195
195196 # # now check what the slot can provide
196197 # Do we have enough memory?
197198 availableMemory = self .ram - sum (self .ramPerTask .values ())
198199 if availableMemory < requestedMemory :
199200 return None
200201
202+ # If there's a maximum amount of RAM allowed for the job, use that as maximum,
203+ if "MaxRAM" in kwargs and kwargs ["MaxRAM" ]:
204+ requestedMemory = int (kwargs ["MaxRAM" ])
205+
201206 return requestedMemory
202207
203208 def finalizeJob (self , taskID , future ):
0 commit comments