]> SALOME platform Git repositories - modules/yacs.git/commitdiff
Salome HOME
fix
authorCédric Aguerre <cedric.aguerre@edf.fr>
Mon, 16 Feb 2015 17:41:48 +0000 (18:41 +0100)
committerCédric Aguerre <cedric.aguerre@edf.fr>
Mon, 16 Feb 2015 17:41:48 +0000 (18:41 +0100)
bin/salomeContext.py

index 3dfaa46d9bde52459719a006d1a7ca813b6e3411..7ea73cea3844d88b25e4b70d22f56692f0ad2b3d 100644 (file)
@@ -112,19 +112,26 @@ class SalomeContext:
   def runSalome(self, args):
     # Run this module as a script, in order to use appropriate Python interpreter
     # according to current path (initialized from environment files).
-#    kill = False
-#    for e in args:
-#      if "--shutdown-server" in e:
-#        kill = True
-#        args.remove(e)
+    mpi_module_option = "--with_mpi_module="
+    mpi_module = [x for x in args if x.startswith(mpi_module_option)]
+    if mpi_module:
+      mpi_module = mpi_module[0][len(mpi_module_option):]
+      print "Trying to load MPI module: %s..."%mpi_module,
+      try:
+        out, err = subprocess.call(["modulecmd", "python", "load", mpi_module]).communicate()
+        exec out # define specific environment variables
+        print " OK"
+      except:
+        print " ** Failed **"
+        pass
+      args = [x for x in args if not x.startswith(mpi_module_option)]
+      pass
 
     import os
     absoluteAppliPath = os.getenv('ABSOLUTE_APPLI_PATH','')
     env_copy = os.environ.copy()
     proc = subprocess.Popen(['python', os.path.join(absoluteAppliPath,"bin","salome","salomeContext.py"), pickle.dumps(self), pickle.dumps(args)], shell=False, close_fds=True, env=env_copy)
     msg = proc.communicate()
- #   if kill:
- #     self._killAll(args)
     return msg, proc.returncode
   #
 
@@ -237,21 +244,6 @@ class SalomeContext:
       # try to default to "start" command
       command = "_runAppli"
 
-    mpi_module_option = "--with_mpi_module="
-    mpi_module = [x for x in args if x.startswith(mpi_module_option)]
-    if mpi_module:
-      mpi_module = mpi_module[0][len(mpi_module_option):]
-      print "Trying to load MPI module: %s..."%mpi_module,
-      import subprocess
-      try:
-        subprocess.call(["module", "load", mpi_module])
-        print " OK"
-      except:
-        print " ** Failed **"
-        pass
-      options = [x for x in options if not x.startswith(mpi_module_option)]
-      pass
-
     try:
       res = getattr(self, command)(options) # run appropriate method
       return res or (None, None)