]> SALOME platform Git repositories - modules/kernel.git/commitdiff
Salome HOME
- Patch PBS sh file
authorribes <ribes>
Thu, 14 Feb 2008 13:29:56 +0000 (13:29 +0000)
committerribes <ribes>
Thu, 14 Feb 2008 13:29:56 +0000 (13:29 +0000)
- cout to cerr for debug messages

bin/runSalome.py
src/DSC/DSC_Basic/DSC_i.cxx
src/DSC/DSC_User/Datastream/Calcium/CalciumTypes2CorbaTypes.cxx
src/DSC/DSC_User/Datastream/Calcium/CorbaTypes2CalciumTypes.cxx
src/DSC/DSC_User/Superv_Component_i.cxx
src/Launcher/BatchLight_BatchManager.cxx
src/Launcher/BatchLight_BatchManager_PBS.cxx

index 7645a1519d34babe2720417fd020a730c7229a52..f20b507944fefc072e52db5d699c029baa45c428 100755 (executable)
@@ -393,6 +393,18 @@ def startSalome(args, modules_list, modules_root_dir):
     #
    
     clt=orbmodule.client(args)
+    # Save Naming service port name into
+    # the file args["ns_port_log_file"]
+    if args.has_key('ns_port_log_file'):
+      home = os.environ['HOME']
+      appli= os.environ.get("APPLI")
+      if appli is not None:
+        home='%s/%s'%(home,appli)
+        pass
+      file_name= '%s/%s'%(home, args["ns_port_log_file"])
+      f = open(file_name, "w")
+      f.write(os.environ['NSPORT'])
+      f.close()
 
     # (non obligatoire) Lancement Logger Server
     # et attente de sa disponibilite dans le naming service
@@ -784,12 +796,6 @@ def searchFreePort(args, save_config=1):
                 else:            
                     system('ln -s -f %s %s/.omniORB_last.cfg'%(os.environ['OMNIORB_CONFIG'], home))     
                 pass
-            #
-            if args.has_key('ns_port_log_file'):
-              file_name= '%s/%s'%(home, args["ns_port_log_file"])
-              f = open(file_name, "w")
-              f.write(os.environ['NSPORT'])
-              f.close()
             break
         print "%s"%(NSPORT),
         if NSPORT == limit:
index 41b5adcea99d584163de9052b21f18b798bcba49..bf67a554cbd382c6e93e4cb6bc57cae2c5999619 100644 (file)
@@ -37,7 +37,9 @@ Engines_DSC_i(CORBA::ORB_ptr orb,
                                                          instanceName, 
                                                          interfaceName) 
 {
-  std::cout << "--Engines_DSC_i: MARK 1 --" << instanceName << "----" << std::endl;
+#ifdef _DEBUG_
+  std::cerr << "--Engines_DSC_i: MARK 1 --" << instanceName << "----" << std::endl;
+#endif
 }
 
 Engines_DSC_i::~Engines_DSC_i() {}
index 5cf6d10c5433c09bdee97e244fdf507d1370c0dc..5f7dcc18b7e132415669614298dac6ef80c410c3 100644 (file)
@@ -49,11 +49,11 @@ table[CalciumTypes::UNDEFINED_DEPENDENCY ] = Ports::Calcium_Ports::UNDEFINED_DEP
 
 
 #ifdef _DEBUG_
-std::cout << "CORBA_DEPENDENCY_TYPE() : table["<<CalciumTypes::TIME_DEPENDENCY<<"] : "<< 
+std::cerr << "CORBA_DEPENDENCY_TYPE() : table["<<CalciumTypes::TIME_DEPENDENCY<<"] : "<< 
   table[CalciumTypes::TIME_DEPENDENCY] << std::endl;
-std::cout << "CORBA_DEPENDENCY_TYPE() : table["<<CalciumTypes::ITERATION_DEPENDENCY<<"] : "<< 
+std::cerr << "CORBA_DEPENDENCY_TYPE() : table["<<CalciumTypes::ITERATION_DEPENDENCY<<"] : "<< 
   table[CalciumTypes::ITERATION_DEPENDENCY] << std::endl;
