Salome HOME
Merge class BatchManager_eClient into class BatchManager
[tools/libbatch.git] / src / PBS / Batch_BatchManager_ePBS.cxx
index 2fbfb9e0f9957c2c3f1558bc571ff1bfb96371ce..ee8c6245d2c087e448b529acbbbfc088a254cb37 100644 (file)
@@ -35,6 +35,7 @@
 
 #include <Batch_Constants.hxx>
 #include <Batch_Utils.hxx>
+#include <Batch_NotYetImplementedException.hxx>
 
 #include "Batch_BatchManager_ePBS.hxx"
 #include "Batch_JobInfo_ePBS.hxx"
@@ -47,8 +48,7 @@ namespace Batch {
                                        const char * username,
                                        CommunicationProtocolType protocolType, const char * mpiImpl, 
                                        int nb_proc_per_node)
-    : BatchManager(parent, host),
-      BatchManager_eClient(parent, host, username, protocolType, mpiImpl),
+    : BatchManager(parent, host, username, protocolType, mpiImpl),
       _nb_proc_per_node(nb_proc_per_node)
   {
     // Nothing to do
@@ -82,7 +82,7 @@ namespace Batch {
     string output;
     int status = Utils::getCommandOutput(command, output);
     cout << output;
-    if (status != 0) throw EmulationException("Can't submit job, error was: " + output);
+    if (status != 0) throw RunTimeException("Can't submit job, error was: " + output);
 
     // normally output contains only id of submitted job, we just need to remove the final \n
     string jobref = output.substr(0, output.size() - 1);
@@ -112,7 +112,7 @@ namespace Batch {
     cerr << command.c_str() << endl;
     status = system(command.c_str());
     if (status)
-      throw EmulationException("Error of connection on remote host");
+      throw RunTimeException("Error of connection on remote host");
 
     cerr << "jobId = " << ref << "killed" << endl;
   }
@@ -120,20 +120,20 @@ namespace Batch {
   // Methode pour le controle des jobs : suspend un job en file d'attente
   void BatchManager_ePBS::holdJob(const JobId & jobid)
   {
-    throw EmulationException("Not yet implemented");
+    throw NotYetImplementedException("BatchManager_ePBS::holdJob");
   }
 
   // Methode pour le controle des jobs : relache un job suspendu
   void BatchManager_ePBS::releaseJob(const JobId & jobid)
   {
-    throw EmulationException("Not yet implemented");
+    throw NotYetImplementedException("BatchManager_ePBS::releaseJob");
   }
 
 
   // Methode pour le controle des jobs : modifie un job en file d'attente
   void BatchManager_ePBS::alterJob(const JobId & jobid, const Parametre & param, const Environnement & env)
   {
-    throw EmulationException("Not yet implemented");
+    throw NotYetImplementedException("BatchManager_ePBS::alterJob");
   }
 
   // Methode pour le controle des jobs : modifie un job en file d'attente
@@ -163,7 +163,7 @@ namespace Batch {
     string output;
     int status = Utils::getCommandOutput(command, output);
     if(status && status != 153 && status != 256*153)
-      throw EmulationException("Error of connection on remote host");
+      throw RunTimeException("Error of connection on remote host");
 
     JobInfo_ePBS ji = JobInfo_ePBS(id, output);
     return ji;
@@ -172,7 +172,7 @@ namespace Batch {
   // Methode pour le controle des jobs : teste si un job est present en machine
   bool BatchManager_ePBS::isRunning(const JobId & jobid)
   {
-    throw EmulationException("Not yet implemented");
+    throw NotYetImplementedException("BatchManager_ePBS::isRunning");
   }
 
   std::string BatchManager_ePBS::buildSubmissionScript(const Job & job)
@@ -192,11 +192,11 @@ namespace Batch {
     if (params.find(WORKDIR) != params.end()) 
       workDir = params[WORKDIR].str();
     else 
-      throw EmulationException("params[WORKDIR] is not defined ! Please defined it, cannot submit this job");
+      throw RunTimeException("params[WORKDIR] is not defined ! Please defined it, cannot submit this job");
     if (params.find(EXECUTABLE) != params.end()) 
       fileToExecute = params[EXECUTABLE].str();
     else 
-      throw EmulationException("params[EXECUTABLE] is not defined ! Please defined it, cannot submit this job");
+      throw RunTimeException("params[EXECUTABLE] is not defined ! Please defined it, cannot submit this job");
 
     // Optional parameters
     if (params.find(NBPROC) != params.end()) 
@@ -215,7 +215,7 @@ namespace Batch {
 
     // Create batch submit file
     ofstream tempOutputFile;
-    std::string TmpFileName = createAndOpenTemporaryFile("PBS-script", tempOutputFile);
+    std::string TmpFileName = Utils::createAndOpenTemporaryFile("PBS-script", tempOutputFile);
 
     tempOutputFile << "#! /bin/sh -f" << endl;
     if (params.find(NAME) != params.end()) {
@@ -285,7 +285,7 @@ namespace Batch {
                                     workDir + "/" + remoteFileName,
                                     _hostname, _username);
     if (status)
-      throw EmulationException("Error of connection on remote host, cannot copy batch submission file");
+      throw RunTimeException("Error of connection on remote host, cannot copy batch submission file");
     return remoteFileName;
   }
 }