]> SALOME platform Git repositories - modules/kernel.git/commitdiff
Salome HOME
Changed libBatch optional usage from empty implementation classes to #ifdef. BR_V51_RB
authorbarate <barate>
Thu, 24 Sep 2009 15:49:55 +0000 (15:49 +0000)
committerbarate <barate>
Thu, 24 Sep 2009 15:49:55 +0000 (15:49 +0000)
configure.ac
src/Launcher/BatchTest.cxx
src/Launcher/DummyBatchTest.cxx [deleted file]
src/Launcher/DummyLauncher.cxx [deleted file]
src/Launcher/Launcher.cxx
src/Launcher/Makefile.am

index b335018d33df1e8e3405fcefc998f04eca048b9a..d09c4b0a47a3c09fd9f7a926f4a4d2162b7dc8c5 100644 (file)
@@ -364,7 +364,7 @@ echo --------------------------------------------------------------
 echo
 
 CHECK_LIBBATCH
-AM_CONDITIONAL(WITH_BATCH, [test x"$libbatch_ok" = xyes])
+AM_CONDITIONAL(WITH_LIBBATCH, [test x"$libbatch_ok" = xyes])
 
 echo
 echo ============================================================
index bf0e88e64fccd3158ff7584f6ab60ba4e16c6a1a..23ff34abef46913de9d207d99f4fc5c1c5f25faf 100644 (file)
 //  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 //
 #include "BatchTest.hxx"
+#include "Launcher.hxx"
 
+#ifdef WITH_LIBBATCH
 #include <Batch/Batch_Date.hxx>
 #include <Batch/Batch_MpiImpl.hxx>
+#endif
+
 #include "utilities.h"
 
 #include <sys/stat.h>
@@ -33,6 +37,7 @@
 #endif
 BatchTest::BatchTest(const Engines::MachineDefinition& batch_descr) 
 {
+#ifdef WITH_LIBBATCH
   _batch_descr = batch_descr;
 
   // Getting date
@@ -54,6 +59,7 @@ BatchTest::BatchTest(const Engines::MachineDefinition& batch_descr)
   _test_filename +=  _date + "_test_cluster_file_";
   _test_filename += _batch_descr.alias.in();
   _base_filename = _date + "_test_cluster_file_" + _batch_descr.alias.in();
+#endif
 }
 
 BatchTest::~BatchTest() {}
@@ -438,6 +444,7 @@ BatchTest::test_jobsubmit_simple()
 std::string 
 BatchTest::test_jobsubmit_mpi() 
 {
+#ifdef WITH_LIBBATCH
   int status;
   std::string home;
   std::string command;
@@ -629,6 +636,10 @@ BatchTest::test_jobsubmit_mpi()
   }
   result = "OK";
   return result;  
+#else
+  throw LauncherException("Method BatchTest::test_jobsubmit_mpi is not available "
+                          "(libBatch was not present at compilation time)");
+#endif
 }
 
 std::string 
