Salome HOME
Copyrights update 2015.
[modules/yacs.git] / src / Launcher / SALOME_Launcher.cxx
index f823275b22924d1398d111368229d186291af18d..1bb31a2661839e7dcc5b659e4240ad65417c1878 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2007-2013  CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015  CEA/DEN, EDF R&D, OPEN CASCADE
 //
 // Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
@@ -6,7 +6,7 @@
 // This library is free software; you can redistribute it and/or
 // modify it under the terms of the GNU Lesser General Public
 // License as published by the Free Software Foundation; either
-// version 2.1 of the License.
+// version 2.1 of the License, or (at your option) any later version.
 //
 // This library is distributed in the hope that it will be useful,
 // but WITHOUT ANY WARRANTY; without even the implied warranty of
 #include "BatchTest.hxx"
 #include "OpUtil.hxx"
 #include "SALOME_ContainerManager.hxx"
+#include "SALOME_NamingService.hxx"
+#include "SALOME_ResourcesManager.hxx"
 #include "Utils_CorbaException.hxx"
 
 
 #include "Launcher_Job_Command.hxx"
 #include "Launcher_Job_YACSFile.hxx"
 #include "Launcher_Job_PythonSALOME.hxx"
-#include "Launcher_Job_Writer.hxx"
+
+#include "utilities.h"
 
 #ifdef WIN32
 # include <process.h>
@@ -60,7 +63,7 @@ SALOME_Launcher::SALOME_Launcher(CORBA::ORB_ptr orb, PortableServer::POA_var poa
   _NS = new SALOME_NamingService(orb);
   _ResManager = new SALOME_ResourcesManager(orb,poa,_NS);
   _l.SetResourcesManager(_ResManager->GetImpl());
-  _ContManager = new SALOME_ContainerManager(orb,poa,_ResManager,_NS);
+  _ContManager = new SALOME_ContainerManager(orb,poa,_NS);
   _ResManager->_remove_ref();
   _ContManager->_remove_ref();
 
@@ -166,6 +169,14 @@ SALOME_Launcher::createJob(const Engines::JobParameters & job_parameters)
   // Memory required per CPU
   new_job->setMemPerCpu(job_parameters.mem_per_cpu);
 
+  // WC Key
+  std::string wckey = job_parameters.wckey.in();
+  new_job->setWCKey(wckey);
+
+  // Extra params
+  std::string extra_params = job_parameters.extra_params.in();
+  new_job->setExtraParams(extra_params);
+
   // Resources requirements
   try
   {
@@ -503,6 +514,8 @@ SALOME_Launcher::getJobParameters(CORBA::Long job_id)
   job_parameters->queue            = CORBA::string_dup(job->getQueue().c_str());
   job_parameters->exclusive        = job->getExclusive();
   job_parameters->mem_per_cpu      = job->getMemPerCpu();
+  job_parameters->wckey            = CORBA::string_dup(job->getWCKey().c_str());
+  job_parameters->extra_params     = CORBA::string_dup(job->getExtraParams().c_str());
 
   resourceParams resource_params = job->getResourceRequiredParams();
   job_parameters->resource_required.name             = CORBA::string_dup(resource_params.name.c_str());
@@ -541,8 +554,17 @@ SALOME_Launcher::getJobParameters(CORBA::Long job_id)
 void
 SALOME_Launcher::loadJobs(const char* jobs_file)
 {
-  // Load the jobs in Launcher
-  list<int> new_jobs_id_list = _l.loadJobs(jobs_file);
+  list<int> new_jobs_id_list;
+  try
+  {
+    // Load the jobs in Launcher
+    new_jobs_id_list = _l.loadJobs(jobs_file);
+  }
+  catch (const LauncherException & ex)
+  {
+    INFOS(ex.msg.c_str());
+    THROW_SALOME_CORBA_EXCEPTION(ex.msg.c_str(), SALOME::INTERNAL_ERROR);
+  }
 
   // Notify observers of the new jobs
   list<int>::const_iterator it_jobs_id;