]> SALOME platform Git repositories - modules/kernel.git/commitdiff
Salome HOME
improvement to manage batch on ccrt
authorsecher <secher>
Fri, 29 Jun 2007 09:34:56 +0000 (09:34 +0000)
committersecher <secher>
Fri, 29 Jun 2007 09:34:56 +0000 (09:34 +0000)
bin/Makefile.am
bin/waitContainers.py [new file with mode: 0755]
bin/waitNS.py [new file with mode: 0755]
src/ResourcesManager/SALOME_ResourcesManager.cxx

index f50343d1967e378d5b059af06e8a02db739dfec6..97a23267f4645a701ebfa1c99dd7c3a61d4891e5 100644 (file)
@@ -57,7 +57,9 @@ dist_salomescript_SCRIPTS=\
        launchConfigureParser.py \
        showNS.py \
        addToKillList.py \
-       NSparam.py
+       NSparam.py \
+       waitNS.py \
+       waitContainers.py
 
 EXTRA_DIST = appliskel
 
diff --git a/bin/waitContainers.py b/bin/waitContainers.py
new file mode 100755 (executable)
index 0000000..65198a3
--- /dev/null
@@ -0,0 +1,53 @@
+#!/usr/bin/env python
+import sys
+import time
+import orbmodule
+import CosNaming
+clt = orbmodule.client()
+clt.waitNS("/ContainerManager")
+obj = clt.orb.resolve_initial_references("NameService")
+rootContext = obj._narrow(CosNaming.NamingContext)
+cname = []
+cname.append(CosNaming.NameComponent('Containers', 'dir'))
+
+while(1):
+  try:
+    ccontext = rootContext.resolve(cname)
+    break
+  except CosNaming.NamingContext.NotFound, ex:
+    time.sleep(1)
+  except CosNaming.NamingContext.InvalidName, ex:
+    time.sleep(1)
+  except CosNaming.NamingContext.CannotProceed, ex:
+    time.sleep(1)
+  except (CORBA.TRANSIENT,CORBA.OBJECT_NOT_EXIST,CORBA.COMM_FAILURE):
+    time.sleep(1)
+
+def waitContainer(mycont):
+  while(1):
+    bl,bi=ccontext.list(0)
+    if bi is not None:
+      ok,b=bi.next_one()
+      while(ok):
+        for s in b.binding_name :
+          if s.kind == "dir":
+            obj=ccontext.resolve([s])
+            scontext = obj._narrow(CosNaming.NamingContext)
+            bll,bii=scontext.list(0)
+            if bii is not None:
+              ok,bb=bii.next_one()
+              while(ok):
+                for s in bb.binding_name :
+                   if s.id == mycont:
+                     print s.id
+                     return
+                ok,bb=bii.next_one()
+        ok,b=bi.next_one()
+    sys.stdout.write('+')
+    sys.stdout.flush()
+    time.sleep(1)
+
+for cont in sys.argv:
+  if cont != sys.argv[0]:
+    waitContainer(cont)
+
diff --git a/bin/waitNS.py b/bin/waitNS.py
new file mode 100755 (executable)
index 0000000..e439f5f
--- /dev/null
@@ -0,0 +1,4 @@
+#!/usr/bin/env python
+import orbmodule
+clt=orbmodule.client()
+clt.waitNS("/Kernel/ModulCatalog")
index 6e4b446db09e1143d2c6e8672d84e107c76e1b1a..536909ff993b2557b275ead24ddd582523c560e1 100644 (file)
@@ -635,9 +635,11 @@ std::string SALOME_ResourcesManager::BuildCmdrunSalomeBatch(
   tempOutputFile << "  do" << endl ;
   tempOutputFile << "    arglist=\"$arglist YACS_Server_\"$ip" << endl ;
   tempOutputFile << "  done" << endl ;
-  tempOutputFile << "  ./runSession waitContainers.sh $arglist" << endl ;
+  tempOutputFile << "  sleep 1" << endl ;
+  tempOutputFile << "  ./runSession waitContainers.py $arglist" << endl ;
   tempOutputFile << "  ./runSession python " << DirForTmpFiles << "/" << FileNameToExecute << ".py" << endl;
   tempOutputFile << "else" << endl ;
+  tempOutputFile << "  sleep 1" << endl ;
   tempOutputFile << "  ./runSession waitNS.py" << endl ;
   tempOutputFile << "  ./runSession SALOME_Container 'YACS_Server_'${SLURM_PROCID}" << endl ;
   tempOutputFile << "fi" << endl ;