diff --git a/src/Launcher/DummyBatchTest.cxx b/src/Launcher/DummyBatchTest.cxx
deleted file mode 100644 (file)
index 6e995a2..0000000
+++ /dev/null
@@ -1,41 +0,0 @@
-//  Copyright (C) 2007-2008  CEA/DEN, EDF R&D, OPEN CASCADE
-//
-//  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-//  This library is free software; you can redistribute it and/or
-//  modify it under the terms of the GNU Lesser General Public
-//  License as published by the Free Software Foundation; either
-//  version 2.1 of the License.
-//
-//  This library is distributed in the hope that it will be useful,
-//  but WITHOUT ANY WARRANTY; without even the implied warranty of
-//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-//  Lesser General Public License for more details.
-//
-//  You should have received a copy of the GNU Lesser General Public
-//  License along with this library; if not, write to the Free Software
-//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
-//
-//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-
-// This implementation is an empty shell compiled only when libBatch is absent.
-// It will just throw exceptions when it is called.
-
-#include "BatchTest.hxx"
-#include "Launcher.hxx"
-
-BatchTest::BatchTest(const Engines::MachineDefinition& batch_descr) 
-{
-}
-
-BatchTest::~BatchTest()
-{
-}
-
-bool BatchTest::test()
-{
-  throw LauncherException("Method BatchTest::test() is not available "
-                          "(libBatch was not found at compilation time).");
-}
diff --git a/src/Launcher/DummyLauncher.cxx b/src/Launcher/DummyLauncher.cxx
deleted file mode 100644 (file)
index fb9222b..0000000
+++ /dev/null
@@ -1,97 +0,0 @@
-//  Copyright (C) 2007-2008  CEA/DEN, EDF R&D, OPEN CASCADE
-//
-//  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-//  This library is free software; you can redistribute it and/or
-//  modify it under the terms of the GNU Lesser General Public
-//  License as published by the Free Software Foundation; either
-//  version 2.1 of the License.
-//
-//  This library is distributed in the hope that it will be useful,
-//  but WITHOUT ANY WARRANTY; without even the implied warranty of
-//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-//  Lesser General Public License for more details.
-//
-//  You should have received a copy of the GNU Lesser General Public
-//  License along with this library; if not, write to the Free Software
-//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
-//
-//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-
-// This implementation is an empty shell compiled only when libBatch is absent.
-// It will just throw exceptions when it is called.
-
-#include "Launcher.hxx"
-
-using namespace std;
-
-Launcher_cpp::Launcher_cpp()
-{
-}
-
-Launcher_cpp::~Launcher_cpp()
-{
-}
-
-long Launcher_cpp::submitJob(const string xmlExecuteFile,
-                             const string clusterName) throw (LauncherException)
-{
-  throw LauncherException("Method Launcher_cpp::submitJob is not available "
-                          "(libBatch was not found at compilation time).");
-}
-
-long Launcher_cpp::submitSalomeJob(const string fileToExecute,
-                                   const vector<string>& filesToExport,
-                                   const vector<string>& filesToImport,
-                                   const batchParams& batch_params,
-                                   const machineParams& params) throw (LauncherException)
-{
-  throw LauncherException("Method Launcher_cpp::submitSalomeJob is not available "
-                          "(libBatch was not found at compilation time).");
-}
-
-string Launcher_cpp::queryJob(long id,
-                              const machineParams& params) throw (LauncherException)
-{
-  throw LauncherException("Method Launcher_cpp::queryJob is not available "
-                          "(libBatch was not found at compilation time).");
-}
-
-string Launcher_cpp::queryJob(long id,
-                              const string clusterName) throw (LauncherException)
-{
-  throw LauncherException("Method Launcher_cpp::queryJob is not available "
-                          "(libBatch was not found at compilation time).");
-}
-
-void Launcher_cpp::deleteJob(const long id,
-                             const machineParams& params) throw (LauncherException)
-{
-  throw LauncherException("Method Launcher_cpp::deleteJob is not available "
-                          "(libBatch was not found at compilation time).");
-}
-
-void Launcher_cpp::deleteJob(long id,
-                             const string clusterName) throw (LauncherException)
-{
-  throw LauncherException("Method Launcher_cpp::deleteJob is not available "
-                          "(libBatch was not found at compilation time).");
-}
-
-void Launcher_cpp::getResultsJob(const string directory,
-                                 const long id,
-                                 const machineParams& params) throw (LauncherException)
-{
-  throw LauncherException("Method Launcher_cpp::getResultsJob is not available "
-                          "(libBatch was not found at compilation time).");
-}
-
-void Launcher_cpp::getResultsJob(const string directory,
-                                 long id,
-                                 const string clusterName) throw (LauncherException)
-{
-  throw LauncherException("Method Launcher_cpp::getResultsJob is not available "
-                          "(libBatch was not found at compilation time).");
-}
index 9e14cc361f7cb89d001e43ded743e79707ce3741..b0f2601e9e271606be63edb933efb347e73d7d48 100644 (file)
 //  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 //
 
+#ifdef WITH_LIBBATCH
 #include <Batch/Batch_Date.hxx>
 #include <Batch/Batch_FactBatchManager_eLSF.hxx>
 #include <Batch/Batch_FactBatchManager_ePBS.hxx>
 #include <Batch/Batch_BatchManager_eClient.hxx>
 #include <Batch/Batch_FactBatchManager_eSGE.hxx>
+#endif
+
 #include "SALOME_Launcher_Handler.hxx"
 #include "Launcher.hxx"
 #include <iostream>
@@ -61,12 +64,15 @@ Launcher_cpp::~Launcher_cpp()
 #if defined(_DEBUG_) || defined(_DEBUG)
   cerr << "Launcher_cpp destructor" << endl;
 #endif
+
+#ifdef WITH_LIBBATCH
   std::map < string, Batch::BatchManager_eClient * >::const_iterator it1;
   for(it1=_batchmap.begin();it1!=_batchmap.end();it1++)
     delete it1->second;
   std::map < std::pair<std::string,long> , Batch::Job* >::const_iterator it2;
   for(it2=_jobmap.begin();it2!=_jobmap.end();it2++)
     delete it2->second;
