Salome HOME
Add the possibility to retrieve one single file with SalomeLauncher.
[modules/yacs.git] / src / Launcher / SALOME_Launcher.cxx
1 // Copyright (C) 2007-2014  CEA/DEN, EDF R&D, OPEN CASCADE
2 //
3 // Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
5 //
6 // This library is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU Lesser General Public
8 // License as published by the Free Software Foundation; either
9 // version 2.1 of the License, or (at your option) any later version.
10 //
11 // This library is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14 // Lesser General Public License for more details.
15 //
16 // You should have received a copy of the GNU Lesser General Public
17 // License along with this library; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
19 //
20 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
21 //
22
23 #include "SALOME_Launcher.hxx"
24 #include "BatchTest.hxx"
25 #include "OpUtil.hxx"
26 #include "SALOME_ContainerManager.hxx"
27 #include "Utils_CorbaException.hxx"
28
29
30 #include "Launcher_Job_Command.hxx"
31 #include "Launcher_Job_YACSFile.hxx"
32 #include "Launcher_Job_PythonSALOME.hxx"
33
34 #ifdef WIN32
35 # include <process.h>
36 #else
37 # include <unistd.h>
38 #endif
39 #include <sys/types.h>
40 #include <vector>
41 #include <list>
42
43 #include <stdio.h>
44 #include <sstream>
45
46 using namespace std;
47
48 const char *SALOME_Launcher::_LauncherNameInNS = "/SalomeLauncher";
49
50 //=============================================================================
51 /*! 
52  *  Constructor
53  *  \param orb
54  */
55 //=============================================================================
56 SALOME_Launcher::SALOME_Launcher(CORBA::ORB_ptr orb, PortableServer::POA_var poa) : _l()
57 {
58   MESSAGE("SALOME_Launcher constructor");
59   _NS = new SALOME_NamingService(orb);
60   _ResManager = new SALOME_ResourcesManager(orb,poa,_NS);
61   _l.SetResourcesManager(_ResManager->GetImpl());
62   _ContManager = new SALOME_ContainerManager(orb,poa,_ResManager,_NS);
63   _ResManager->_remove_ref();
64   _ContManager->_remove_ref();
65
66   _orb = CORBA::ORB::_duplicate(orb) ;
67   _poa = PortableServer::POA::_duplicate(poa) ;
68   PortableServer::ObjectId_var id = _poa->activate_object(this);
69   CORBA::Object_var obj = _poa->id_to_reference(id);
70   Engines::SalomeLauncher_var refContMan = Engines::SalomeLauncher::_narrow(obj);
71
72   _NS->Register(refContMan,_LauncherNameInNS);
73   MESSAGE("SALOME_Launcher constructor end");
74 }
75
76 //=============================================================================
77 /*! 
78  * destructor
79  */
80 //=============================================================================
81 SALOME_Launcher::~SALOME_Launcher()
82 {
83   MESSAGE("SALOME_Launcher destructor");
84   delete _NS;
85   MESSAGE("SALOME_Launcher destructor end");
86 }
87
88
89 CORBA::Long 
90 SALOME_Launcher::createJob(const Engines::JobParameters & job_parameters)
91 {
92   std::string job_type = job_parameters.job_type.in();
93
94   if (job_type != "command" && job_type != "yacs_file" && job_type != "python_salome")
95   {
96     std::string message("SALOME_Launcher::createJob: bad job type: ");
97     message += job_type;
98     THROW_SALOME_CORBA_EXCEPTION(message.c_str(), SALOME::INTERNAL_ERROR);
99   }
100
101   Launcher::Job * new_job; // It is Launcher_cpp that is going to destroy it
102
103   if (job_type == "command")
104     new_job = new Launcher::Job_Command();
105   else if (job_type == "yacs_file")
106     new_job = new Launcher::Job_YACSFile();
107   else if (job_type == "python_salome")
108     new_job = new Launcher::Job_PythonSALOME();
109
110   // Name
111   new_job->setJobName(job_parameters.job_name.in());
112
113   // Directories
114   std::string work_directory = job_parameters.work_directory.in();
115   std::string local_directory = job_parameters.local_directory.in();
116   std::string result_directory = job_parameters.result_directory.in();
117   new_job->setWorkDirectory(work_directory);
118   new_job->setLocalDirectory(local_directory);
119   new_job->setResultDirectory(result_directory);
120
121   // Parameters for COORM
122   std::string launcher_file = job_parameters.launcher_file.in();
123   std::string launcher_args = job_parameters.launcher_args.in();
124   new_job->setLauncherFile(launcher_file);
125   new_job->setLauncherArgs(launcher_args);
126
127   // Job File
128   std::string job_file = job_parameters.job_file.in();
129   try
130   {
131     new_job->setJobFile(job_file);
132   }
133   catch(const LauncherException &ex)
134   {
135     INFOS(ex.msg.c_str());
136     THROW_SALOME_CORBA_EXCEPTION(ex.msg.c_str(),SALOME::INTERNAL_ERROR);
137   }
138
139   // Files
140   std::string env_file = job_parameters.env_file.in();
141   new_job->setEnvFile(env_file);
142   for (CORBA::ULong i = 0; i < job_parameters.in_files.length(); i++)
143     new_job->add_in_file(job_parameters.in_files[i].in());
144   for (CORBA::ULong i = 0; i < job_parameters.out_files.length(); i++)
145     new_job->add_out_file(job_parameters.out_files[i].in());
146
147   // Expected During Time
148   try
149   {
150     std::string maximum_duration = job_parameters.maximum_duration.in();
151     new_job->setMaximumDuration(maximum_duration);
152   }
153   catch(const LauncherException &ex){
154     INFOS(ex.msg.c_str());
155     THROW_SALOME_CORBA_EXCEPTION(ex.msg.c_str(),SALOME::INTERNAL_ERROR);
156   }
157
158   // Queue
159   std::string queue = job_parameters.queue.in();
160   new_job->setQueue(queue);
161
162   // Exclusive
163   new_job->setExclusive(job_parameters.exclusive);
164
165   // Memory required per CPU
166   new_job->setMemPerCpu(job_parameters.mem_per_cpu);
167
168   // WC Key
169   std::string wckey = job_parameters.wckey.in();
170   new_job->setWCKey(wckey);
171
172   // Extra params
173   std::string extra_params = job_parameters.extra_params.in();
174   new_job->setExtraParams(extra_params);
175
176   // Resources requirements
177   try
178   {
179     resourceParams p;
180     p.name = job_parameters.resource_required.name;
181     p.hostname = job_parameters.resource_required.hostname;
182     p.OS = job_parameters.resource_required.OS;
183     p.nb_proc = job_parameters.resource_required.nb_proc;
184     p.nb_node = job_parameters.resource_required.nb_node;
185     p.nb_proc_per_node = job_parameters.resource_required.nb_proc_per_node;
186     p.cpu_clock = job_parameters.resource_required.cpu_clock;
187     p.mem_mb = job_parameters.resource_required.mem_mb;
188     new_job->setResourceRequiredParams(p);
189   }
190   catch(const LauncherException &ex){
191     INFOS(ex.msg.c_str());
192     THROW_SALOME_CORBA_EXCEPTION(ex.msg.c_str(),SALOME::INTERNAL_ERROR);
193   }
194
195   // Adding specific parameters to the job
196   for (CORBA::ULong i = 0; i < job_parameters.specific_parameters.length(); i++)
197     new_job->addSpecificParameter(job_parameters.specific_parameters[i].name.in(),
198                                   job_parameters.specific_parameters[i].value.in());
199   try
200   {
201     new_job->checkSpecificParameters();
202   }
203   catch(const LauncherException &ex)
204   {
205     INFOS(ex.msg.c_str());
206     THROW_SALOME_CORBA_EXCEPTION(ex.msg.c_str(),SALOME::INTERNAL_ERROR);
207   }
208
209   try
210   {
211     _l.createJob(new_job);
212     std::ostringstream job_id;
213     job_id << new_job->getNumber();
214     notifyObservers("NEW_JOB", job_id.str());
215   }
216   catch(const LauncherException &ex)
217   {
218     INFOS(ex.msg.c_str());
219     THROW_SALOME_CORBA_EXCEPTION(ex.msg.c_str(),SALOME::BAD_PARAM);
220   }
221   return new_job->getNumber();
222 }
223
224 void 
225 SALOME_Launcher::launchJob(CORBA::Long job_id)
226 {
227   try
228   {
229     _l.launchJob(job_id);
230   }
231   catch(const LauncherException &ex)
232   {
233     INFOS(ex.msg.c_str());
234     THROW_SALOME_CORBA_EXCEPTION(ex.msg.c_str(),SALOME::BAD_PARAM);
235   }
236 }
237
238 char *
239 SALOME_Launcher::getJobState(CORBA::Long job_id)
240 {
241   std::string result;
242   try
243   {
244     result = _l.getJobState(job_id);
245   }
246   catch(const LauncherException &ex)
247   {
248     INFOS(ex.msg.c_str());
249     THROW_SALOME_CORBA_EXCEPTION(ex.msg.c_str(),SALOME::BAD_PARAM);
250   }
251   return CORBA::string_dup(result.c_str());
252 }
253
254 // Get names or ids of hosts assigned to the job
255 char *
256 SALOME_Launcher::getAssignedHostnames(CORBA::Long job_id)
257 {
258   std::string result;
259   try
260   {
261     result = _l.getAssignedHostnames(job_id);
262   }
263   catch(const LauncherException &ex)
264   {
265     INFOS(ex.msg.c_str());
266     THROW_SALOME_CORBA_EXCEPTION(ex.msg.c_str(),SALOME::BAD_PARAM);
267   }
268   return CORBA::string_dup(result.c_str());
269 }
270
271 void
272 SALOME_Launcher::getJobResults(CORBA::Long job_id, const char * directory)
273 {
274   try
275   {
276     _l.getJobResults(job_id, directory);
277   }
278   catch(const LauncherException &ex)
279   {
280     INFOS(ex.msg.c_str());
281     THROW_SALOME_CORBA_EXCEPTION(ex.msg.c_str(),SALOME::BAD_PARAM);
282   }
283 }
284
285 CORBA::Boolean
286 SALOME_Launcher::getJobDumpState(CORBA::Long job_id, const char * directory)
287 {
288   CORBA::Boolean rtn = false;
289   try
290   {
291     rtn = _l.getJobDumpState(job_id, directory);
292   }
293   catch(const LauncherException &ex)
294   {
295     INFOS(ex.msg.c_str());
296     THROW_SALOME_CORBA_EXCEPTION(ex.msg.c_str(),SALOME::BAD_PARAM);
297   }
298   return rtn;
299 }
300
301 CORBA::Boolean
302 SALOME_Launcher::getJobWorkFile(CORBA::Long job_id, const char * work_file, const char * directory)
303 {
304   CORBA::Boolean rtn = false;
305   try
306   {
307     rtn = _l.getJobWorkFile(job_id, work_file, directory);
308   }
309   catch(const LauncherException &ex)
310   {
311     INFOS(ex.msg.c_str());
312     THROW_SALOME_CORBA_EXCEPTION(ex.msg.c_str(),SALOME::BAD_PARAM);
313   }
314   return rtn;
315 }
316
317 void 
318 SALOME_Launcher::removeJob(CORBA::Long job_id)
319 {
320   try
321   {
322     _l.removeJob(job_id);
323     std::ostringstream job_id_str;
324     job_id_str << job_id;
325     notifyObservers("REMOVE_JOB", job_id_str.str());
326   }
327   catch(const LauncherException &ex)
328   {
329     INFOS(ex.msg.c_str());
330     THROW_SALOME_CORBA_EXCEPTION(ex.msg.c_str(),SALOME::BAD_PARAM);
331   }
332 }
333
334 void 
335 SALOME_Launcher::stopJob(CORBA::Long job_id)
336 {
337   try
338   {
339     _l.stopJob(job_id);
340     std::ostringstream job_id_str;
341     job_id_str << job_id;
342     notifyObservers("UPDATE_JOB_STATE", job_id_str.str());
343   }
344   catch(const LauncherException &ex)
345   {
346     INFOS(ex.msg.c_str());
347     THROW_SALOME_CORBA_EXCEPTION(ex.msg.c_str(),SALOME::BAD_PARAM);
348   }
349 }
350
351 //=============================================================================
352 /*! CORBA Method:
353  *  Create a job in the launcher with a file
354  *  \param xmlExecuteFile     : .xml to parse that contains job description
355  *  \param clusterName        : machine choosed
356  */
357 //=============================================================================
358 CORBA::Long 
359 SALOME_Launcher::createJobWithFile(const char * xmlExecuteFile,
360                                    const char * clusterName)
361 {
362   CORBA::Long jobId;
363   try{
364     jobId = _l.createJobWithFile(xmlExecuteFile, clusterName);
365   }
366   catch(const LauncherException &ex){
367     INFOS(ex.msg.c_str());
368     THROW_SALOME_CORBA_EXCEPTION(ex.msg.c_str(),SALOME::INTERNAL_ERROR);
369   }
370
371   return jobId;
372 }
373
374 //=============================================================================
375 /*! CORBA Method:
376  *  the test batch configuration 
377  *  \param params             : The batch cluster
378  */
379 //=============================================================================
380 CORBA::Boolean 
381 SALOME_Launcher::testBatch(const Engines::ResourceParameters& params)
382 {
383   MESSAGE("BEGIN OF SALOME_Launcher::testBatch");
384   CORBA::Boolean rtn = false;
385   try
386   {
387     // Consider only resources that can run batch jobs
388     Engines::ResourceParameters new_params(params);
389     new_params.can_launch_batch_jobs = true;
390
391     // find a resource matching the required parameters
392     Engines::ResourceList *aMachineList = _ResManager->GetFittingResources(new_params);
393     if (aMachineList->length() == 0)
394       throw SALOME_Exception("No resources have been found with your parameters");
395
396     const Engines::ResourceDefinition* p = _ResManager->GetResourceDefinition((*aMachineList)[0]);
397         std::string resource_name(p->name);
398     INFOS("Choose resource for test: " <<  resource_name);
399     
400     BatchTest t(*p);
401     if (t.test()) 
402     {
403       rtn = true;
404     }
405   }
406   catch(const LauncherException &ex){
407     INFOS(ex.msg.c_str());
408     THROW_SALOME_CORBA_EXCEPTION(ex.msg.c_str(),SALOME::INTERNAL_ERROR);
409   }
410   return rtn;
411 }
412
413 //=============================================================================
414 /*! CORBA method:
415  *  shutdown all the containers, then the ContainerManager servant
416  */
417 //=============================================================================
418 void SALOME_Launcher::Shutdown()
419 {
420   MESSAGE("Shutdown");
421   _NS->Destroy_Name(_LauncherNameInNS);
422   _ContManager->Shutdown();
423   _ResManager->Shutdown();
424   PortableServer::ObjectId_var oid = _poa->servant_to_id(this);
425   _poa->deactivate_object(oid);
426   if(!CORBA::is_nil(_orb))
427     _orb->shutdown(0);
428 }
429
430 //=============================================================================
431 /*! CORBA Method:
432  *  Returns the PID of the process
433  */
434 //=============================================================================
435 CORBA::Long SALOME_Launcher::getPID()
436 {
437   return 
438 #ifndef WIN32
439     (CORBA::Long)getpid();
440 #else
441     (CORBA::Long)_getpid();
442 #endif
443 }
444
445 //=============================================================================
446 /*! CORBA Method:
447  *  Returns current launcher jobs list
448  */
449 //=============================================================================
450 Engines::JobsList *
451 SALOME_Launcher::getJobsList()
452 {
453   Engines::JobsList_var jobs_list = new Engines::JobsList();
454   std::map<int, Launcher::Job *> cpp_jobs = _l.getJobs();
455   std::map<int, Launcher::Job *>::const_iterator it_job;
456   int list_id = 0;
457   for(it_job = cpp_jobs.begin(); it_job != cpp_jobs.end(); it_job++)
458   {
459     int number          = it_job->first;
460     try
461     {
462       // Prepare CORBA job description
463       Engines::JobDescription_var job_descr = new Engines::JobDescription();
464       Engines::JobParameters_var job_parameters = getJobParameters(number);
465       job_descr->job_id = number;
466       job_descr->job_parameters = job_parameters;
467
468       // Add job description to the sequence
469       jobs_list->length(list_id + 1);
470       jobs_list[list_id] = job_descr;
471       list_id++;
472     }
473     catch (...) {}
474   }
475   return jobs_list._retn();
476 }
477
478 //=============================================================================
479 /*! CORBA Method:
480  * Returns the job description
481  */
482 //=============================================================================
483 Engines::JobParameters *
484 SALOME_Launcher::getJobParameters(CORBA::Long job_id)
485 {
486   std::map<int, Launcher::Job *> cpp_jobs = _l.getJobs();
487   std::map<int, Launcher::Job *>::const_iterator it_job = cpp_jobs.find(job_id);
488   if (it_job == cpp_jobs.end())
489   {
490     INFOS("Cannot find the job, is it created ? job number: " << job_id);
491     THROW_SALOME_CORBA_EXCEPTION("Job does not exist", SALOME::INTERNAL_ERROR);
492   }
493
494   Launcher::Job * job = it_job->second;
495   Engines::JobParameters_var job_parameters = new Engines::JobParameters;
496   job_parameters->job_name         = CORBA::string_dup(job->getJobName().c_str());
497   job_parameters->job_type         = CORBA::string_dup(job->getJobType().c_str());
498   job_parameters->job_file         = CORBA::string_dup(job->getJobFile().c_str());
499   job_parameters->env_file         = CORBA::string_dup(job->getEnvFile().c_str());
500   job_parameters->work_directory   = CORBA::string_dup(job->getWorkDirectory().c_str());
501   job_parameters->local_directory  = CORBA::string_dup(job->getLocalDirectory().c_str());
502   job_parameters->result_directory = CORBA::string_dup(job->getResultDirectory().c_str());
503
504   // Parameters for COORM
505   job_parameters->launcher_file = CORBA::string_dup(job->getLauncherFile().c_str());
506   job_parameters->launcher_args = CORBA::string_dup(job->getLauncherArgs().c_str());
507
508   int i = 0;
509   int j = 0;
510   std::list<std::string> in_files  = job->get_in_files();
511   std::list<std::string> out_files = job->get_out_files();
512   job_parameters->in_files.length(in_files.size());
513   for(std::list<std::string>::iterator it = in_files.begin(); it != in_files.end(); it++)
514   {
515     job_parameters->in_files[i] = CORBA::string_dup((*it).c_str());
516     i++;
517   }
518   job_parameters->out_files.length(out_files.size());
519   for(std::list<std::string>::iterator it = out_files.begin(); it != out_files.end(); it++)
520   {
521     job_parameters->out_files[j] = CORBA::string_dup((*it).c_str());
522     j++;
523   }
524
525   job_parameters->maximum_duration = CORBA::string_dup(job->getMaximumDuration().c_str());
526   job_parameters->queue            = CORBA::string_dup(job->getQueue().c_str());
527   job_parameters->exclusive        = job->getExclusive();
528   job_parameters->mem_per_cpu      = job->getMemPerCpu();
529   job_parameters->wckey            = CORBA::string_dup(job->getWCKey().c_str());
530   job_parameters->extra_params     = CORBA::string_dup(job->getExtraParams().c_str());
531
532   resourceParams resource_params = job->getResourceRequiredParams();
533   job_parameters->resource_required.name             = CORBA::string_dup(resource_params.name.c_str());
534   job_parameters->resource_required.hostname         = CORBA::string_dup(resource_params.hostname.c_str());
535   job_parameters->resource_required.OS               = CORBA::string_dup(resource_params.OS.c_str());
536   job_parameters->resource_required.nb_proc          = resource_params.nb_proc;
537   job_parameters->resource_required.nb_node          = resource_params.nb_node;
538   job_parameters->resource_required.nb_proc_per_node = resource_params.nb_proc_per_node;
539   job_parameters->resource_required.cpu_clock        = resource_params.cpu_clock;
540   job_parameters->resource_required.mem_mb           = resource_params.mem_mb;
541
542   std::map<std::string, std::string> specific_parameters = job->getSpecificParameters();
543   if (!specific_parameters.empty())
544   {
545     job_parameters->specific_parameters.length(specific_parameters.size());
546     std::map<std::string, std::string>::const_iterator it_specific;
547     CORBA::ULong i = 0;
548     for (it_specific = specific_parameters.begin() ; it_specific != specific_parameters.end(); it_specific++)
549     {
550       Engines::Parameter_var new_param = new Engines::Parameter;
551       new_param->name  = CORBA::string_dup((it_specific->first).c_str());
552       new_param->value = CORBA::string_dup((it_specific->second).c_str());
553       job_parameters->specific_parameters[i] = new_param;
554       i++;
555     }
556   }
557
558   return job_parameters._retn();
559 }
560
561 //=============================================================================
562 /*! CORBA Method:
563  *  Loads jobs saved in jobs_file
564  */
565 //=============================================================================
566 void
567 SALOME_Launcher::loadJobs(const char* jobs_file)
568 {
569   list<int> new_jobs_id_list;
570   try
571   {
572     // Load the jobs in Launcher
573     new_jobs_id_list = _l.loadJobs(jobs_file);
574   }
575   catch (const LauncherException & ex)
576   {
577     INFOS(ex.msg.c_str());
578     THROW_SALOME_CORBA_EXCEPTION(ex.msg.c_str(), SALOME::INTERNAL_ERROR);
579   }
580
581   // Notify observers of the new jobs
582   list<int>::const_iterator it_jobs_id;
583   for (it_jobs_id = new_jobs_id_list.begin(); it_jobs_id != new_jobs_id_list.end(); it_jobs_id++)
584   {
585     ostringstream job_id_sstr;
586     job_id_sstr << *it_jobs_id;
587     notifyObservers("NEW_JOB", job_id_sstr.str());
588   }
589   notifyObservers("LOAD_JOBS", jobs_file);
590 }
591
592 //=============================================================================
593 /*! CORBA Method:
594  *  Save jobs of Launcher (in any steps) in file jobs_file
595  */
596 //=============================================================================
597 void
598 SALOME_Launcher::saveJobs(const char* jobs_file)
599 {
600   _l.saveJobs(jobs_file);
601   notifyObservers("SAVE_JOBS", jobs_file);
602 }
603
604 //=============================================================================
605 /*! CORBA Method:
606  *  Add a new observer to the launcher
607  */
608 //=============================================================================
609 void
610 SALOME_Launcher::addObserver(Engines::SalomeLauncherObserver_ptr observer)
611 {
612   bool new_observer = true;
613   std::list<Engines::SalomeLauncherObserver_var>::iterator iter = _observers.begin();
614   while(iter != _observers.end())
615   {
616     if (std::string(_orb->object_to_string(*iter)) ==
617         std::string(_orb->object_to_string(observer)))
618     {
619       new_observer = false;
620       break;
621     }
622     iter++;
623   }
624   if (new_observer)
625     _observers.push_back(Engines::SalomeLauncherObserver::_duplicate(observer));
626
627   // We notify the new observer with all jobs that are currently in the Launcher
628   std::map<int, Launcher::Job *> cpp_jobs = _l.getJobs();
629   std::map<int, Launcher::Job *>::const_iterator it_job;
630   for(it_job = cpp_jobs.begin(); it_job != cpp_jobs.end(); it_job++)
631   {
632     int number = it_job->first;
633     std::ostringstream job_id;
634     job_id << number;
635     try
636     {
637       observer->notify("NEW_JOB", job_id.str().c_str());
638     }
639     catch (...) 
640     {
641        MESSAGE("Notify Observer, exception catch");
642     }
643
644   }
645 }
646
647 //=============================================================================
648 /*! CORBA Method:
649  *  Add a new observer to the launcher
650  */
651 //=============================================================================
652 void
653 SALOME_Launcher::removeObserver(Engines::SalomeLauncherObserver_ptr observer)
654 {
655   std::list<Engines::SalomeLauncherObserver_var>::iterator iter = _observers.begin();
656   while(iter != _observers.end())
657   {
658     if (std::string(_orb->object_to_string(*iter)) ==
659         std::string(_orb->object_to_string(observer)))
660     {
661       // Observer found
662       iter =_observers.erase(iter++);
663     }
664     else
665     {
666       iter++;
667     }
668   }
669 }
670
671 //=============================================================================
672 /*! Internal Method:
673  *  Notify observers on a new event
674  */
675 //=============================================================================
676 void
677 SALOME_Launcher::notifyObservers(const std::string & event_name,
678                                  const std::string & event_data)
679 {
680   std::list<Engines::SalomeLauncherObserver_var>::iterator iter = _observers.begin();
681   while(iter != _observers.end())
682   {
683     try
684     {
685       (*iter)->notify(CORBA::string_dup(event_name.c_str()),
686                       CORBA::string_dup(event_data.c_str()));
687     }
688     catch (...) 
689     {
690        MESSAGE("Notify Observer, exception catch");
691     }
692     iter++;
693   }
694
695 }