]> SALOME platform Git repositories - modules/kernel.git/commitdiff
Salome HOME
Add parameters 'partition' and 'nodes' for slurm jobs.
authorOvidiu Mircescu <ovidiu.mircescu@edf.fr>
Tue, 23 Jan 2018 14:14:37 +0000 (15:14 +0100)
committerOvidiu Mircescu <ovidiu.mircescu@edf.fr>
Tue, 23 Jan 2018 14:14:37 +0000 (15:14 +0100)
idl/SALOME_Launcher.idl
idl/SALOME_ResourcesManager.idl
src/Launcher/Launcher_Job.cxx
src/Launcher/Launcher_Job.hxx
src/Launcher/Launcher_XML_Persistence.cxx
src/Launcher/SALOME_Launcher.cxx
src/LifeCycleCORBA_SWIG/LifeCycleCORBA.py

index ca8a0248c4d7596ed8216db11126461dce3b5ef1..2506fa52e7cafcb7b5cfb37a92b1e25b50992f7a 100644 (file)
@@ -138,7 +138,12 @@ struct JobParameters
 
   //!  Name of the batch queue chosen - optional
   string queue;
-  
+
+  //! Name of the partition - optional
+  /*! It can be used only for slurm batch managers.
+  */
+  string partition;
+
   //! Specifies if the job must run in exclusive mode (without sharing nodes with other jobs)
   boolean exclusive;
 
index 4884233bd0c5aa71abe28f49d96eeb585b4d2699..61c93a0ba5ace52c12fc970559d5631c7bbbfec8 100644 (file)
@@ -89,7 +89,7 @@ to map segment from shared object: Cannot allocate memory
   long mem_mb;
   //! required frequency
   long cpu_clock;
-  //! required number of nodes
+  //! required number of nodes. Can be used when submitting slurm jobs.
   long nb_node;
   //! required number of proc per node
   long nb_proc_per_node;
index e98e0f204ae4f1be22be19acc1f64f2b049b9c33..0c4e3ce7e5dbe41a86e1604dca644275d5f684a7 100644 (file)
@@ -48,6 +48,7 @@ Launcher::Job::Job()
   _maximum_duration = "";
   _maximum_duration_in_second = -1;
   _queue = "";
+  _partition = "";
   _job_type = "";
   _exclusive = false;
   _mem_per_cpu = 0;
@@ -307,6 +308,12 @@ Launcher::Job::setQueue(const std::string & queue)
   _queue = queue;
 }
 
+void
+Launcher::Job::setPartition(const std::string & partition)
+{
+  _partition = partition;
+}
+
 void
 Launcher::Job::setExclusive(bool exclusive)
 {
@@ -408,6 +415,12 @@ Launcher::Job::getQueue() const
   return _queue;
 }
 
