}
// Third step search batch manager for the resource into the map -> instanciate one if does not exist
+#ifdef WITH_LIBBATCH
std::string resource_name = resource_definition.Name;
std::map<std::string, Batch::BatchManager_eClient *>::const_iterator it = _batchmap.find(resource_name);
if(it == _batchmap.end())
delete new_job;
throw LauncherException(ex.message);
}
+ catch(const Batch::InvalidArgumentException &ex)
+ {
+ LAUNCHER_INFOS("Error during creation of the batch manager of the resource, mess: " << ex.message);
+ throw LauncherException(ex.message);
+ }
}
-
+#endif
// Final step - add job to the jobs map
pthread_mutex_lock(_job_cpt_mutex);
LAUNCHER_MESSAGE("getJobResult ended");
}
+//=============================================================================
+/*!
+ * Get Job dump state - the result directory could be changed
+ */
+//=============================================================================
+bool
+Launcher_cpp::getJobDumpState(int job_id, std::string directory)
+{
+ bool rtn;
+ LAUNCHER_MESSAGE("Get Job dump state");
+
+ // 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 resource_name = job->getResourceDefinition().Name;
+ try
+ {
+ if (directory != "")
+ rtn = _batchmap[resource_name]->importDumpStateFile(*(job->getBatchJob()), directory);
+ else
+ rtn = _batchmap[resource_name]->importDumpStateFile(*(job->getBatchJob()), job->getResultDirectory());
+ }
+ catch(const Batch::EmulationException &ex)
+ {
+ LAUNCHER_INFOS("getJobResult is maybe incomplete, exception: " << ex.message);
+ throw LauncherException(ex.message.c_str());
+ }
+ LAUNCHER_MESSAGE("getJobResult ended");
+ return rtn;
+}
+
//=============================================================================
/*!
* Remove the job - into the Launcher and its batch manager
case ssh_batch:
bmType = "eSSH";
break;
+ case ll:
+ bmType = "eLL";
+ 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");
throw LauncherException("Cannot find batch manager factory");
}
LAUNCHER_MESSAGE("Instanciation of batch manager of type: " << bmType);
- Batch::BatchManager_eClient * batch_client = (*fact)(hostname.c_str(), protocol, mpi.c_str(), nb_proc_per_node);
- batch_client->setUsername(params.UserName);
+ Batch::BatchManager_eClient * batch_client = (*fact)(hostname.c_str(), params.UserName.c_str(),
+ protocol, mpi.c_str(), nb_proc_per_node);
return batch_client;
}
"(libBatch was not present at compilation time)");
}
+bool
+Launcher_cpp::getJobDumpState(int job_id, std::string directory)
+{
+ LAUNCHER_INFOS("Launcher compiled without LIBBATCH - cannot get job dump state!!!");
+ throw LauncherException("Method Launcher_cpp::getJobDumpState is not available "
+ "(libBatch was not present at compilation time)");
+}
+
void
Launcher_cpp::removeJob(int job_id)
{
}
// Step 2: We can now add a Factory is the resource is correctly define
+#ifdef WITH_LIBBATCH
std::map<std::string, Batch::BatchManager_eClient *>::const_iterator it = _batchmap.find(resource_name);
if(it == _batchmap.end())
{
LAUNCHER_INFOS("Error during creation of the batch manager of the resource, mess: " << ex.message);
throw LauncherException(ex.message);
}
+ catch(const Batch::InvalidArgumentException &ex)
+ {
+ LAUNCHER_INFOS("Error during creation of the batch manager of the resource, mess: " << ex.message);
+ throw LauncherException(ex.message);
+ }
}
+#endif
}
void
new_job->setResourceDefinition(resource_definition);
// Step 2: add the job to the batch manager
+#ifdef WITH_LIBBATCH
try
{
Batch::JobId batch_manager_job_id = _batchmap[resource_name]->addJob(*(new_job->getBatchJob()),
throw LauncherException("A job as already the same id - job is not created !");
}
LAUNCHER_MESSAGE("New job added");
+#endif
}