Specific parameters for each type of job - optional
*/
Engines::ParameterList specific_parameters;
+
+ // Parameters for COORM
+ string launcher_file;
+ string launcher_args;
};
struct JobDescription
long createJob (in Engines::JobParameters job_parameters) raises (SALOME::SALOME_Exception);
void launchJob (in long job_id) raises (SALOME::SALOME_Exception);
string getJobState (in long job_id) raises (SALOME::SALOME_Exception);
+ string getAssignedHostnames (in long job_id) raises (SALOME::SALOME_Exception); // Get names or ids of hosts assigned to the job
void getJobResults(in long job_id, in string directory) raises (SALOME::SALOME_Exception);
boolean getJobDumpState(in long job_id, in string directory) raises (SALOME::SALOME_Exception);
void stopJob (in long job_id) raises (SALOME::SALOME_Exception);
result = "OK";
return result;
}
+ if (batch_type == "oar")
+ {
+ INFOS("test_jobsubmit_simple not yet implemented for oar... return OK");
+ result = "OK";
+ return result;
+ }
+ if (batch_type == "coorm")
+ {
+ INFOS("test_jobsubmit_simple not yet implemented for coorm... return OK");
+ result = "OK";
+ return result;
+ }
if (batch_type != "pbs")
{
result += "Batch type unknown ! : " + batch_type;
return state.c_str();
}
+//=============================================================================
+/*!
+ * Get job assigned hostnames
+ */
+//=============================================================================
+const char *
+Launcher_cpp::getAssignedHostnames(int job_id)
+{
+ LAUNCHER_MESSAGE("Get job assigned hostnames");
+
+ // Check if job exist
+ std::map<int, Launcher::Job *>::const_iterator it_job = _launcher_job_map.find(job_id);
+ if (it_job == _launcher_job_map.end())
+ {
+ LAUNCHER_INFOS("Cannot find the job, is it created ? job number: " << job_id);
+ throw LauncherException("Cannot find the job, is it created ?");
+ }
+
+ Launcher::Job * job = it_job->second;
+ std::string assigned_hostnames = job->getAssignedHostnames();
+
+ return assigned_hostnames.c_str();
+}
+
//=============================================================================
/*!
* Get Job result - the result directory could be changed
case vishnu:
bmType = "VISHNU";
break;
+ case oar:
+ bmType = "OAR";
+ break;
+ case coorm:
+ bmType = "COORM";
+ break;
default:
LAUNCHER_MESSAGE("Bad batch description of the resource: Batch = " << params.Batch);
throw LauncherException("No batchmanager for that cluster - Bad batch description of the resource");
std::string expected_during_time;
std::string mem;
unsigned long nb_proc;
+
+ // Parameters for COORM
+ std::string launcher_file;
+ std::string launcher_args;
};
class LAUNCHER_EXPORT Launcher_cpp
void createJob(Launcher::Job * new_job);
void launchJob(int job_id);
const char * getJobState(int job_id);
+ const char * getAssignedHostnames(int job_id); // Get names or ids of hosts assigned to the job
void getJobResults(int job_id, std::string directory);
bool getJobDumpState(int job_id, std::string directory);
void stopJob(int job_id);
_queue = "";
_job_type = "";
+ // Parameters for COORM
+ _launcher_file = "";
+ _launcher_args = "";
+
#ifdef WITH_LIBBATCH
_batch_job = new Batch::Job();
#endif
return _state;
}
+// Get names or ids of hosts assigned to the job
+std::string
+Launcher::Job::getAssignedHostnames()
+{
+ return _assigned_hostnames;
+}
+
void
Launcher::Job::setNumber(const int & number)
{
_maximum_duration = maximum_duration;
}
+// For COORM
+void
+Launcher::Job::setLauncherFile(const std::string & launcher_file)
+{
+ _launcher_file = launcher_file;
+}
+void
+Launcher::Job::setLauncherArgs(const std::string & launcher_args)
+{
+ _launcher_args = launcher_args;
+}
+
void
Launcher::Job::setResourceRequiredParams(const resourceParams & resource_required_params)
{
return _maximum_duration;
}
+// For COORM
+std::string
+Launcher::Job::getLauncherFile()
+{
+ return _launcher_file;
+}
+std::string
+Launcher::Job::getLauncherArgs()
+{
+ return _launcher_args;
+}
+
resourceParams
Launcher::Job::getResourceRequiredParams()
{
Batch::JobInfo job_info = _batch_job_id.queryJob();
Batch::Parametre par = job_info.getParametre();
_state = par[Batch::STATE].str();
+ _assigned_hostnames = par[Batch::ASSIGNEDHOSTNAMES].str();
LAUNCHER_MESSAGE("State received is: " << par[Batch::STATE].str());
}
#endif
}
params[Batch::WORKDIR] = _work_directory;
+ // Parameters for COORM
+ params[Batch::LAUNCHER_FILE] = _launcher_file;
+ params[Batch::LAUNCHER_ARGS] = _launcher_args;
+
// If result_directory is not defined, we use HOME environnement
if (_result_directory == "")
_result_directory = getenv("HOME");
xmlNewChild(node, NULL, xmlCharStrdup("local_directory"), xmlCharStrdup(getLocalDirectory().c_str()));
xmlNewChild(node, NULL, xmlCharStrdup("result_directory"), xmlCharStrdup(getResultDirectory().c_str()));
+ // Parameters for COORM
+ xmlNewChild(node, NULL, xmlCharStrdup("launcher_file"), xmlCharStrdup(getLauncherFile().c_str()));
+
// Files
xmlNodePtr files_node = xmlNewChild(node, NULL, xmlCharStrdup("files"), NULL);
std::list<std::string> in_files = get_in_files();
xmlNewChild(node, NULL, xmlCharStrdup("maximum_duration"), xmlCharStrdup(getMaximumDuration().c_str()));
xmlNewChild(node, NULL, xmlCharStrdup("queue"), xmlCharStrdup(getQueue().c_str()));
+ // For COORM
+ xmlNewChild(node, NULL, xmlCharStrdup("launcher_args"), xmlCharStrdup(getLauncherArgs().c_str()));
+
// Specific parameters part
xmlNodePtr specific_parameters_node = xmlNewChild(node, NULL, xmlCharStrdup("specific_parameters"), NULL);
std::map<std::string, std::string> specific_parameters = getSpecificParameters();
// State of a Job: CREATED, IN_PROCESS, QUEUED, RUNNING, PAUSED, FINISHED, ERROR
void setState(const std::string & state);
std::string getState();
+ // Get names or ids of hosts assigned to the job
+ std::string getAssignedHostnames();
void setNumber(const int & number);
int getNumber();
void setQueue(const std::string & queue);
void setEnvFile(const std::string & env_file);
+ // For COORM
+ void setLauncherFile(const std::string & launcher_file);
+ void setLauncherArgs(const std::string & launcher_args);
+
std::string getJobName();
std::string getJobFile();
std::string getWorkDirectory();
std::string getEnvFile();
std::string getJobType();
+ // For COORM
+ std::string getLauncherFile();
+ std::string getLauncherArgs();
+
std::string updateJobState();
void addSpecificParameter(const std::string & name,
std::string _job_type;
std::string _state;
+ std::string _assigned_hostnames; // Assigned hostnames
std::string _launch_date;
std::string _env_file;
resourceParams _resource_required_params;
std::string _queue;
+ // Parameters for COORM
+ std::string _launcher_file;
+ std::string _launcher_args;
+
#ifdef WITH_LIBBATCH
// Connection with LIBBATCH
public:
launch_script_stream << "echo '<resources>' >> $CATALOG_FILE" << std::endl;
launch_script_stream << "cat $LIBBATCH_NODEFILE | sort | uniq -c | while read nbproc host" << std::endl;
launch_script_stream << "do" << std::endl;
- launch_script_stream << "echo '<machine hostname='\\\"$host\\\" >> $CATALOG_FILE" << std::endl;
+ // Full name doesn't work. eg: sagittaire-7 instead of sagittaire-7.lyon.grid5000.fr
+ launch_script_stream << "host_basename=$(echo $host | cut -f1 -d.)" << std::endl;
+ launch_script_stream << "echo '<machine hostname='\\\"$host_basename\\\" >> $CATALOG_FILE" << std::endl;
launch_script_stream << "echo ' protocol=\"" << resource_protocol << "\"' >> $CATALOG_FILE" << std::endl;
launch_script_stream << "echo ' userName=\"" << _resource_definition.UserName << "\"' >> $CATALOG_FILE" << std::endl;
launch_script_stream << "echo ' appliPath=\"" << _resource_definition.AppliPath << "\"' >> $CATALOG_FILE" << std::endl;
new_job->setLocalDirectory(local_directory);
new_job->setResultDirectory(result_directory);
+ // Parameters for COORM
+ std::string launcher_file = job_parameters.launcher_file.in();
+ std::string launcher_args = job_parameters.launcher_args.in();
+ new_job->setLauncherFile(launcher_file);
+ new_job->setLauncherArgs(launcher_args);
+
// Job File
std::string job_file = job_parameters.job_file.in();
try
return CORBA::string_dup(result.c_str());
}
+// Get names or ids of hosts assigned to the job
+char *
+SALOME_Launcher::getAssignedHostnames(CORBA::Long job_id)
+{
+ std::string result;
+ try
+ {
+ result = _l.getAssignedHostnames(job_id);
+ }
+ catch(const LauncherException &ex)
+ {
+ INFOS(ex.msg.c_str());
+ THROW_SALOME_CORBA_EXCEPTION(ex.msg.c_str(),SALOME::BAD_PARAM);
+ }
+ return CORBA::string_dup(result.c_str());
+}
+
void
SALOME_Launcher::getJobResults(CORBA::Long job_id, const char * directory)
{
job_parameters->local_directory = CORBA::string_dup(job->getLocalDirectory().c_str());
job_parameters->result_directory = CORBA::string_dup(job->getResultDirectory().c_str());
+ // Parameters for COORM
+ job_parameters->launcher_file = CORBA::string_dup(job->getLauncherFile().c_str());
+ job_parameters->launcher_args = CORBA::string_dup(job->getLauncherArgs().c_str());
+
int i = 0;
int j = 0;
std::list<std::string> in_files = job->get_in_files();
xmlNodePtr work_directory_node = xmlNextElementSibling(env_file_node);
xmlNodePtr local_directory_node = xmlNextElementSibling(work_directory_node);
xmlNodePtr result_directory_node = xmlNextElementSibling(local_directory_node);
+
+ // Parameters for COORM
+ xmlNodePtr launcher_file_node = xmlNextElementSibling(result_directory_node);
+
if (job_file_node == NULL ||
env_file_node == NULL ||
work_directory_node == NULL ||
local_directory_node == NULL ||
- result_directory_node == NULL
+ result_directory_node == NULL ||
+ // For COORM
+ launcher_file_node == NULL
)
{
INFOS("A bad job is found, some user_part are not found");
xmlStrcmp(env_file_node->name, xmlCharStrdup("env_file")) ||
xmlStrcmp(work_directory_node->name, xmlCharStrdup("work_directory")) ||
xmlStrcmp(local_directory_node->name, xmlCharStrdup("local_directory")) ||
- xmlStrcmp(result_directory_node->name, xmlCharStrdup("result_directory"))
+ xmlStrcmp(result_directory_node->name, xmlCharStrdup("result_directory")) ||
+ // For COORM
+ xmlStrcmp(launcher_file_node->name, xmlCharStrdup("launcher_file"))
)
{
INFOS("A bad job is found, some user part node are not in the rigth or does not have a correct name");
xmlChar* work_directory = xmlNodeGetContent(work_directory_node);
xmlChar* local_directory = xmlNodeGetContent(local_directory_node);
xmlChar* result_directory = xmlNodeGetContent(result_directory_node);
+
+ // Parameters for COORM
+ xmlChar* launcher_file = xmlNodeGetContent(launcher_file_node);
+
new_job->setEnvFile(std::string((const char *)env_file));
new_job->setWorkDirectory(std::string((const char *)work_directory));
new_job->setLocalDirectory(std::string((const char *)local_directory));
new_job->setResultDirectory(std::string((const char *)result_directory));
+
+ // Parameters for COORM
+ new_job->setLauncherFile(std::string((const char *)launcher_file));
+
xmlFree(job_file);
xmlFree(env_file);
xmlFree(work_directory);
xmlFree(local_directory);
xmlFree(result_directory);
+ // Parameters for COORM
+ xmlFree(launcher_file);
+
// Get in and out files
- xmlNodePtr files_node = xmlNextElementSibling(result_directory_node);
+ xmlNodePtr files_node = xmlNextElementSibling(launcher_file_node);
if (files_node == NULL)
{
INFOS("A bad job is found, user_part files is not found");
xmlNodePtr res_node = xmlNextElementSibling(files_node);
xmlNodePtr maximum_duration_node = xmlNextElementSibling(res_node);
xmlNodePtr queue_node = xmlNextElementSibling(maximum_duration_node);
+ xmlNodePtr launcher_args_node = xmlNextElementSibling(queue_node);
if (res_node == NULL ||
maximum_duration_node == NULL ||
- queue_node == NULL
+ queue_node == NULL ||
+ // For COORM
+ launcher_args_node == NULL
)
{
INFOS("A bad job is found, some user_part are not found");
}
if (xmlStrcmp(res_node->name, xmlCharStrdup("resource_params")) ||
xmlStrcmp(maximum_duration_node->name, xmlCharStrdup("maximum_duration")) ||
- xmlStrcmp(queue_node->name, xmlCharStrdup("queue"))
+ xmlStrcmp(queue_node->name, xmlCharStrdup("queue")) ||
+ // For COORM
+ xmlStrcmp(launcher_args_node->name, xmlCharStrdup("launcher_args"))
)
{
INFOS("A bad job is found, some user part node are not in the rigth or does not have a correct name");
xmlFree(maximum_duration);
xmlFree(queue);
- xmlNodePtr specific_node = xmlNextElementSibling(queue_node);
+ // For COORM
+ xmlChar* launcher_args = xmlNodeGetContent(launcher_args_node);
+ new_job->setLauncherArgs(std::string((const char *)launcher_args));
+ xmlFree(launcher_args);
+
+ xmlNodePtr specific_node = xmlNextElementSibling(launcher_args_node);
if (specific_node == NULL)
{
INFOS("A bad job is found, specific_parameters part is not found");
CORBA::Long createJob (const Engines::JobParameters & job_parameters);
void launchJob (CORBA::Long job_id);
char * getJobState (CORBA::Long job_id);
+ char * getAssignedHostnames (CORBA::Long job_id); // Get names or ids of hosts assigned to the job
void getJobResults(CORBA::Long job_id, const char * directory);
CORBA::Boolean getJobDumpState(CORBA::Long job_id, const char * directory);
void stopJob (CORBA::Long job_id);
return "ll";
case vishnu:
return "vishnu";
+ case oar:
+ return "oar";
+ case coorm:
+ return "coorm";
case ssh_batch:
return "ssh_batch";
default:
Batch = ll;
else if (batchTypeStr == "vishnu")
Batch = vishnu;
+ else if (batchTypeStr == "oar")
+ Batch = oar;
+ else if (batchTypeStr == "coorm")
+ Batch = coorm;
else if (batchTypeStr == "")
Batch = none;
else
enum ResourceType {cluster, single_machine};
-enum BatchType {none, pbs, lsf, sge, ssh_batch, ccc, ll, slurm, vishnu};
+enum BatchType {none, pbs, lsf, sge, ssh_batch, ccc, ll, slurm, vishnu, oar, coorm};
enum MpiImplType {nompi, lam, mpich1, mpich2, openmpi, ompi, slurmmpi, prun};