From: ribes Date: Thu, 15 May 2008 14:26:47 +0000 (+0000) Subject: - Separate batch test from CORBA method submitSalomeJob X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=fe2094482c5ad982609a79a10b8c8c51dbc48f66;p=modules%2Fkernel.git - Separate batch test from CORBA method submitSalomeJob - Add testBatch to Launcher --- diff --git a/idl/SALOME_ContainerManager.idl b/idl/SALOME_ContainerManager.idl index 8d2258cf5..d3b9fd6b5 100644 --- a/idl/SALOME_ContainerManager.idl +++ b/idl/SALOME_ContainerManager.idl @@ -99,6 +99,8 @@ struct BatchParameters void deleteSalomeJob( in long jobId, in MachineParameters params ) raises (SALOME::SALOME_Exception); void getResultSalomeJob( in string directory, in long jobId, in MachineParameters params ) raises (SALOME::SALOME_Exception); + boolean testBatch(in MachineParameters params) raises (SALOME::SALOME_Exception); + void Shutdown(); long getPID(); diff --git a/src/Launcher/SALOME_Launcher.cxx b/src/Launcher/SALOME_Launcher.cxx index c0ac5f2ac..8120d73f0 100644 --- a/src/Launcher/SALOME_Launcher.cxx +++ b/src/Launcher/SALOME_Launcher.cxx @@ -139,15 +139,7 @@ CORBA::Long SALOME_Launcher::submitSalomeJob( const char * fileToExecute , // search batch manager for that cluster in map or instanciate one std::map < string, BatchLight::BatchManager * >::const_iterator it = _batchmap.find(clustername); if(it == _batchmap.end()) - { - BatchLight_BatchTest t(*p); - if (t.test()) - _batchmap[clustername] = FactoryBatchManager(p); - else - { - throw SALOME_Exception("Test of the batch machine failed - see messages in the SALOME_Launcher log"); - } - } + _batchmap[clustername] = FactoryBatchManager(p); // create and submit job on cluster BatchLight::Job* job = new BatchLight::Job(fileToExecute, filesToExport, filesToImport, batch_params); @@ -165,6 +157,51 @@ CORBA::Long SALOME_Launcher::submitSalomeJob( const char * fileToExecute , return jobId; } +//============================================================================= +/*! CORBA Method: + * the test batch configuration + * \param params : The batch cluster + */ +//============================================================================= +CORBA::Boolean +SALOME_Launcher::testBatch(const Engines::MachineParameters& params) +{ + MESSAGE("BEGIN OF SALOME_Launcher::testBatch"); + CORBA::Boolean rtn = false; + try + { + // find a cluster matching the structure params + Engines::CompoList aCompoList ; + Engines::MachineList *aMachineList = _ResManager->GetFittingResources(params, aCompoList); + if (aMachineList->length() == 0) + throw SALOME_Exception("No resources have been found with your parameters"); + + const Engines::MachineParameters* p = _ResManager->GetMachineParameters((*aMachineList)[0]); + string clustername(p->alias); + INFOS("Choose cluster" << clustername); + BatchLight_BatchTest t(*p); + if (t.test()) + { + rtn = true; + // search batch manager for that cluster in map or instanciate one + std::map < string, BatchLight::BatchManager * >::const_iterator it = _batchmap.find(clustername); + if(it == _batchmap.end()) + { + _batchmap[clustername] = FactoryBatchManager(p); + } + } + else + { + throw SALOME_Exception("Test of the batch machine failed - see messages in the SALOME_Launcher log"); + } + } + catch(const SALOME_Exception &ex){ + INFOS(ex.what()); + THROW_SALOME_CORBA_EXCEPTION(ex.what(),SALOME::INTERNAL_ERROR); + } + return rtn; +} + //============================================================================= /*! CORBA Method: * Query a batch job on a cluster and returns the status of job diff --git a/src/Launcher/SALOME_Launcher.hxx b/src/Launcher/SALOME_Launcher.hxx index 25e65e25a..281f6d8bf 100644 --- a/src/Launcher/SALOME_Launcher.hxx +++ b/src/Launcher/SALOME_Launcher.hxx @@ -63,6 +63,8 @@ public: void deleteSalomeJob( const CORBA::Long jobId, const Engines::MachineParameters& params); void getResultSalomeJob( const char * directory, const CORBA::Long jobId, const Engines::MachineParameters& params ); + CORBA::Boolean testBatch(const Engines::MachineParameters& params); + void Shutdown(); CORBA::Long getPID();