From: barate Date: Mon, 14 Jan 2013 17:12:02 +0000 (+0000) Subject: Adapt to the merge of BatchManager_eClient into BatchManager X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=ff4832ec086e705bbf73ade823434ed3f89ee8e0;p=modules%2Fkernel.git Adapt to the merge of BatchManager_eClient into BatchManager --- diff --git a/src/Launcher/Launcher.cxx b/src/Launcher/Launcher.cxx index d749f8258..fcea8e445 100644 --- a/src/Launcher/Launcher.cxx +++ b/src/Launcher/Launcher.cxx @@ -23,8 +23,8 @@ #ifdef WITH_LIBBATCH #include #include -#include -#include +#include +#include #endif #include "Basics_Utils.hxx" @@ -65,7 +65,7 @@ Launcher_cpp::~Launcher_cpp() std::map::const_iterator it_job; for(it_job = _launcher_job_map.begin(); it_job != _launcher_job_map.end(); it_job++) delete it_job->second; - std::map ::const_iterator it1; + std::map ::const_iterator it1; for(it1=_batchmap.begin();it1!=_batchmap.end();it1++) delete it1->second; #endif @@ -131,7 +131,7 @@ Launcher_cpp::launchJob(int job_id) // Third step search batch manager for the job into the map -> instanciate one if does not exist #ifdef WITH_LIBBATCH - std::map::const_iterator it = _batchmap.find(job_id); + std::map::const_iterator it = _batchmap.find(job_id); if(it == _batchmap.end()) { createBatchManagerForJob(job); @@ -143,7 +143,7 @@ Launcher_cpp::launchJob(int job_id) job->setBatchManagerJobId(batch_manager_job_id); job->setState("QUEUED"); } - catch(const Batch::EmulationException &ex) + catch(const Batch::GenericException &ex) { LAUNCHER_INFOS("Job is not launched, exception in submitJob: " << ex.message); throw LauncherException(ex.message.c_str()); @@ -176,12 +176,7 @@ Launcher_cpp::getJobState(int job_id) { state = job->updateJobState(); } - catch(const Batch::EmulationException &ex) - { - LAUNCHER_INFOS("getJobState failed, exception: " << ex.message); - throw LauncherException(ex.message.c_str()); - } - catch(const Batch::RunTimeException &ex) + catch(const Batch::GenericException &ex) { LAUNCHER_INFOS("getJobState failed, exception: " << ex.message); throw LauncherException(ex.message.c_str()); @@ -217,7 +212,7 @@ Launcher_cpp::getJobResults(int job_id, std::string directory) else _batchmap[job_id]->importOutputFiles(*(job->getBatchJob()), job->getResultDirectory()); } - catch(const Batch::EmulationException &ex) + catch(const Batch::GenericException &ex) { LAUNCHER_INFOS("getJobResult is maybe incomplete, exception: " << ex.message); throw LauncherException(ex.message.c_str()); @@ -253,7 +248,7 @@ Launcher_cpp::getJobDumpState(int job_id, std::string directory) else rtn = _batchmap[job_id]->importDumpStateFile(*(job->getBatchJob()), job->getResultDirectory()); } - catch(const Batch::EmulationException &ex) + catch(const Batch::GenericException &ex) { LAUNCHER_INFOS("getJobResult is maybe incomplete, exception: " << ex.message); throw LauncherException(ex.message.c_str()); @@ -366,12 +361,12 @@ Launcher_cpp::createJobWithFile(const std::string xmlExecuteFile, * Factory to instanciate the good batch manager for choosen cluster. */ //============================================================================= -Batch::BatchManager_eClient * +Batch::BatchManager * Launcher_cpp::FactoryBatchManager(ParserResourcesType& params) { std::string mpi; Batch::CommunicationProtocolType protocol; - Batch::FactBatchManager_eClient* fact; + Batch::FactBatchManager * fact; int nb_proc_per_node = params.DataForSort._nbOfProcPerNode; std::string hostname = params.HostName; @@ -420,42 +415,42 @@ Launcher_cpp::FactoryBatchManager(ParserResourcesType& params) switch( params.Batch ) { case pbs: - bmType = "ePBS"; + bmType = "PBS"; break; case lsf: - bmType = "eLSF"; + bmType = "LSF"; break; case sge: - bmType = "eSGE"; + bmType = "SGE"; break; case ccc: - bmType = "eCCC"; + bmType = "CCC"; break; case slurm: - bmType = "eSLURM"; + bmType = "SLURM"; break; case ssh_batch: - bmType = "eSSH"; + bmType = "LOCAL"; break; case ll: - bmType = "eLL"; + bmType = "LL"; break; case vishnu: - bmType = "eVISHNU"; + bmType = "VISHNU"; 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"); } Batch::BatchManagerCatalog & cata = Batch::BatchManagerCatalog::getInstance(); - fact = dynamic_cast(cata(bmType)); + 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); - Batch::BatchManager_eClient * batch_client = (*fact)(hostname.c_str(), params.UserName.c_str(), - protocol, mpi.c_str(), nb_proc_per_node); + Batch::BatchManager * batch_client = (*fact)(hostname.c_str(), params.UserName.c_str(), + protocol, mpi.c_str(), nb_proc_per_node); return batch_client; } @@ -614,7 +609,7 @@ Launcher_cpp::createBatchManagerForJob(Launcher::Job * job) // Step 2: We can now add a Factory if the resource is correctly define #ifdef WITH_LIBBATCH - std::map::const_iterator it = _batchmap.find(job_id); + std::map::const_iterator it = _batchmap.find(job_id); if(it == _batchmap.end()) { try @@ -622,7 +617,7 @@ Launcher_cpp::createBatchManagerForJob(Launcher::Job * job) // Warning cannot write on one line like this, because map object is constructed before // the method is called... //_batchmap[job_id] = FactoryBatchManager(resource_definition); - Batch::BatchManager_eClient * batch_client = FactoryBatchManager(resource_definition); + Batch::BatchManager * batch_client = FactoryBatchManager(resource_definition); _batchmap[job_id] = batch_client; } catch(const LauncherException &ex) @@ -630,12 +625,7 @@ Launcher_cpp::createBatchManagerForJob(Launcher::Job * job) LAUNCHER_INFOS("Error during creation of the batch manager of the job, mess: " << ex.msg); throw ex; } - catch(const Batch::EmulationException &ex) - { - LAUNCHER_INFOS("Error during creation of the batch manager of the job, mess: " << ex.message); - throw LauncherException(ex.message); - } - catch(const Batch::InvalidArgumentException &ex) + catch(const Batch::GenericException &ex) { LAUNCHER_INFOS("Error during creation of the batch manager of the job, mess: " << ex.message); throw LauncherException(ex.message); @@ -665,7 +655,7 @@ Launcher_cpp::addJobDirectlyToMap(Launcher::Job * new_job, const std::string job job_reference); new_job->setBatchManagerJobId(batch_manager_job_id); } - catch(const Batch::EmulationException &ex) + catch(const Batch::GenericException &ex) { LAUNCHER_INFOS("Job cannot be added, exception in addJob: " << ex.message); throw LauncherException(ex.message.c_str()); diff --git a/src/Launcher/Launcher.hxx b/src/Launcher/Launcher.hxx index f459fca2c..9faae9206 100644 --- a/src/Launcher/Launcher.hxx +++ b/src/Launcher/Launcher.hxx @@ -39,7 +39,7 @@ class MpiImpl; namespace Batch{ - class BatchManager_eClient; + class BatchManager; class Job; } @@ -83,8 +83,8 @@ protected: // Methods used by user interface methods #ifdef WITH_LIBBATCH - Batch::BatchManager_eClient *FactoryBatchManager(ParserResourcesType& params); - std::map _batchmap; + Batch::BatchManager *FactoryBatchManager(ParserResourcesType& params); + std::map _batchmap; #endif ParserLauncherType ParseXmlFile(std::string xmlExecuteFile); diff --git a/src/Launcher/Launcher_Job.cxx b/src/Launcher/Launcher_Job.cxx index 1307fbf22..e51b7a4d3 100644 --- a/src/Launcher/Launcher_Job.cxx +++ b/src/Launcher/Launcher_Job.cxx @@ -79,7 +79,7 @@ Launcher::Job::stopJob() { _batch_job_id.deleteJob(); } - catch (const Batch::EmulationException &ex) + catch (const Batch::GenericException &ex) { LAUNCHER_INFOS("WARNING: exception when stopping the job: " << ex.message); } @@ -99,7 +99,7 @@ Launcher::Job::removeJob() { _batch_job_id.deleteJob(); } - catch (const Batch::EmulationException &ex) + catch (const Batch::GenericException &ex) { LAUNCHER_INFOS("WARNING: exception when removing the job: " << ex.message); } @@ -482,7 +482,6 @@ Launcher::Job::common_job_params() _work_directory += thedate; } params[Batch::WORKDIR] = _work_directory; - params[Batch::TMPDIR] = _work_directory; // To Compatibility -- remove ??? TODO // If result_directory is not defined, we use HOME environnement if (_result_directory == "") diff --git a/src/Launcher/Launcher_Job.hxx b/src/Launcher/Launcher_Job.hxx index bbff80f54..15d69bdc8 100644 --- a/src/Launcher/Launcher_Job.hxx +++ b/src/Launcher/Launcher_Job.hxx @@ -41,7 +41,7 @@ #include #include #include -#include +#include #endif #include