+#endif
 }
 
 //=============================================================================
@@ -79,6 +85,7 @@ Launcher_cpp::~Launcher_cpp()
 long Launcher_cpp::submitJob( const std::string xmlExecuteFile,
                   const std::string clusterName) throw(LauncherException)
 {
+#ifdef WITH_LIBBATCH
 #if defined(_DEBUG_) || defined(_DEBUG)
   cout << "BEGIN OF Launcher_cpp::submitJob" << endl;
 #endif
@@ -174,6 +181,10 @@ long Launcher_cpp::submitJob( const std::string xmlExecuteFile,
   }
 
   return jobId;
+#else
+  throw LauncherException("Method Launcher_cpp::submitJob is not available "
+                          "(libBatch was not present at compilation time)");
+#endif
 }
 
 //=============================================================================
@@ -191,6 +202,7 @@ long Launcher_cpp::submitSalomeJob( const string fileToExecute ,
                                    const batchParams& batch_params,
                                    const machineParams& params) throw(LauncherException)
 {
+#ifdef WITH_LIBBATCH
 #if defined(_DEBUG_) || defined(_DEBUG)
   cerr << "BEGIN OF Launcher_cpp::submitSalomeJob" << endl;
 #endif
@@ -279,6 +291,10 @@ long Launcher_cpp::submitSalomeJob( const string fileToExecute ,
   }
 
   return jobId;
+#else
+  throw LauncherException("Method Launcher_cpp::submitSalomeJob is not available "
+                          "(libBatch was not present at compilation time)");
+#endif
 }
 
 //=============================================================================
