From: barate Date: Fri, 11 Jun 2010 09:18:25 +0000 (+0000) Subject: Fixed Launcher to allow compilation with libBatch 1.1.0 X-Git-Tag: V6_1_0a1 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=2877b55f24cdf0a2bc068128a6911339b296ad10;p=modules%2Fkernel.git Fixed Launcher to allow compilation with libBatch 1.1.0 --- diff --git a/src/Launcher/Launcher.cxx b/src/Launcher/Launcher.cxx index 8489de9b2..e5d8e9dc8 100644 --- a/src/Launcher/Launcher.cxx +++ b/src/Launcher/Launcher.cxx @@ -22,12 +22,9 @@ #ifdef WITH_LIBBATCH #include -#include -#include -#include +#include +#include #include -#include -#include #endif #include "Basics_Utils.hxx" @@ -395,34 +392,35 @@ Launcher_cpp::FactoryBatchManager(ParserResourcesType& params) mpi = "nompi"; } - std::string message = "Instanciation of batch manager of type: "; + const char * bmType; switch( params.Batch ) { case pbs: - message += "ePBS"; - fact = new Batch::FactBatchManager_ePBS; + bmType = "ePBS"; break; case lsf: - message += "eLSF"; - fact = new Batch::FactBatchManager_eLSF; + bmType = "eLSF"; break; case sge: - message += "eSGE"; - fact = new Batch::FactBatchManager_eSGE; + bmType = "eSGE"; break; case ccc: - message += "eCCC"; - fact = new Batch::FactBatchManager_eCCC; + bmType = "eCCC"; break; case ssh_batch: - message += "eSSH"; - fact = new Batch::FactBatchManager_eSSH; + bmType = "eSSH"; break; default: LAUNCHER_MESSAGE("Bad batch description of the resource: Batch = " << params.Batch); throw LauncherException("No batchmanager for that cluster - Bad batch description of the resource"); } - LAUNCHER_MESSAGE(message); + Batch::BatchManagerCatalog & cata = Batch::BatchManagerCatalog::getInstance(); + fact = dynamic_cast(cata(bmType)); + if (fact == NULL) { + LAUNCHER_MESSAGE("Cannot find batch manager factory for " << bmType << ". Check your version of libBatch."); + throw LauncherException("Cannot find batch manager factory"); + } + LAUNCHER_MESSAGE("Instanciation of batch manager of type: " << bmType); return (*fact)(hostname.c_str(), protocol, mpi.c_str(), nb_proc_per_node); }