Skip to content

Commit f032011

Browse files
committed
test: added tests for RAM limits
1 parent 6efae4b commit f032011

File tree

2 files changed

+44
-0
lines changed

2 files changed

+44
-0
lines changed

src/DIRAC/tests/Utilities/testJobDefinitions.py

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -282,6 +282,42 @@ def wholeNodeJob():
282282
return endOfAllJobs(J)
283283

284284

285+
def memory_4GB():
286+
"""simple hello world job, with a memory requirement of 4 GB and MultiProcessor tags"""
287+
288+
J = baseToAllJobs("memory_4GB")
289+
try:
290+
J.setInputSandbox([find_all("mpTest.py", rootPath, "DIRAC/tests/Utilities")[0]])
291+
except IndexError:
292+
try:
293+
J.setInputSandbox([find_all("mpTest.py", ".", "DIRAC/tests/Utilities")[0]])
294+
except IndexError: # we are in Jenkins
295+
J.setInputSandbox([find_all("mpTest.py", os.environ["WORKSPACE"], "DIRAC/tests/Utilities")[0]])
296+
297+
J.setExecutable("mpTest.py")
298+
J.setNumberOfProcessors(numberOfProcessors=2)
299+
J.setTag("4GB")
300+
return endOfAllJobs(J)
301+
302+
303+
def memory_2_to4GB():
304+
"""simple hello world job, with a memory requirement of 2 to 4 GB and MultiProcessor tags"""
305+
306+
J = baseToAllJobs("memory_2_to_4GB")
307+
try:
308+
J.setInputSandbox([find_all("mpTest.py", rootPath, "DIRAC/tests/Utilities")[0]])
309+
except IndexError:
310+
try:
311+
J.setInputSandbox([find_all("mpTest.py", ".", "DIRAC/tests/Utilities")[0]])
312+
except IndexError: # we are in Jenkins
313+
J.setInputSandbox([find_all("mpTest.py", os.environ["WORKSPACE"], "DIRAC/tests/Utilities")[0]])
314+
315+
J.setExecutable("mpTest.py")
316+
J.setNumberOfProcessors(numberOfProcessors=2)
317+
J.setTag(["2GB", "4GB_MAX"])
318+
return endOfAllJobs(J)
319+
320+
285321
def parametricJob():
286322
"""Creates a parametric job with 3 subjobs which are simple hello world jobs"""
287323

tests/System/unitTestUserJobs.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,14 @@ def test_submit(self):
106106
self.assertTrue(res["OK"])
107107
jobsSubmittedList.append(res["Value"])
108108

109+
res = memory_4GB()
110+
self.assertTrue(res["OK"])
111+
jobsSubmittedList.append(res["Value"])
112+
113+
res = memory_2_to4GB()
114+
self.assertTrue(res["OK"])
115+
jobsSubmittedList.append(res["Value"])
116+
109117
res = parametricJob()
110118
self.assertTrue(res["OK"])
111119
jobsSubmittedList.append(res["Value"])

0 commit comments

Comments
 (0)