-std::cout << "CORBA_DEPENDENCY_TYPE() : table["<<CalciumTypes::UNDEFINED_DEPENDENCY<<"] : "<< 
+std::cerr << "CORBA_DEPENDENCY_TYPE() : table["<<CalciumTypes::UNDEFINED_DEPENDENCY<<"] : "<< 
   table[CalciumTypes::UNDEFINED_DEPENDENCY] << std::endl;
 #endif
 }
@@ -67,7 +67,7 @@ Ports::Calcium_Ports::DependencyType CORBA_DEPENDENCY_TYPE::operator[]( const Ca
             Ports::Calcium_Ports::DependencyType >& ) *this ;
 
 #ifdef _DEBUG_
-std::cout << "CORBA_DEPENDENCY_TYPE() : ::operator["<<c<<"]: " << table[c] << std::endl;
+std::cerr << "CORBA_DEPENDENCY_TYPE() : ::operator["<<c<<"]: " << table[c] << std::endl;
 #endif
 
   assert( table.find( (CalciumTypes::DependencyType)c ) != table.end() ) ;
index 7c827dbb5ff0160b235887d28957149c2e942100..8ae28c91c73dff23e582f981d394a4e2a07ed86c 100644 (file)
@@ -49,11 +49,11 @@ table[Ports::Calcium_Ports::UNDEFINED_DEPENDENCY ] = CalciumTypes::UNDEFINED_DEP
 
 
 #ifdef _DEBUG_
-std::cout << "DEPENDENCY_TYPE() : table["<<Ports::Calcium_Ports::TIME_DEPENDENCY<<"] : "<< 
+std::cerr << "DEPENDENCY_TYPE() : table["<<Ports::Calcium_Ports::TIME_DEPENDENCY<<"] : "<< 
   table[Ports::Calcium_Ports::TIME_DEPENDENCY] << std::endl;
-std::cout << "DEPENDENCY_TYPE() : table["<<Ports::Calcium_Ports::ITERATION_DEPENDENCY<<"] : "<< 
+std::cerr << "DEPENDENCY_TYPE() : table["<<Ports::Calcium_Ports::ITERATION_DEPENDENCY<<"] : "<< 
   table[Ports::Calcium_Ports::ITERATION_DEPENDENCY] << std::endl;
-std::cout << "DEPENDENCY_TYPE() : table["<<Ports::Calcium_Ports::UNDEFINED_DEPENDENCY<<"] : "<< 
+std::cerr << "DEPENDENCY_TYPE() : table["<<Ports::Calcium_Ports::UNDEFINED_DEPENDENCY<<"] : "<< 
   table[Ports::Calcium_Ports::UNDEFINED_DEPENDENCY] << std::endl;
 #endif
 }
@@ -66,7 +66,7 @@ CalciumTypes::DependencyType DEPENDENCY_TYPE::operator[]( const Ports::Calcium_P
                                            CalciumTypes::DependencyType>&)*this ;
 
 #ifdef _DEBUG_
-std::cout << "DEPENDENCY_TYPE() : ::operator["<<c<<"]: " << table[c] << std::endl;
+std::cerr << "DEPENDENCY_TYPE() : ::operator["<<c<<"]: " << table[c] << std::endl;
 #endif
 
   assert( table.find( (Ports::Calcium_Ports::DependencyType)c ) != table.end() ) ;
