|
1 | | -""" The Computing Element class is a base class for all the various |
2 | | - types CEs. It serves several purposes: |
| 1 | +"""The Computing Element class is a base class for all the various |
| 2 | +types CEs. It serves several purposes: |
3 | 3 |
|
4 | | - - collects general CE related parameters to generate CE description |
5 | | - for the job matching |
6 | | - - provides logic for evaluation of the number of available CPU slots |
7 | | - - provides logic for the proxy renewal while executing jobs |
| 4 | + - collects general CE related parameters to generate CE description |
| 5 | + for the job matching |
| 6 | + - provides logic for evaluation of the number of available CPU slots |
| 7 | + - provides logic for the proxy renewal while executing jobs |
8 | 8 |
|
9 | | - The CE parameters are collected from the following sources, in hierarchy |
10 | | - descending order: |
| 9 | +The CE parameters are collected from the following sources, in hierarchy |
| 10 | +descending order: |
11 | 11 |
|
12 | | - - parameters provided through setParameters() method of the class |
13 | | - - parameters in /LocalSite configuration section |
14 | | - - parameters in /LocalSite/<ceName>/ResourceDict configuration section |
15 | | - - parameters in /LocalSite/ResourceDict configuration section |
16 | | - - parameters in /LocalSite/<ceName> configuration section |
17 | | - - parameters in /Resources/Computing/<ceName> configuration section |
18 | | - - parameters in /Resources/Computing/CEDefaults configuration section |
| 12 | + - parameters provided through setParameters() method of the class |
| 13 | + - parameters in /LocalSite configuration section |
| 14 | + - parameters in /LocalSite/<ceName>/ResourceDict configuration section |
| 15 | + - parameters in /LocalSite/ResourceDict configuration section |
| 16 | + - parameters in /LocalSite/<ceName> configuration section |
| 17 | + - parameters in /Resources/Computing/<ceName> configuration section |
| 18 | + - parameters in /Resources/Computing/CEDefaults configuration section |
19 | 19 |
|
20 | | - The ComputingElement objects are usually instantiated with the help of |
21 | | - ComputingElementFactory. |
| 20 | +The ComputingElement objects are usually instantiated with the help of |
| 21 | +ComputingElementFactory. |
22 | 22 |
|
23 | | - The ComputingElement class can be considered abstract. 3 kinds of abstract ComputingElements |
24 | | - can be distinguished from it: |
| 23 | +The ComputingElement class can be considered abstract. 3 kinds of abstract ComputingElements |
| 24 | +can be distinguished from it: |
25 | 25 |
|
26 | | - - Remote ComputingElement: includes methods to interact with a remote ComputingElement |
27 | | - (e.g. HtCondorCEComputingElement, AREXComputingElement). |
28 | | - - Inner ComputingElement: includes methods to locally interact with an underlying worker node. |
29 | | - It is worth noting that an Inner ComputingElement provides synchronous submission |
30 | | - (the submission of a job is blocking the execution until its completion). It deals with one job at a time. |
31 | | - - Inner Pool ComputingElement: includes methods to locally interact with Inner ComputingElements asynchronously. |
32 | | - It can manage a pool of jobs running simultaneously. |
| 26 | + - Remote ComputingElement: includes methods to interact with a remote ComputingElement |
| 27 | + (e.g. HtCondorCEComputingElement, AREXComputingElement). |
| 28 | + - Inner ComputingElement: includes methods to locally interact with an underlying worker node. |
| 29 | + It is worth noting that an Inner ComputingElement provides synchronous submission |
| 30 | + (the submission of a job is blocking the execution until its completion). It deals with one job at a time. |
| 31 | + - Inner Pool ComputingElement: includes methods to locally interact with Inner ComputingElements asynchronously. |
| 32 | + It can manage a pool of jobs running simultaneously. |
33 | 33 |
|
34 | | - To configure the use of Tokens for CEs: |
| 34 | +To configure the use of Tokens for CEs: |
35 | 35 |
|
36 | | - * the CE is able to receive any token. Validation: 'Tag = Token' should be included in the CE parameters. |
37 | | - * the CE is able to receive VO-specifc tokens. Validation: 'Tag = Token:<VO>' should be included in the CE parameters. |
| 36 | +* the CE is able to receive any token. Validation: 'Tag = Token' should be included in the CE parameters. |
| 37 | +* the CE is able to receive VO-specifc tokens. Validation: 'Tag = Token:<VO>' should be included in the CE parameters. |
38 | 38 |
|
39 | 39 | """ |
40 | 40 |
|
|
50 | 50 | from DIRAC.WorkloadManagementSystem.Utilities.JobParameters import ( |
51 | 51 | getNumberOfGPUs, |
52 | 52 | getNumberOfProcessors, |
| 53 | + getAvailableRAM, |
53 | 54 | ) |
54 | 55 |
|
55 | 56 | INTEGER_PARAMETERS = ["CPUTime", "NumberOfProcessors", "NumberOfPayloadProcessors", "MaxRAM"] |
@@ -211,12 +212,14 @@ def setParameters(self, ceOptions): |
211 | 212 | generalCEDict.update(self.ceParameters) |
212 | 213 | self.ceParameters = generalCEDict |
213 | 214 |
|
214 | | - # If NumberOfProcessors/GPUs is present in the description but is equal to zero |
| 215 | + # If NumberOfProcessors/GPUs/MaxRAM is present in the description but is equal to zero |
215 | 216 | # interpret it as needing local evaluation |
216 | | - if self.ceParameters.get("NumberOfProcessors", -1) == 0: |
| 217 | + if int(self.ceParameters.get("NumberOfProcessors", -1)) == 0: |
217 | 218 | self.ceParameters["NumberOfProcessors"] = getNumberOfProcessors() |
218 | | - if self.ceParameters.get("NumberOfGPUs", -1) == 0: |
| 219 | + if int(self.ceParameters.get("NumberOfGPUs", -1)) == 0: |
219 | 220 | self.ceParameters["NumberOfGPUs"] = getNumberOfGPUs() |
| 221 | + if int(self.ceParameters.get("MaxRAM", 0)) == 0: |
| 222 | + self.ceParameters["MaxRAM"] = getAvailableRAM() |
220 | 223 |
|
221 | 224 | for key in ceOptions: |
222 | 225 | if key in INTEGER_PARAMETERS: |
@@ -252,6 +255,7 @@ def available(self): |
252 | 255 | runningJobs = result["RunningJobs"] |
253 | 256 | waitingJobs = result["WaitingJobs"] |
254 | 257 | availableProcessors = result.get("AvailableProcessors") |
| 258 | + |
255 | 259 | ceInfoDict = dict(result) |
256 | 260 |
|
257 | 261 | maxTotalJobs = int(self.ceParameters.get("MaxTotalJobs", 0)) |
@@ -404,6 +408,7 @@ def getDescription(self): |
404 | 408 | result = self.getCEStatus() |
405 | 409 | if result["OK"]: |
406 | 410 | ceDict["NumberOfProcessors"] = result.get("AvailableProcessors", result.get("NumberOfProcessors", 1)) |
| 411 | + ceDict["MaxRAM"] = result.get("AvailableRAM", result.get("MaxRAM", 1024)) |
407 | 412 | else: |
408 | 413 | self.log.error( |
409 | 414 | "Failure getting CE status", "(we keep going without the number of waiting and running pilots/jobs)" |
|
0 commit comments