From: secher Date: Fri, 29 Jun 2007 09:34:56 +0000 (+0000) Subject: improvement to manage batch on ccrt X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=e82455938e29d7abf96a1bf5c55c2ae8c3684035;p=modules%2Fkernel.git improvement to manage batch on ccrt --- diff --git a/bin/Makefile.am b/bin/Makefile.am index f50343d19..97a23267f 100644 --- a/bin/Makefile.am +++ b/bin/Makefile.am @@ -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 index 000000000..65198a3e3 --- /dev/null +++ b/bin/waitContainers.py @@ -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 index 000000000..e439f5fef --- /dev/null +++ b/bin/waitNS.py @@ -0,0 +1,4 @@ +#!/usr/bin/env python +import orbmodule +clt=orbmodule.client() +clt.waitNS("/Kernel/ModulCatalog") diff --git a/src/ResourcesManager/SALOME_ResourcesManager.cxx b/src/ResourcesManager/SALOME_ResourcesManager.cxx index 6e4b446db..536909ff9 100644 --- a/src/ResourcesManager/SALOME_ResourcesManager.cxx +++ b/src/ResourcesManager/SALOME_ResourcesManager.cxx @@ -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 ;