index e94cad7c828c3cb29208b263b498fe8d4a4d6c57..72cbef19bc6ac13c1269a357745a7d7358c0fc2e 100644 (file)
@@ -44,7 +44,7 @@ Superv_Component_i::Superv_Component_i(CORBA::ORB_ptr orb,
   Engines_DSC_i(orb, poa, contId, instanceName, interfaceName) 
 {
 #ifdef _DEBUG_
-  std::cout << "--Superv_Component_i : MARK 1 ----  " << instanceName << "----" << std::endl;
+  std::cerr << "--Superv_Component_i : MARK 1 ----  " << instanceName << "----" << std::endl;
 #endif
   register_factory("BASIC", new basic_port_factory());
   register_factory("PALM", new palm_port_factory());
@@ -155,11 +155,11 @@ Superv_Component_i::add_port(const char * port_fab_type,
   }
   else if (s_port_type == "uses") {
 #ifdef _DEBUG_
-    std::cout << "---- Superv_Component_i::add_port : MARK 1 ---- "  << std::endl;
+    std::cerr << "---- Superv_Component_i::add_port : MARK 1 ---- "  << std::endl;
 #endif
     uses_port * port = create_uses_data_port(port_fab_type);
 #ifdef _DEBUG_
-    std::cout << "---- Superv_Component_i::add_port : MARK 2 ---- "  << std::endl;
+    std::cerr << "---- Superv_Component_i::add_port : MARK 2 ---- "  << std::endl;
 #endif
     add_port(port, port_name);
   }
index 449c8962c3ad0b0c927fe8ce7bcbe6c291fc383e..37def271e53710ab0efe5a6d419607fdc690abeb 100644 (file)
@@ -227,8 +227,16 @@ namespace BatchLight {
       command += directory;
       SCRUTE(command.c_str());
       status = system(command.c_str());
-      if(status)
-       throw SALOME_Exception("Error of connection on remote host");    
+      if(status) 
+      {
+       // Try to get what we can (logs files)
+       // throw SALOME_Exception("Error of connection on remote host");    
+       std::string mess("Copy command failed ! status is :");
+       ostringstream status_str;
+       status_str << status;
+       mess += status_str.str();
+       INFOS(mess);
+      }
     }
 
     END_OF("BatchManager::importOutputFiles");
index 7085f08b463ea6cd003d328387a015950a18630d..d586c13b3c593235ca8c5168534b47f65eb30f90 100644 (file)
@@ -180,26 +180,57 @@ namespace BatchLight {
 
     ofstream tempOutputFile;
     tempOutputFile.open(TmpFileName.c_str(), ofstream::out );
+    
+    // Begin
     tempOutputFile << "#! /bin/sh -f" << endl ;
     tempOutputFile << "cd " ;
     tempOutputFile << _params.applipath << endl ;
+    tempOutputFile << "export SALOME_BATCH=1\n";
     tempOutputFile << "export PYTHONPATH=~/" ;
     tempOutputFile << dirForTmpFiles ;
     tempOutputFile << ":$PYTHONPATH" << endl ;
+
+    // Test node rank
     tempOutputFile << "if test " ;
     tempOutputFile << _mpiImpl->rank() ;
     tempOutputFile << " = 0; then" << endl ;
+
+    // -----------------------------------------------
+    // Code for rank 0 : launch runAppli and a container
+    // RunAppli
     tempOutputFile << "  ./runAppli --terminal --modules=" ;
     for ( int i = 0 ; i < _params.modulesList.size() ; i++ ) {
       tempOutputFile << _params.modulesList[i] ;
       if ( i != _params.modulesList.size()-1 )
        tempOutputFile << "," ;
     }
-    //tempOutputFile << " --standalone=registry,study,moduleCatalog --killall &" << endl ;
     tempOutputFile << " --standalone=registry,study,moduleCatalog --ns-port-log="
                   << filelogtemp 
                   << " &\n";
-    tempOutputFile << "  for ((ip=1; ip < ";
+
+    // Wait NamingService
+    tempOutputFile << "  current=0\n"
+                  << "  stop=20\n" 
+                  << "  while ! test -f " << filelogtemp << "\n"
+                  << "  do\n"
+                  << "    sleep 2\n"
+                  << "    let current=current+1\n"
+                  << "    if [ \"$current\" -eq \"$stop\" ] ; then\n"
+                  << "      echo Error Naming Service failed ! >&2"
+                  << "      exit\n"
+                  << "    fi\n"
+                  << "  done\n"
+                  << "  port=`cat " << filelogtemp << "`\n";
+    
+    // Launch a container
+    tempOutputFile << "  ./runSession SALOME_Container 'YACS_Server_'"
+                  << _mpiImpl->rank()
+                  << " > ~/" << dirForTmpFiles << "/YACS_Server_" 
+                  << _mpiImpl->rank() << "_container_log.${PBS_JOBID}"
+                  << " 2>&1 &\n";
+
+    // Wait other containers
+    tempOutputFile << "  for ((ip=0; ip < ";
     tempOutputFile << _mpiImpl->size();
     tempOutputFile << " ; ip++))" << endl;
     tempOutputFile << "  do" << endl ;
@@ -207,22 +238,39 @@ namespace BatchLight {
     tempOutputFile << "  done" << endl ;
     tempOutputFile << "  sleep 5" << endl ;
     tempOutputFile << "  ./runSession waitContainers.py $arglist" << endl ;
-    tempOutputFile << "  ./runSession python ~/" << dirForTmpFiles << "/" << fileNameToExecute << ".py" << endl;
-
-    //tempOutputFile << "  ./runSession killCurrentPort" << endl;
-    tempOutputFile << "  if [ -f \"" << filelogtemp << "\" ]\n"
-                  << "  then\n"
-                  << "    port=`cat " << filelogtemp << "`\n"
-                  << "    rm " << filelogtemp << "\n"
-                  << "  fi\n"
+
+    // Launch user script
+    tempOutputFile << "  ./runSession python ~/" << dirForTmpFiles << "/" << fileNameToExecute << ".py\n";
+
+    // Stop application
+    tempOutputFile << "  rm " << filelogtemp << "\n"
                   << "  ./runSession killSalomeWithPort.py $port\n";
-    
+   
+    // -------------------------------------
+    // Other nodes launch a container
     tempOutputFile << "else" << endl ;
-    tempOutputFile << "  sleep 5" << endl ;
-    tempOutputFile << "  ./runSession waitNS.py" << endl ;
+    
+    // Wait NamingService
+    tempOutputFile << "  current=0\n"
+                  << "  stop=20\n" 
+                  << "  while ! test -f " << filelogtemp << "\n"
+                  << "  do\n"
+                  << "    sleep 2\n"
+                  << "    let current=current+1\n"
+                  << "    if [ \"$current\" -eq \"$stop\" ] ; then\n"
+                  << "      echo Error Naming Service failed ! >&2"
+                  << "      exit\n"
+                  << "    fi\n"
+                  << "  done\n"
+                  << "  port=`cat " << filelogtemp << "`\n";
+
+    // Launching container
     tempOutputFile << "  ./runSession SALOME_Container 'YACS_Server_'";
-    tempOutputFile << _mpiImpl->rank() << endl ;
-    tempOutputFile << "fi" << endl ;
+    tempOutputFile << _mpiImpl->rank()
+                  << " > ~/" << dirForTmpFiles << "/YACS_Server_" 
+                  << _mpiImpl->rank() << "_container_log.${PBS_JOBID}"
+                  << " 2>&1\n";
+    tempOutputFile << "fi" << endl;
     tempOutputFile.flush();
     tempOutputFile.close();
     chmod(TmpFileName.c_str(), 0x1ED);
@@ -290,8 +338,8 @@ namespace BatchLight {
 
     tempOutputFile << "#! /bin/sh -f" << endl ;
     tempOutputFile << "#PBS -l nodes=" << nbnodes << endl ;
-    tempOutputFile << "#PBS -o /$PBS_O_HOME/" << dirForTmpFiles << "/runSalome.output.log" << endl ;
-    tempOutputFile << "#PBS -e /$PBS_O_HOME/" << dirForTmpFiles << "/runSalome.error.log" << endl ;
+    tempOutputFile << "#PBS -o /$PBS_O_HOME/" << dirForTmpFiles << "/runSalome.output.log.${PBS_JOBID}" << endl ;
+    tempOutputFile << "#PBS -e /$PBS_O_HOME/" << dirForTmpFiles << "/runSalome.error.log.${PBS_JOBID}" << endl ;
     tempOutputFile << _mpiImpl->boot("${PBS_NODEFILE}",nbnodes);
     tempOutputFile << _mpiImpl->run("${PBS_NODEFILE}",nbproc,filenameToExecute.str());
     tempOutputFile << _mpiImpl->halt();
@@ -326,11 +374,14 @@ namespace BatchLight {
   
     // Adding log files into import list files
     ostringstream file_name_output;
-    file_name_output << "~/" << dirForTmpFiles << "/" << "runSalome.output.log";
+    file_name_output << "~/" << dirForTmpFiles << "/" << "runSalome.output.log*";
     ostringstream file_name_error;
-    file_name_error << "~/" << dirForTmpFiles << "/" << "runSalome.error.log";
+    file_name_error << "~/" << dirForTmpFiles << "/" << "runSalome.error.log*";
+    ostringstream file_container_log;
+    file_container_log << "~/" << dirForTmpFiles << "/" << "YACS_Server*";
     job->addFileToImportList(file_name_output.str());
     job->addFileToImportList(file_name_error.str());
+    job->addFileToImportList(file_container_log.str());
     RmTmpFile(TmpFileName);
     END_OF("BatchManager_PBS::buildSalomeBatchScript");
   }