+std::string
+Launcher::Job::getPartition() const
+{
+  return _partition;
+}
+
 bool
 Launcher::Job::getExclusive() const
 {
@@ -585,6 +598,9 @@ Launcher::Job::common_job_params()
   params[Batch::NBPROC] = _resource_required_params.nb_proc;
   params[Batch::NBPROCPERNODE] = _resource_required_params.nb_proc_per_node;
 
+  if(_resource_required_params.nb_node > 0)
+    params[Batch::NBNODE] = _resource_required_params.nb_node;
+
   // Memory in megabytes
   if (_resource_required_params.mem_mb > 0)
   {
@@ -693,6 +709,10 @@ Launcher::Job::common_job_params()
   if (_queue != "")
     params[Batch::QUEUE] = _queue;
 
+  // Partition
+  if (_partition != "")
+    params[Batch::PARTITION] = _partition;
+
   // Exclusive
   if (getExclusive())
     params[Batch::EXCLUSIVE] = true;
index 8531cd1c03b8d4ba8f516b811f4f6551e31b1121..44d5f75fe9862506d1879667660c8c47dd4fb2f6 100644 (file)
@@ -76,6 +76,7 @@ namespace Launcher
       void setMaximumDuration(const std::string & maximum_duration);
       void setResourceRequiredParams(const resourceParams & resource_required_params);
       void setQueue(const std::string & queue);
+      void setPartition(const std::string & partition);
       void setEnvFile(const std::string & env_file);
       void setExclusive(bool exclusive);
       void setExclusiveStr(const std::string & exclusiveStr);
@@ -98,6 +99,7 @@ namespace Launcher
       std::string getMaximumDuration() const;
       resourceParams getResourceRequiredParams() const;
       std::string getQueue() const;
+      std::string getPartition() const;
       std::string getEnvFile() const;
       std::string getJobType() const;
       bool getExclusive() const;
@@ -160,6 +162,7 @@ namespace Launcher
       long _maximum_duration_in_second;
       resourceParams _resource_required_params;
       std::string _queue;
+      std::string _partition;
       bool _exclusive;
       unsigned long _mem_per_cpu;
       std::string _wckey;
index eb7775e5a99251cd5cf5c4eee4976427c651fef2..8da04042330c85370451b42573650a5faf659423 100644 (file)
@@ -196,6 +196,8 @@ XML_Persistence::addJobToXmlDocument(xmlNodePtr root_node, const Job & job)
     addNode(node, "maximum_duration", job.getMaximumDuration());
   if (!job.getQueue().empty())
     addNode(node, "queue", job.getQueue());
+  if (!job.getPartition().empty())
+    addNode(node, "partition", job.getPartition());
   if (job.getExclusive())
     addNode(node, "exclusive", job.getExclusiveStr());
   if (job.getMemPerCpu() > 0)
@@ -336,6 +338,8 @@ XML_Persistence::parseUserNode(Job * new_job, xmlNodePtr user_node)
       new_job->setMaximumDuration(getNodeContent(current_node));
     else if (node_name == "queue")
       new_job->setQueue(getNodeContent(current_node));
+    else if (node_name == "partition")
+      new_job->setPartition(getNodeContent(current_node));
     else if (node_name == "exclusive")
       new_job->setExclusiveStr(getNodeContent(current_node));
     else if (node_name == "mem_per_cpu")
index 39447a7fdb4a203d041947f79285cf43c34e93fc..8849b855e8c979e00a7a5551718e9073cd86888d 100644 (file)
@@ -164,6 +164,10 @@ SALOME_Launcher::createJob(const Engines::JobParameters & job_parameters)
   std::string queue = job_parameters.queue.in();
   new_job->setQueue(queue);
 
+  // Partition
+  std::string partition = job_parameters.partition.in();
+  new_job->setPartition(partition);
+
   // Exclusive
   new_job->setExclusive(job_parameters.exclusive);
 
@@ -544,6 +548,7 @@ SALOME_Launcher::getJobParameters(CORBA::Long job_id)
 
   job_parameters->maximum_duration = CORBA::string_dup(job->getMaximumDuration().c_str());
   job_parameters->queue            = CORBA::string_dup(job->getQueue().c_str());
+  job_parameters->partition        = CORBA::string_dup(job->getPartition().c_str());
   job_parameters->exclusive        = job->getExclusive();
   job_parameters->mem_per_cpu      = job->getMemPerCpu();
   job_parameters->wckey            = CORBA::string_dup(job->getWCKey().c_str());
index bfb357a79af5544789fca145da9bcfe05e5ae6fc..d7f4e634f37546ad52ed3c38e579ce03e71a4892 100644 (file)
@@ -60,7 +60,7 @@ class ResourceParameters (Engines.ResourceParameters):
 class JobParameters (Engines.JobParameters):
   def __init__(self, job_name="", job_type="", job_file="", pre_command="", env_file="", in_files=None, out_files=None,
                      work_directory="", local_directory="", result_directory="", maximum_duration="",
-                     resource_required=None, queue="", exclusive = False, mem_per_cpu = 0,
+                     resource_required=None, queue="", partition="", exclusive = False, mem_per_cpu = 0,
                      wckey = "", extra_params = "",
                      specific_parameters=None, launcher_file = "", launcher_args = ""):
     if in_files is None:
@@ -71,7 +71,7 @@ class JobParameters (Engines.JobParameters):
       specific_parameters = []
     Engines.JobParameters.__init__(self, job_name, job_type, job_file, pre_command, env_file, in_files, out_files,
                                          work_directory, local_directory, result_directory, maximum_duration,
-                                         resource_required, queue, exclusive, mem_per_cpu,
+                                         resource_required, queue, partition, exclusive, mem_per_cpu,
                                          wckey, extra_params,
                                          specific_parameters, launcher_file, launcher_args)