From dd839aec7f78aad7fb924fee2539284177a2208f Mon Sep 17 00:00:00 2001 From: Renaud Barate Date: Tue, 7 Oct 2014 17:24:47 +0200 Subject: [PATCH] SALOME Launcher: add possibility to specify extra parameters --- idl/SALOME_Launcher.idl | 3 +++ src/Launcher/Launcher_Job.cxx | 16 ++++++++++++++++ src/Launcher/Launcher_Job.hxx | 3 +++ src/Launcher/Launcher_XML_Persistence.cxx | 4 ++++ src/Launcher/SALOME_Launcher.cxx | 5 +++++ 5 files changed, 31 insertions(+) diff --git a/idl/SALOME_Launcher.idl b/idl/SALOME_Launcher.idl index 8dbe5cd5c..3b9ff0250 100644 --- a/idl/SALOME_Launcher.idl +++ b/idl/SALOME_Launcher.idl @@ -82,6 +82,9 @@ struct JobParameters //! Workload Characterization Key - mandatory on some clusters string wckey; + //! String that is added to the job submission file - optional + string extra_params; + /*! Specific parameters for each type of job - optional */ diff --git a/src/Launcher/Launcher_Job.cxx b/src/Launcher/Launcher_Job.cxx index 94535df5c..957c42c5a 100644 --- a/src/Launcher/Launcher_Job.cxx +++ b/src/Launcher/Launcher_Job.cxx @@ -331,6 +331,12 @@ Launcher::Job::setWCKey(const std::string & wckey) _wckey = wckey; } +void +Launcher::Job::setExtraParams(const std::string & extra_params) +{ + _extra_params = extra_params; +} + void Launcher::Job::setReference(const std::string & reference) { @@ -421,6 +427,12 @@ Launcher::Job::getWCKey() const return _wckey; } +std::string +Launcher::Job::getExtraParams() const +{ + return _extra_params; +} + std::string Launcher::Job::getReference() const { @@ -648,6 +660,10 @@ Launcher::Job::common_job_params() if (_wckey != "") params[Batch::WCKEY] = _wckey; + // Extra params + if (_extra_params != "") + params[Batch::EXTRAPARAMS] = _extra_params; + // Specific parameters std::map::iterator it = _specific_parameters.find("LoalLevelerJobType"); if (it != _specific_parameters.end()) diff --git a/src/Launcher/Launcher_Job.hxx b/src/Launcher/Launcher_Job.hxx index cb9e5d8de..553900306 100644 --- a/src/Launcher/Launcher_Job.hxx +++ b/src/Launcher/Launcher_Job.hxx @@ -80,6 +80,7 @@ namespace Launcher void setExclusiveStr(const std::string & exclusiveStr); void setMemPerCpu(unsigned long mem_per_cpu); void setWCKey(const std::string & wckey); + void setExtraParams(const std::string & extra_params); void setReference(const std::string & reference); // For COORM void setLauncherFile(const std::string & launcher_file); @@ -101,6 +102,7 @@ namespace Launcher std::string getExclusiveStr() const; unsigned long getMemPerCpu() const; std::string getWCKey() const; + std::string getExtraParams() const; std::string getReference() const; // For COORM @@ -158,6 +160,7 @@ namespace Launcher bool _exclusive; unsigned long _mem_per_cpu; std::string _wckey; + std::string _extra_params; std::string _reference; //! Reference of the job for the batch manager // Parameters for COORM diff --git a/src/Launcher/Launcher_XML_Persistence.cxx b/src/Launcher/Launcher_XML_Persistence.cxx index e1218cbc0..6055d6263 100644 --- a/src/Launcher/Launcher_XML_Persistence.cxx +++ b/src/Launcher/Launcher_XML_Persistence.cxx @@ -200,6 +200,8 @@ XML_Persistence::addJobToXmlDocument(xmlNodePtr root_node, const Job & job) addNumericalNode(res_node, "mem_per_cpu", job.getMemPerCpu()); if (!job.getWCKey().empty()) addNode(node, "wckey", job.getWCKey()); + if (!job.getExtraParams().empty()) + addNode(node, "extra_params", job.getExtraParams()); // Specific parameters part map specific_parameters = job.getSpecificParameters(); @@ -336,6 +338,8 @@ XML_Persistence::parseUserNode(Job * new_job, xmlNodePtr user_node) new_job->setMemPerCpu(getNumericalNodeContent(current_node)); else if (node_name == "wckey") new_job->setWCKey(getNodeContent(current_node)); + else if (node_name == "extra_params") + new_job->setExtraParams(getNodeContent(current_node)); else if (node_name == "specific_parameters") { // Get specific parameters diff --git a/src/Launcher/SALOME_Launcher.cxx b/src/Launcher/SALOME_Launcher.cxx index 3a66f87da..3c16fdf7a 100644 --- a/src/Launcher/SALOME_Launcher.cxx +++ b/src/Launcher/SALOME_Launcher.cxx @@ -169,6 +169,10 @@ SALOME_Launcher::createJob(const Engines::JobParameters & job_parameters) 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 { @@ -507,6 +511,7 @@ SALOME_Launcher::getJobParameters(CORBA::Long job_id) 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()); -- 2.39.2