From: secher Date: Thu, 27 Jan 2011 10:45:35 +0000 (+0000) Subject: add getJobDumpState function X-Git-Tag: Start_BR_19998_21191~87 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=94c529f487a8cf23bd6e8dfbdef344b84385e9ad;p=modules%2Fkernel.git add getJobDumpState function --- diff --git a/idl/SALOME_ContainerManager.idl b/idl/SALOME_ContainerManager.idl index 6b44687ab..965c7b0e1 100644 --- a/idl/SALOME_ContainerManager.idl +++ b/idl/SALOME_ContainerManager.idl @@ -209,6 +209,7 @@ interface SalomeLauncher void launchJob (in long job_id) raises (SALOME::SALOME_Exception); string getJobState (in long job_id) raises (SALOME::SALOME_Exception); void getJobResults(in long job_id, in string directory) raises (SALOME::SALOME_Exception); + boolean getJobDumpState(in long job_id, in string directory) raises (SALOME::SALOME_Exception); void removeJob (in long job_id) raises (SALOME::SALOME_Exception); // Useful methods diff --git a/src/Launcher/Launcher.cxx b/src/Launcher/Launcher.cxx index 3211ce253..d4d3c116e 100644 --- a/src/Launcher/Launcher.cxx +++ b/src/Launcher/Launcher.cxx @@ -269,6 +269,43 @@ Launcher_cpp::getJobResults(int job_id, std::string directory) LAUNCHER_MESSAGE("getJobResult ended"); } +//============================================================================= +/*! + * Get Job dump state - the result directory could be changed + */ +//============================================================================= +bool +Launcher_cpp::getJobDumpState(int job_id, std::string directory) +{ + bool rtn; + LAUNCHER_MESSAGE("Get Job dump state"); + + // Check if job exist + std::map::const_iterator it_job = _launcher_job_map.find(job_id); + if (it_job == _launcher_job_map.end()) + { + LAUNCHER_INFOS("Cannot find the job, is it created ? job number: " << job_id); + throw LauncherException("Cannot find the job, is it created ?"); + } + + Launcher::Job * job = it_job->second; + std::string resource_name = job->getResourceDefinition().Name; + try + { + if (directory != "") + rtn = _batchmap[resource_name]->importDumpStateFile(*(job->getBatchJob()), directory); + else + rtn = _batchmap[resource_name]->importDumpStateFile(*(job->getBatchJob()), job->getResultDirectory()); + } + catch(const Batch::EmulationException &ex) + { + LAUNCHER_INFOS("getJobResult is maybe incomplete, exception: " << ex.message); + throw LauncherException(ex.message.c_str()); + } + LAUNCHER_MESSAGE("getJobResult ended"); + return rtn; +} + //============================================================================= /*! * Remove the job - into the Launcher and its batch manager diff --git a/src/Launcher/Launcher.hxx b/src/Launcher/Launcher.hxx index 57aabac59..0cc3c16f0 100644 --- a/src/Launcher/Launcher.hxx +++ b/src/Launcher/Launcher.hxx @@ -62,6 +62,7 @@ public: void launchJob(int job_id); const char * getJobState(int job_id); void getJobResults(int job_id, std::string directory); + bool getJobDumpState(int job_id, std::string directory); void removeJob(int job_id); // Useful methods diff --git a/src/Launcher/SALOME_Launcher.cxx b/src/Launcher/SALOME_Launcher.cxx index 3c832ebba..abf1e2389 100644 --- a/src/Launcher/SALOME_Launcher.cxx +++ b/src/Launcher/SALOME_Launcher.cxx @@ -229,6 +229,22 @@ SALOME_Launcher::getJobResults(CORBA::Long job_id, const char * directory) } } +CORBA::Boolean +SALOME_Launcher::getJobDumpState(CORBA::Long job_id, const char * directory) +{ + CORBA::Boolean rtn = false; + try + { + rtn = _l.getJobDumpState(job_id, directory); + } + catch(const LauncherException &ex) + { + INFOS(ex.msg.c_str()); + THROW_SALOME_CORBA_EXCEPTION(ex.msg.c_str(),SALOME::BAD_PARAM); + } + return rtn; +} + void SALOME_Launcher::removeJob(CORBA::Long job_id) { diff --git a/src/Launcher/SALOME_Launcher.hxx b/src/Launcher/SALOME_Launcher.hxx index fff5515e2..cc12af427 100644 --- a/src/Launcher/SALOME_Launcher.hxx +++ b/src/Launcher/SALOME_Launcher.hxx @@ -50,6 +50,7 @@ public: void launchJob (CORBA::Long job_id); char * getJobState (CORBA::Long job_id); void getJobResults(CORBA::Long job_id, const char * directory); + CORBA::Boolean getJobDumpState(CORBA::Long job_id, const char * directory); void removeJob (CORBA::Long job_id); // Useful methods