Salome HOME
Copyright update 2022
[modules/yacs.git] / src / yacsloader_swig / Test / testWorkloadManager.py
index 965283530d3c5180d690df423ed06e4134bf1ecc..d1f299b06f05ce1edffda9a228fa2139462dcd18 100755 (executable)
@@ -1,5 +1,5 @@
 #!/usr/bin/env python3
-# Copyright (C) 2006-2021  CEA/DEN, EDF R&D
+# Copyright (C) 2006-2022  CEA/DEN, EDF R&D
 #
 # This library is free software; you can redistribute it and/or
 # modify it under the terms of the GNU Lesser General Public
@@ -36,12 +36,13 @@ class TestEdit(unittest.TestCase):
         self.l = loader.YACSLoader()
         self.e = pilot.ExecutorSwig()
         # We need a catalog which contains only one resource named "localhost"
-        # with 16 cores. The modifications made here are not saved to the
+        # with NB_NODE cores. The modifications made here are not saved to the
         # catalog file.
         salome.salome_init()
         resourceManager = salome.lcc.getResourcesManager()
         resource_definition = resourceManager.GetResourceDefinition("localhost")
         resource_definition.nb_node = NB_NODE
+        resource_definition.nb_proc_per_node = 1
         resourceManager.AddResource(resource_definition, False, "")
         resource_required = salome.ResourceParameters()
         resource_required.can_run_containers = True
@@ -51,6 +52,7 @@ class TestEdit(unittest.TestCase):
             resourceManager.RemoveResource(r, False, "")
         resource_definition = resourceManager.GetResourceDefinition("localhost")
         self.assertEqual(resource_definition.nb_node, NB_NODE)
+        self.assertEqual(resource_definition.nb_proc_per_node, 1)
 
     def tearDown(self):
         cm = salome.lcc.getContainerManager()
@@ -117,6 +119,13 @@ class TestEdit(unittest.TestCase):
         self.assertEqual(proc.getState(),pilot.FAILED)
         self.assertEqual(proc.getChildByName("ErrorNode").getState(),pilot.ERROR)
 
+    def test5(self):
+        """ Foreach with 1000 points and several nodes in the block.
+        """
+        proc = self.l.load("samples/wlm_complex_foreach.xml")
+        self.e.RunW(proc,0)
+        self.assertEqual(proc.getState(),pilot.DONE)
+
 if __name__ == '__main__':
   dir_test = tempfile.mkdtemp(suffix=".yacstest")
   file_test = os.path.join(dir_test,"UnitTestsResult")