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 stopJob (in long job_id) raises (SALOME::SALOME_Exception);
void removeJob (in long job_id) raises (SALOME::SALOME_Exception);
// Useful methods
_launcher_job_map.erase(it_job);
}
+//=============================================================================
+/*!
+ * stop the job
+ */
+//=============================================================================
+void
+Launcher_cpp::stopJob(int job_id)
+{
+ LAUNCHER_MESSAGE("Stop Job");
+
+ // Check if job exist
+ std::map<int, Launcher::Job *>::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 ?");
+ }
+
+ it_job->second->stopJob();
+}
+
//=============================================================================
/*!
* create a launcher job based on a file
const char * getJobState(int job_id);
void getJobResults(int job_id, std::string directory);
bool getJobDumpState(int job_id, std::string directory);
+ void stopJob(int job_id);
void removeJob(int job_id);
// Useful methods
#endif
}
+void
+Launcher::Job::stopJob()
+{
+ LAUNCHER_MESSAGE("Stop resquested for job number: " << _number);
+ setState("FAILED");
+#ifdef WITH_LIBBATCH
+ if (_batch_job_id.getReference() != "undefined")
+ {
+ try
+ {
+ _batch_job_id.deleteJob();
+ }
+ catch (const Batch::EmulationException &ex)
+ {
+ LAUNCHER_INFOS("WARNING: exception when stopping the job: " << ex.message);
+ }
+ }
+#endif
+}
+
+
void
Launcher::Job::removeJob()
{
Launcher::Job::updateJobState()
{
- if (_state != "FINISHED" ||
- _state != "ERROR" ||
+ if (_state != "FINISHED" &&
+ _state != "ERROR" &&
_state != "FAILED")
{
#ifdef WITH_LIBBATCH
// Xml method
void addToXmlDocument(xmlNodePtr root_node);
+ void stopJob();
void removeJob();
// Abstract class
}
}
+void
+SALOME_Launcher::stopJob(CORBA::Long job_id)
+{
+ try
+ {
+ _l.stopJob(job_id);
+ std::ostringstream job_id_str;
+ job_id_str << job_id;
+ notifyObservers("UPDATE_JOB_STATE", job_id_str.str());
+ }
+ catch(const LauncherException &ex)
+ {
+ INFOS(ex.msg.c_str());
+ THROW_SALOME_CORBA_EXCEPTION(ex.msg.c_str(),SALOME::BAD_PARAM);
+ }
+}
+
//=============================================================================
/*! CORBA Method:
* Create a job in the launcher with a file
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 stopJob (CORBA::Long job_id);
void removeJob (CORBA::Long job_id);
// Useful methods