X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;ds=sidebyside;f=src%2FLauncher%2FSALOME_Launcher.cxx;h=433c30b1480433bdf8a403a6bcae3a02d43d7334;hb=cfb73ea195567454579b199b2b109e6f9373646f;hp=ec1993e656f7f2dd2621bd6cc7270dfc79ab1479;hpb=8108df1d93f4de242830ce16c0c1994d0c67f477;p=modules%2Fkernel.git diff --git a/src/Launcher/SALOME_Launcher.cxx b/src/Launcher/SALOME_Launcher.cxx index ec1993e65..433c30b14 100644 --- a/src/Launcher/SALOME_Launcher.cxx +++ b/src/Launcher/SALOME_Launcher.cxx @@ -1,23 +1,23 @@ -// Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS // -// 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. +// 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. // -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. // -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // #include "SALOME_Launcher.hxx" @@ -276,6 +276,23 @@ SALOME_Launcher::removeJob(CORBA::Long job_id) } } +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 @@ -677,6 +694,61 @@ SALOME_Launcher::loadJobs(const char* jobs_file) xmlFree(maximum_duration); xmlFree(queue); + xmlNodePtr specific_node = xmlNextElementSibling(queue_node); + if (specific_node == NULL) + { + INFOS("A bad job is found, specific_parameters part is not found"); + delete new_job; + break; + } + xmlNodePtr parameter_node = xmlFirstElementChild(specific_node); + while (parameter_node != NULL) + { + if (!xmlStrcmp(parameter_node->name, xmlCharStrdup("specific_parameter"))) + { + xmlNodePtr name_node = xmlFirstElementChild(parameter_node); + xmlNodePtr value_node = xmlNextElementSibling(name_node); + if (name_node == NULL || + value_node == NULL) + { + INFOS("A bad job is found, specific_parameter parts are not found"); + delete new_job; + break; + } + if (xmlStrcmp(name_node->name, xmlCharStrdup("name")) || + xmlStrcmp(value_node->name, xmlCharStrdup("value"))) + { + INFOS("A bad job is found, specific_parameter bad parts are found"); + delete new_job; + break; + } + + xmlChar* name = xmlNodeGetContent(name_node); + xmlChar* value = xmlNodeGetContent(value_node); + try + { + new_job->addSpecificParameter(std::string((const char*)name), std::string((const char*)value)); + xmlFree(name); + xmlFree(value); + } + catch(const LauncherException &ex) + { + INFOS("Exception receice for a specific parameter, cannot add the job" << ex.msg.c_str()); + delete new_job; + xmlFree(name); + xmlFree(value); + break; + } + } + else + { + INFOS("A bad job is found, specific_parameters part is bad, a node that is not a specific parameter is found"); + delete new_job; + break; + } + parameter_node = xmlNextElementSibling(parameter_node); + } + xmlNodePtr res_name_node = xmlFirstElementChild(res_node); xmlNodePtr res_hostname_node = xmlNextElementSibling(res_name_node); xmlNodePtr res_os_node = xmlNextElementSibling(res_hostname_node); @@ -804,7 +876,6 @@ SALOME_Launcher::loadJobs(const char* jobs_file) try { _l.createJob(new_job); - std::ostringstream job_id; job_id << new_job->getNumber(); notifyObservers("NEW_JOB", job_id.str()); @@ -821,15 +892,7 @@ SALOME_Launcher::loadJobs(const char* jobs_file) { try { - // Step 1: Add the resource to the launcher C++ map - _l.checkFactoryForResource(resource_choosed_name); - - // Step 2: We add run_part informations new_job->setState(job_state); - - // Step 3: We add the job to the launcher - ParserResourcesType resource_definition = _l._ResManager->GetResourcesDescr(resource_choosed_name); - new_job->setResourceDefinition(resource_definition); _l.addJobDirectlyToMap(new_job, job_reference); // Step 4: We check that the BatchManager could resume @@ -857,17 +920,9 @@ SALOME_Launcher::loadJobs(const char* jobs_file) { try { - // Step 1: Add the resource to the launcher C++ map - _l.checkFactoryForResource(resource_choosed_name); - // Step 2: We add run_part informations new_job->setState(job_state); - - // Step 3: We add the job to the launcher - ParserResourcesType resource_definition = _l._ResManager->GetResourcesDescr(resource_choosed_name); - new_job->setResourceDefinition(resource_definition); _l.addJobDirectlyToMap(new_job, job_reference); - std::ostringstream job_id; job_id << new_job->getNumber(); notifyObservers("NEW_JOB", job_id.str());