//! Specifies if the job must run in exclusive mode (without sharing nodes with other jobs)
boolean exclusive;
+ //! Specifies the memory limit per cpu (exclusive with resource_required.mem_mb)
+ unsigned long mem_per_cpu;
+
/*!
Specific parameters for each type of job - optional
*/
#include <libbatch/Constants.hxx>
#endif
+using namespace std;
+
Launcher::Job::Job()
{
_number = -1;
_queue = "";
_job_type = "";
_exclusive = false;
+ _mem_per_cpu = 0;
// Parameters for COORM
_launcher_file = "";
throw LauncherException(std::string("Invalid boolean value for exclusive: ") + exclusiveStr);
}
+void
+Launcher::Job::setMemPerCpu(unsigned long mem_per_cpu)
+{
+ _mem_per_cpu = mem_per_cpu;
+}
+
std::string
Launcher::Job::getWorkDirectory()
{
return _exclusive ? "true" : "false";
}
+unsigned long
+Launcher::Job::getMemPerCpu() const
+{
+ return _mem_per_cpu;
+}
+
void
Launcher::Job::checkMaximumDuration(const std::string & maximum_duration)
{
{
params[Batch::MAXRAMSIZE] = _resource_required_params.mem_mb;
}
+ else if (_mem_per_cpu > 0)
+ {
+ params[Batch::MEMPERCPU] = (long)_mem_per_cpu;
+ }
// We define a default directory based on user time
if (_work_directory == "")
xmlNewChild(node, NULL, xmlCharStrdup("maximum_duration"), xmlCharStrdup(getMaximumDuration().c_str()));
xmlNewChild(node, NULL, xmlCharStrdup("queue"), xmlCharStrdup(getQueue().c_str()));
xmlNewChild(node, NULL, xmlCharStrdup("exclusive"), xmlCharStrdup(getExclusiveStr().c_str()));
+ ostringstream mem_per_cpu_stream;
+ mem_per_cpu_stream << _mem_per_cpu;
+ xmlNewChild(node, NULL, xmlCharStrdup("mem_per_cpu"), xmlCharStrdup(mem_per_cpu_stream.str().c_str()));
// For COORM
xmlNewChild(node, NULL, xmlCharStrdup("launcher_args"), xmlCharStrdup(getLauncherArgs().c_str()));
void setEnvFile(const std::string & env_file);
void setExclusive(bool exclusive);
void setExclusiveStr(const std::string & exclusiveStr);
+ void setMemPerCpu(unsigned long mem_per_cpu);
// For COORM
void setLauncherFile(const std::string & launcher_file);
void setLauncherArgs(const std::string & launcher_args);
std::string getJobType();
bool getExclusive();
std::string getExclusiveStr() const;
+ unsigned long getMemPerCpu() const;
// For COORM
std::string getLauncherFile();
resourceParams _resource_required_params;
std::string _queue;
bool _exclusive;
+ unsigned long _mem_per_cpu;
// Parameters for COORM
std::string _launcher_file;
// Exclusive
new_job->setExclusive(job_parameters.exclusive);
+ // Memory required per CPU
+ new_job->setMemPerCpu(job_parameters.mem_per_cpu);
+
// Resources requirements
try
{
job_parameters->maximum_duration = CORBA::string_dup(job->getMaximumDuration().c_str());
job_parameters->queue = CORBA::string_dup(job->getQueue().c_str());
job_parameters->exclusive = job->getExclusive();
+ job_parameters->mem_per_cpu = job->getMemPerCpu();
resourceParams resource_params = job->getResourceRequiredParams();
job_parameters->resource_required.name = CORBA::string_dup(resource_params.name.c_str());
xmlNodePtr maximum_duration_node = xmlNextElementSibling(res_node);
xmlNodePtr queue_node = xmlNextElementSibling(maximum_duration_node);
xmlNodePtr exclusive_node = xmlNextElementSibling(queue_node);
- xmlNodePtr launcher_args_node = xmlNextElementSibling(exclusive_node);
+ xmlNodePtr mem_per_cpu_node = xmlNextElementSibling(exclusive_node);
+ xmlNodePtr launcher_args_node = xmlNextElementSibling(mem_per_cpu_node);
if (res_node == NULL ||
maximum_duration_node == NULL ||
queue_node == NULL ||
exclusive_node == NULL ||
+ mem_per_cpu_node == NULL ||
// For COORM
launcher_args_node == NULL
)
xmlStrcmp(maximum_duration_node->name, xmlCharStrdup("maximum_duration")) ||
xmlStrcmp(queue_node->name, xmlCharStrdup("queue")) ||
xmlStrcmp(exclusive_node->name, xmlCharStrdup("exclusive")) ||
+ xmlStrcmp(mem_per_cpu_node->name, xmlCharStrdup("mem_per_cpu")) ||
// For COORM
xmlStrcmp(launcher_args_node->name, xmlCharStrdup("launcher_args"))
)
}
xmlFree(exclusive);
+ xmlChar* mem_per_cpu_str = xmlNodeGetContent(mem_per_cpu_node);
+ std::istringstream mem_per_cpu_stream((const char *)mem_per_cpu_str);
+ unsigned long mem_per_cpu = 0;
+ if (!(mem_per_cpu_stream >> mem_per_cpu))
+ {
+ INFOS("A bad job is found, mem_per_cpu parameter is not correct");
+ delete new_job;
+ break;
+ }
+ else
+ new_job->setMemPerCpu(mem_per_cpu);
+
// For COORM
xmlChar* launcher_args = xmlNodeGetContent(launcher_args_node);
new_job->setLauncherArgs(std::string((const char *)launcher_args));
class JobParameters (Engines.JobParameters):
def __init__(self, job_name="", job_type="", job_file="", env_file="", in_files=[], out_files=[],
work_directory="", local_directory="", result_directory="", maximum_duration="",
- resource_required=None, queue="", exclusive = False, specific_parameters=[],
- launcher_file = "", launcher_args = ""):
+ resource_required=None, queue="", exclusive = False, mem_per_cpu = 0,
+ specific_parameters=[], launcher_file = "", launcher_args = ""):
Engines.JobParameters.__init__(self, job_name, job_type, job_file, env_file, in_files, out_files,
work_directory, local_directory, result_directory, maximum_duration,
- resource_required, queue, exclusive, specific_parameters,
- launcher_file, launcher_args)
+ resource_required, queue, exclusive, mem_per_cpu,
+ specific_parameters, launcher_file, launcher_args)
class ResourceDefinition(Engines.ResourceDefinition):
def __init__(self, name="", hostname="", protocol="rsh", username="", applipath="", componentList=[],