@@ -291,6 +307,7 @@ long Launcher_cpp::submitSalomeJob( const string fileToExecute ,
 string Launcher_cpp::queryJob( long id, 
                               const machineParams& params) throw(LauncherException)
 {
+#ifdef WITH_LIBBATCH
   if(!_ResManager)
     throw LauncherException("You must set Resources Manager to Launcher!!");
 
@@ -318,6 +335,10 @@ string Launcher_cpp::queryJob( long id,
   }
 
   return par[STATE];
+#else
+  throw LauncherException("Method Launcher_cpp::queryJob is not available "
+                          "(libBatch was not present at compilation time)");
+#endif
 }
 
 string Launcher_cpp::queryJob( long id, 
@@ -338,6 +359,7 @@ string Launcher_cpp::queryJob( long id,
 void Launcher_cpp::deleteJob( const long id, 
                              const machineParams& params) throw(LauncherException)
 {
+#ifdef WITH_LIBBATCH
   if(!_ResManager)
     throw LauncherException("You must set Resources Manager to Launcher!!");
 
@@ -356,6 +378,10 @@ void Launcher_cpp::deleteJob( const long id,
   Batch::JobId jobId( _batchmap[clustername], oss.str() );
 
   jobId.deleteJob();
+#else
+  throw LauncherException("Method Launcher_cpp::deleteJob is not available "
+                          "(libBatch was not present at compilation time)");
+#endif
 }
 
 void Launcher_cpp::deleteJob( long id, 
@@ -377,6 +403,7 @@ void Launcher_cpp::getResultsJob( const string directory,
                                  const long id, 
                                  const machineParams& params) throw(LauncherException)
 {
+#ifdef WITH_LIBBATCH
   if(!_ResManager)
     throw LauncherException("You must set Resources Manager to Launcher!!");
 
@@ -392,6 +419,10 @@ void Launcher_cpp::getResultsJob( const string directory,
   Batch::Job* job = _jobmap[ pair<string,long>(clustername,id) ];
 
   _batchmap[clustername]->importOutputFiles( *job, directory );
+#else
+  throw LauncherException("Method Launcher_cpp::getResultsJob is not available "
+                          "(libBatch was not present at compilation time)");
+#endif
 }
 
 void Launcher_cpp::getResultsJob( const std::string directory, 
@@ -411,7 +442,7 @@ void Launcher_cpp::getResultsJob( const std::string directory,
 
 Batch::BatchManager_eClient *Launcher_cpp::FactoryBatchManager( const ParserResourcesType& params ) throw(LauncherException)
 {
-
+#ifdef WITH_LIBBATCH
   std::string hostname, mpi;
   Batch::CommunicationProtocolType protocol;
   Batch::FactBatchManager_eClient* fact;
@@ -483,10 +514,15 @@ Batch::BatchManager_eClient *Launcher_cpp::FactoryBatchManager( const ParserReso
     throw LauncherException("no batchmanager for that cluster");
   }
   return (*fact)(hostname.c_str(), protocol, mpi.c_str());
+#else
+  throw LauncherException("Method Launcher_cpp::FactoryBatchManager is not available "
+                          "(libBatch was not present at compilation time)");
+#endif
 }
 
 string Launcher_cpp::buildSalomeCouplingScript(const string fileToExecute, const string dirForTmpFiles, const ParserResourcesType& params)
 {
+#ifdef WITH_LIBBATCH
 #ifndef WIN32 //TODO: need for porting on Windows
   int idx = dirForTmpFiles.find("Batch/");
   std::string filelogtemp = dirForTmpFiles.substr(idx+6, dirForTmpFiles.length());
@@ -605,10 +641,15 @@ string Launcher_cpp::buildSalomeCouplingScript(const string fileToExecute, const
   return "";
 #endif
     
+#else
+  throw LauncherException("Method Launcher_cpp::buildSalomeCouplingScript is not available "
+                          "(libBatch was not present at compilation time)");
+#endif
 }
 
 MpiImpl *Launcher_cpp::FactoryMpiImpl(MpiImplType mpi) throw(LauncherException)
 {
+#ifdef WITH_LIBBATCH
   switch(mpi){
   case lam:
     return new MpiImpl_LAM();
@@ -629,11 +670,15 @@ MpiImpl *Launcher_cpp::FactoryMpiImpl(MpiImplType mpi) throw(LauncherException)
     oss << mpi << " : not yet implemented";
     throw LauncherException(oss.str().c_str());
   }
-
+#else
+  throw LauncherException("Method Launcher_cpp::FactoryMpiImpl is not available "
+                          "(libBatch was not present at compilation time)");
+#endif
 }
 
 string Launcher_cpp::getTmpDirForBatchFiles()
 {
+#ifdef WITH_LIBBATCH
   string ret;
   string thedate;
 
@@ -652,6 +697,10 @@ string Launcher_cpp::getTmpDirForBatchFiles()
   ret = string("Batch/");
   ret += thedate;
   return ret;
+#else
+  throw LauncherException("Method Launcher_cpp::getTmpDirForBatchFiles is not available "
+                          "(libBatch was not present at compilation time)");
+#endif
 }
 
 string Launcher_cpp::getRemoteFile( std::string remoteDir, std::string localFile )
index 235bda84177ed98c916c9506245771736c47e955..fc49e1121e3a75ce3349ee1418a31a0ce8bd622b 100644 (file)
@@ -64,6 +64,10 @@ COMMON_CPPFLAGS=\
        -I$(top_builddir)/idl \
        @CORBA_CXXFLAGS@ @CORBA_INCLUDES@
 
+if WITH_LIBBATCH
+  COMMON_CPPFLAGS += -DWITH_LIBBATCH
+endif
+
 # This local variable defines the list of dependant libraries common to all target in this package.
 COMMON_LIBS =\
        ../Registry/libRegistry.la \
@@ -91,16 +95,10 @@ if WITHONLYLAUNCHER
 else
   lib_LTLIBRARIES = libLauncher.la libSalomeLauncher.la
 endif
-
 libSalomeLauncher_la_SOURCES=\
+       BatchTest.cxx \
        SALOME_Launcher.cxx 
 
-if WITH_BATCH
-  libSalomeLauncher_la_SOURCES += BatchTest.cxx
-else
-  libSalomeLauncher_la_SOURCES += DummyBatchTest.cxx
-endif
-
 libSalomeLauncher_la_CPPFLAGS =\
        $(COMMON_CPPFLAGS)
 
@@ -113,13 +111,8 @@ libSalomeLauncher_la_LIBADD =\
 
 libLauncher_la_SOURCES=\
        SALOME_Launcher_Parser.cxx \
-       SALOME_Launcher_Handler.cxx
-
-if WITH_BATCH
-  libLauncher_la_SOURCES += Launcher.cxx
-else
-  libLauncher_la_SOURCES += DummyLauncher.cxx
-endif
+       SALOME_Launcher_Handler.cxx  \
+       Launcher.cxx
 
 libLauncher_la_CPPFLAGS =\
        -I$(srcdir)/../ResourcesManager \
@@ -127,6 +120,10 @@ libLauncher_la_CPPFLAGS =\
        @MPI_INCLUDES@ \
        @LIBXML_INCLUDES@
 
+if WITH_LIBBATCH
+  libLauncher_la_CPPFLAGS += -DWITH_LIBBATCH
+endif
+
 libLauncher_la_LDFLAGS  =\
        -no-undefined -version-info=0:0:0 \
        @LDEXPDYNFLAGS@