From: ribes Date: Tue, 4 Nov 2008 14:55:33 +0000 (+0000) Subject: - Adding to CatalogResources to new fields: X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=refs%2Fheads%2FBR_For40_DSC;p=modules%2Fkernel.git - Adding to CatalogResources to new fields: batchQueue -> specify the batch queue userCommands -> adds these commands to the Salomé generated batch script --- diff --git a/src/Batch/Batch_BatchManager_eLSF.cxx b/src/Batch/Batch_BatchManager_eLSF.cxx index 0b359eae2..77778833e 100644 --- a/src/Batch/Batch_BatchManager_eLSF.cxx +++ b/src/Batch/Batch_BatchManager_eLSF.cxx @@ -253,6 +253,7 @@ namespace Batch { const std::string dirForTmpFiles = params[TMPDIR]; const string fileToExecute = params[EXECUTABLE]; const string home = params[HOMEDIR]; + const std::string queue = params[QUEUE]; std::string rootNameToExecute; std::string fileNameToExecute; std::string filelogtemp; @@ -274,6 +275,8 @@ namespace Batch { tempOutputFile.open(TmpFileName.c_str(), ofstream::out ); tempOutputFile << "#! /bin/sh -f" << endl ; + if (queue != "") + tempOutputFile << "#BSUB -q " << queue << endl; if( edt > 0 ) tempOutputFile << "#BSUB -W " << getWallTime(edt) << endl ; if( mem > 0 ) diff --git a/src/Batch/Batch_BatchManager_ePBS.cxx b/src/Batch/Batch_BatchManager_ePBS.cxx index 2f3bf1824..a24ad178d 100644 --- a/src/Batch/Batch_BatchManager_ePBS.cxx +++ b/src/Batch/Batch_BatchManager_ePBS.cxx @@ -247,6 +247,7 @@ namespace Batch { const std::string dirForTmpFiles = params[TMPDIR]; const string fileToExecute = params[EXECUTABLE]; const string home = params[HOMEDIR]; + const std::string queue = params[QUEUE]; std::string rootNameToExecute; std::string fileNameToExecute; std::string filelogtemp; @@ -268,6 +269,8 @@ namespace Batch { tempOutputFile.open(TmpFileName.c_str(), ofstream::out ); tempOutputFile << "#! /bin/sh -f" << endl; + if (queue != "") + tempOutputFile << "#BSUB -q " << queue << endl; if( edt > 0 ) tempOutputFile << "#PBS -l walltime=" << edt*60 << endl ; if( mem > 0 ) diff --git a/src/Launcher/Launcher.cxx b/src/Launcher/Launcher.cxx index 15ff35ebd..f27e68ee3 100644 --- a/src/Launcher/Launcher.cxx +++ b/src/Launcher/Launcher.cxx @@ -264,6 +264,7 @@ long Launcher_cpp::submitSalomeJob( const string fileToExecute , param[MAXWALLTIME] = getWallTime(batch_params.expected_during_time); param[MAXRAMSIZE] = getRamSize(batch_params.mem); param[HOMEDIR] = getHomeDir(p, tmpdir); + param[QUEUE] = p.batchQueue; Batch::Environnement env; @@ -516,6 +517,10 @@ string Launcher_cpp::buildSalomeCouplingScript(const string fileToExecute, const tempOutputFile << dirForTmpFiles ; tempOutputFile << ":$PYTHONPATH" << endl ; + // Adding user script + std::string script = params.userCommands; + if (script != "") + tempOutputFile << script << endl; // Test node rank tempOutputFile << "if test \"" ; tempOutputFile << mpiImpl->rank() ; diff --git a/src/ResourcesManager/SALOME_ResourcesCatalog_Handler.cxx b/src/ResourcesManager/SALOME_ResourcesCatalog_Handler.cxx index df16779b3..899daa885 100755 --- a/src/ResourcesManager/SALOME_ResourcesCatalog_Handler.cxx +++ b/src/ResourcesManager/SALOME_ResourcesCatalog_Handler.cxx @@ -65,6 +65,8 @@ SALOME_ResourcesCatalog_Handler(MapOfParserResourcesType& resources_list, test_cpu_freq_mhz = "CPUFreqMHz"; test_nb_of_nodes = "nbOfNodes"; test_nb_of_proc_per_node = "nbOfProcPerNode"; + test_batch_queue = "batchQueue"; + test_user_commands = "userCommands"; } //============================================================================= @@ -131,6 +133,24 @@ void SALOME_ResourcesCatalog_Handler::ProcessXmlDocument(xmlDocPtr theDoc) else _resource.Alias = ""; + if (xmlHasProp(aCurNode, (const xmlChar*)test_batch_queue)) + { + xmlChar* batch_queue = xmlGetProp(aCurNode, (const xmlChar*)test_batch_queue); + _resource.batchQueue = (const char*)batch_queue; + xmlFree(batch_queue); + } + else + _resource.batchQueue = ""; + + if (xmlHasProp(aCurNode, (const xmlChar*)test_user_commands)) + { + xmlChar* user_commands= xmlGetProp(aCurNode, (const xmlChar*)test_user_commands); + _resource.userCommands = (const char*)user_commands; + xmlFree(user_commands); + } + else + _resource.userCommands = ""; + if (xmlHasProp(aCurNode, (const xmlChar*)test_protocol)) { xmlChar* protocol= xmlGetProp(aCurNode, (const xmlChar*)test_protocol); @@ -350,7 +370,9 @@ void SALOME_ResourcesCatalog_Handler::PrepareDocToXmlFile(xmlDocPtr theDoc) node = xmlNewChild(root_node, NULL, BAD_CAST test_machine, NULL); xmlNewProp(node, BAD_CAST test_hostname, BAD_CAST (*iter).second.HostName.c_str()); xmlNewProp(node, BAD_CAST test_alias, BAD_CAST (*iter).second.Alias.c_str()); - + xmlNewProp(node, BAD_CAST test_batch_queue, BAD_CAST (*iter).second.batchQueue.c_str()); + xmlNewProp(node, BAD_CAST test_user_commands, BAD_CAST (*iter).second.userCommands.c_str()); + switch ((*iter).second.Protocol) { case rsh: diff --git a/src/ResourcesManager/SALOME_ResourcesCatalog_Handler.hxx b/src/ResourcesManager/SALOME_ResourcesCatalog_Handler.hxx index 152b5c58e..c65a35b4c 100755 --- a/src/ResourcesManager/SALOME_ResourcesCatalog_Handler.hxx +++ b/src/ResourcesManager/SALOME_ResourcesCatalog_Handler.hxx @@ -79,6 +79,8 @@ class RESOURCESMANAGER_EXPORT SALOME_ResourcesCatalog_Handler const char *test_cpu_freq_mhz; const char *test_nb_of_nodes; const char *test_nb_of_proc_per_node; + const char *test_batch_queue; + const char *test_user_commands; }; diff --git a/src/ResourcesManager/SALOME_ResourcesCatalog_Parser.cxx b/src/ResourcesManager/SALOME_ResourcesCatalog_Parser.cxx index 33b363ca1..f86403b83 100644 --- a/src/ResourcesManager/SALOME_ResourcesCatalog_Parser.cxx +++ b/src/ResourcesManager/SALOME_ResourcesCatalog_Parser.cxx @@ -129,6 +129,8 @@ void ParserResourcesType::Print() const "UserName : " << UserName << endl << "AppliPath : " << AppliPath << endl << "OS : " << OS << endl << + "batchQueue : " << batchQueue << endl << + "userCommands : " << userCommands << endl << "Modules : " << endl; for(int i=0;i ModulesList; std::string OS; + std::string batchQueue; + std::string userCommands; void Print() const; void Clear();