From 09f00d3d40dbc8380e3248b0fbda9405174e5d66 Mon Sep 17 00:00:00 2001 From: barate Date: Fri, 4 Mar 2011 15:20:19 +0000 Subject: [PATCH] Added possibility to add specific parameters in the client classes. Added parameter LL_JOBTYPE for LoadLeveler. --- src/CCC/Batch_BatchManager_eCCC.cxx | 1 + src/CCC/Batch_JobInfo_eCCC.cxx | 2 + src/Core/Batch_BatchManager.cxx | 1 + src/Core/Batch_BatchManagerCatalog.hxx | 2 +- src/Core/Batch_BatchManager_eClient.cxx | 1 + src/Core/Batch_JobInfo.cxx | 3 +- src/Core/Batch_MapKey.cxx | 42 ----- src/Core/Batch_ParameterTypeMap.cxx | 123 +++++++++++++ ..._MapKey.hxx => Batch_ParameterTypeMap.hxx} | 63 ++++--- src/Core/Batch_Parametre.cxx | 162 +----------------- src/Core/Batch_Parametre.hxx | 6 - src/Core/Batch_Versatile.hxx | 5 - src/Core/CMakeLists.txt | 2 +- src/Core/Test/batchtest.conf | 1 + src/LSF/Batch_BatchManager_eLSF.cxx | 1 + src/LSF/Batch_JobInfo_LSF.cxx | 2 + src/LSF/Batch_JobInfo_eLSF.cxx | 2 + src/LSF/Batch_Job_LSF.cxx | 2 + src/LoadLeveler/Batch_BatchManager_eLL.cxx | 23 ++- .../Batch_FactBatchManager_eLL.cxx | 6 +- .../Batch_FactBatchManager_eLL.hxx | 7 +- src/LoadLeveler/Batch_JobInfo_eLL.cxx | 1 + src/LoadLeveler/Test/Test_eLL.cxx | 6 +- src/Local/Batch_BatchManager_Local.cxx | 2 + src/Local/Batch_Job_Local.cxx | 2 + src/Local/Test/Test_Local_RSH.cxx | 1 + src/Local/Test/Test_Local_SH.cxx | 1 + src/Local/Test/Test_Local_SSH.cxx | 1 + src/PBS/Batch_BatchManager_ePBS.cxx | 1 + src/PBS/Batch_JobInfo_PBS.cxx | 2 + src/PBS/Batch_JobInfo_ePBS.cxx | 2 + src/PBS/Batch_Job_PBS.cxx | 2 + src/PBS/Test/Test_PBS.cxx | 1 + src/PBS/Test/Test_ePBS.cxx | 1 + src/Python/libBatch_Swig.i | 1 + src/SGE/Batch_BatchManager_eSGE.cxx | 1 + src/SGE/Batch_JobInfo_eSGE.cxx | 2 + src/SSH/Batch_BatchManager_eSSH.cxx | 1 + src/SSH/Batch_JobInfo_eSSH.cxx | 2 + 39 files changed, 240 insertions(+), 247 deletions(-) delete mode 100644 src/Core/Batch_MapKey.cxx create mode 100644 src/Core/Batch_ParameterTypeMap.cxx rename src/Core/{Batch_MapKey.hxx => Batch_ParameterTypeMap.hxx} (51%) diff --git a/src/CCC/Batch_BatchManager_eCCC.cxx b/src/CCC/Batch_BatchManager_eCCC.cxx index 8ba7597..7284e50 100644 --- a/src/CCC/Batch_BatchManager_eCCC.cxx +++ b/src/CCC/Batch_BatchManager_eCCC.cxx @@ -47,6 +47,7 @@ #include #endif +#include "Batch_Constants.hxx" #include "Batch_BatchManager_eCCC.hxx" #include "Batch_JobInfo_eCCC.hxx" diff --git a/src/CCC/Batch_JobInfo_eCCC.cxx b/src/CCC/Batch_JobInfo_eCCC.cxx index 19058aa..83792a4 100644 --- a/src/CCC/Batch_JobInfo_eCCC.cxx +++ b/src/CCC/Batch_JobInfo_eCCC.cxx @@ -33,6 +33,8 @@ #include #include #include + +#include "Batch_Constants.hxx" #include "Batch_Parametre.hxx" #include "Batch_Environnement.hxx" #include "Batch_RunTimeException.hxx" diff --git a/src/Core/Batch_BatchManager.cxx b/src/Core/Batch_BatchManager.cxx index 55b065f..e3fcc58 100644 --- a/src/Core/Batch_BatchManager.cxx +++ b/src/Core/Batch_BatchManager.cxx @@ -37,6 +37,7 @@ # include #endif +#include "Batch_Constants.hxx" #include "Batch_Job.hxx" #include "Batch_JobId.hxx" #include "Batch_JobInfo.hxx" diff --git a/src/Core/Batch_BatchManagerCatalog.hxx b/src/Core/Batch_BatchManagerCatalog.hxx index 4da699a..7286c59 100644 --- a/src/Core/Batch_BatchManagerCatalog.hxx +++ b/src/Core/Batch_BatchManagerCatalog.hxx @@ -66,7 +66,7 @@ namespace Batch { // Forbid the use of copy constructor and assignment operator BatchManagerCatalog(const BatchManagerCatalog & orig) {} - BatchManagerCatalog& operator=(const BatchManagerCatalog & orig) { return *this; } + void operator=(const BatchManagerCatalog & orig) {} }; diff --git a/src/Core/Batch_BatchManager_eClient.cxx b/src/Core/Batch_BatchManager_eClient.cxx index a96d8a7..babdb82 100644 --- a/src/Core/Batch_BatchManager_eClient.cxx +++ b/src/Core/Batch_BatchManager_eClient.cxx @@ -46,6 +46,7 @@ #include +#include "Batch_Constants.hxx" #include "Batch_BatchManager_eClient.hxx" #include "Batch_RunTimeException.hxx" diff --git a/src/Core/Batch_JobInfo.cxx b/src/Core/Batch_JobInfo.cxx index d7cd989..f754d07 100644 --- a/src/Core/Batch_JobInfo.cxx +++ b/src/Core/Batch_JobInfo.cxx @@ -32,7 +32,8 @@ #include #include #include -//#include "MEDMEM_STRING.hxx" + +#include "Batch_Constants.hxx" #include "Batch_JobInfo.hxx" using namespace std; diff --git a/src/Core/Batch_MapKey.cxx b/src/Core/Batch_MapKey.cxx deleted file mode 100644 index 7242aae..0000000 --- a/src/Core/Batch_MapKey.cxx +++ /dev/null @@ -1,42 +0,0 @@ -// Copyright (C) 2007-2010 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 -// -/* - * MapKey.cxx : - * - * Auteur : Ivan DUTKA-MALEN - EDF R&D - * Mail : mailto:ivan.dutka-malen@der.edf.fr - * Date : Tue Oct 14 14:00:30 2003 - * Projet : Salome 2 - * - */ - -#include -#include "Batch_MapKey.hxx" -using namespace std; - -namespace Batch { - - -} - - -// COMMENTS diff --git a/src/Core/Batch_ParameterTypeMap.cxx b/src/Core/Batch_ParameterTypeMap.cxx new file mode 100644 index 0000000..81675ed --- /dev/null +++ b/src/Core/Batch_ParameterTypeMap.cxx @@ -0,0 +1,123 @@ +// Copyright (C) 2007-2010 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 +// +/* + * Batch_ParameterTypeMap.cxx : + * + * Auteur : Renaud Barate - EDF R&D + * Date : Mars 2011 + * + */ + +#include +#include + +#include "Batch_Constants.hxx" +#include "Batch_InvalidKeyException.hxx" +#include "Batch_ParameterTypeMap.hxx" + +using namespace std; + +namespace Batch { + + /*! + * The values of this type map contain the type of the parameters and the maximum + * number of items in the corresponding Versatile object (0 means any number). + */ + ParameterTypeMap::ParameterTypeMap() + { + // Don't use the string constants in this constructor because they might be uninitialized + addParameter("ACCOUNT", STRING, 1); + addParameter("ARGUMENTS", STRING, 0); + addParameter("CHECKPOINT", LONG, 1); + addParameter("CKPTINTERVAL", LONG, 1); + addParameter("CREATIONTIME", LONG, 1); + addParameter("EGROUP", STRING, 1); + addParameter("ELIGIBLETIME", LONG, 1); + addParameter("ENDTIME", LONG, 1); + addParameter("EUSER", STRING, 1); + addParameter("EXECUTABLE", STRING, 1); + addParameter("EXECUTIONHOST", STRING, 0); + addParameter("EXITCODE", LONG, 1); + addParameter("HOLD", LONG, 1); + addParameter("ID", STRING, 1); + addParameter("INFILE", COUPLE, 0); + addParameter("MAIL", STRING, 1); + addParameter("MAXCPUTIME", LONG, 1); + addParameter("MAXDISKSIZE", LONG, 1); + addParameter("MAXRAMSIZE", LONG, 1); + addParameter("MAXWALLTIME", LONG, 1); + addParameter("MODIFICATIONTIME", LONG, 1); + addParameter("NAME", STRING, 1); + addParameter("NBPROC", LONG, 1); + addParameter("OUTFILE", COUPLE, 0); + addParameter("PID", LONG, 1); + addParameter("QUEUE", STRING, 1); + addParameter("QUEUEDTIME", LONG, 1); + addParameter("SERVER", STRING, 1); + addParameter("STARTTIME", LONG, 1); + addParameter("STATE", STRING, 1); + addParameter("TEXT", STRING, 1); + addParameter("TMPDIR", STRING, 1); + addParameter("USEDCPUTIME", LONG, 1); + addParameter("USEDDISKSIZE", LONG, 1); + addParameter("USEDRAMSIZE", LONG, 1); + addParameter("USEDWALLTIME", LONG, 1); + addParameter("USER", STRING, 1); + addParameter("WORKDIR", STRING, 1); + addParameter("HOMEDIR", STRING, 1); + } + + ParameterTypeMap::~ParameterTypeMap() + { + } + + /*! + * Returns the ParameterTypeMap singleton. + * We use the construct-on-first-use idiom here because otherwise there could be a problem with + * the initialization order between the factory singletons and this type map. Note that since the + * destructors do not depend on the other objects, the order is not important for destruction. + */ + ParameterTypeMap& ParameterTypeMap::getInstance () { + static ParameterTypeMap instance; + return instance; + } + + bool ParameterTypeMap::hasKey(const string & key) const + { + return (_map.find(key) != _map.end()); + } + + const ParameterType & ParameterTypeMap::operator[](const string & key) const + { + map::const_iterator it = _map.find(key); + if (it == _map.end()) throw InvalidKeyException(key); + return it->second; + } + + void ParameterTypeMap::addParameter(const std::string & key, DiscriminatorType type, int maxelem) + { + if (hasKey(key)) throw InvalidKeyException(key + " is already present in type map"); + _map[key].type = type; + _map[key].maxelem = maxelem; + } + +} diff --git a/src/Core/Batch_MapKey.hxx b/src/Core/Batch_ParameterTypeMap.hxx similarity index 51% rename from src/Core/Batch_MapKey.hxx rename to src/Core/Batch_ParameterTypeMap.hxx index d6d9856..9daddcc 100644 --- a/src/Core/Batch_MapKey.hxx +++ b/src/Core/Batch_ParameterTypeMap.hxx @@ -20,50 +20,59 @@ // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // /* - * MapKey.hxx : + * Batch_ParameterTypeMap.hxx : * - * Auteur : Ivan DUTKA-MALEN - EDF R&D - * Mail : mailto:ivan.dutka-malen@der.edf.fr - * Date : Tue Oct 14 14:00:29 2003 - * Projet : Salome 2 + * Auteur : Renaud Barate - EDF R&D + * Date : Mars 2011 * */ -#ifndef _MAPKEY_H_ -#define _MAPKEY_H_ +#ifndef _PARAMETERTYPEMAP_H_ +#define _PARAMETERTYPEMAP_H_ #include "Batch_Defines.hxx" - +#include "Batch_Versatile.hxx" #include +#include namespace Batch { - // une classe privee pour les differents types - // ces types ne peuvent pas etre redefinis - class BATCH_EXPORT MapKey : public std::string + typedef struct { + DiscriminatorType type; + int maxelem; + } ParameterType; + + + /*! + * This class is used to control the type of the values associated with a parameter. + * It's a singleton that can be get only through the static method getInstance(). + */ + class BATCH_EXPORT ParameterTypeMap { + public: + static ParameterTypeMap& getInstance(); + + bool hasKey(const std::string & key) const; + const ParameterType & operator[](const std::string & key) const; + + void addParameter(const std::string & key, DiscriminatorType type, int maxelem); + + protected: + + ParameterTypeMap(); + virtual ~ParameterTypeMap(); + + std::map _map; + private: - friend class Parametre; // seule la classe Parametre peut creer des MapKey - MapKey() : std::string() {} - MapKey(const MapKey & mk, size_type pos, size_type npos) : std::string(mk, pos, npos) {} - MapKey(const char * s, size_type n) : std::string(s, n) {} - MapKey(const char * s) : std::string(s) {} - MapKey(size_type n, char c) : std::string(n, c) {} -#ifdef __STL_MEMBER_TEMPLATES - template - MapKey(InputIterator __begin, InputIterator __end) : std::string(__begin, __end) {} -#else - MapKey(const_iterator __begin, const_iterator __end) : std::string(__begin, __end) {} -#endif - public: - MapKey(const MapKey & mk) : std::string(mk) {} + // Forbid the use of copy constructor and assignment operator + ParameterTypeMap(const ParameterTypeMap & orig) {} + void operator=(const ParameterTypeMap & orig) {} }; } #endif - -// COMMENTS diff --git a/src/Core/Batch_Parametre.cxx b/src/Core/Batch_Parametre.cxx index df57cfe..68b05b2 100644 --- a/src/Core/Batch_Parametre.cxx +++ b/src/Core/Batch_Parametre.cxx @@ -30,6 +30,7 @@ #include "Batch_Versatile.hxx" #include "Batch_InvalidKeyException.hxx" +#include "Batch_ParameterTypeMap.hxx" #include "Batch_Parametre.hxx" using namespace std; @@ -37,128 +38,8 @@ using namespace std; namespace Batch { // Constructeur standard - // La map interne TypeMap possede les memes clefs que la map principale, mais les - // valeurs associees contiennent le type des clefs de la map principale ainsi que - // le nombre de valeurs autorisees dans l'objet Versatile (0=nombre quelconque, - // sinon valeur precisee) Parametre::Parametre() : map< string, Versatile >() { - TypeMap[ACCOUNT].type = STRING; - TypeMap[ACCOUNT].maxelem = 1; - - TypeMap[ARGUMENTS].type = STRING; - TypeMap[ARGUMENTS].maxelem = 0; - - TypeMap[CHECKPOINT].type = LONG; - TypeMap[CHECKPOINT].maxelem = 1; - - TypeMap[CKPTINTERVAL].type = LONG; - TypeMap[CKPTINTERVAL].maxelem = 1; - - TypeMap[CREATIONTIME].type = LONG; - TypeMap[CREATIONTIME].maxelem = 1; - - TypeMap[EGROUP].type = STRING; - TypeMap[EGROUP].maxelem = 1; - - TypeMap[ELIGIBLETIME].type = LONG; - TypeMap[ELIGIBLETIME].maxelem = 1; - - TypeMap[ENDTIME].type = LONG; - TypeMap[ENDTIME].maxelem = 1; - - TypeMap[EUSER].type = STRING; - TypeMap[EUSER].maxelem = 1; - - TypeMap[EXECUTABLE].type = STRING; - TypeMap[EXECUTABLE].maxelem = 1; - - TypeMap[EXECUTIONHOST].type = STRING; - TypeMap[EXECUTIONHOST].maxelem = 0; - - TypeMap[EXITCODE].type = LONG; - TypeMap[EXITCODE].maxelem = 1; - - TypeMap[HOLD].type = LONG; - TypeMap[HOLD].maxelem = 1; - - TypeMap[ID].type = STRING; - TypeMap[ID].maxelem = 1; - - TypeMap[INFILE].type = COUPLE; - TypeMap[INFILE].maxelem = 0; - - TypeMap[MAIL].type = STRING; - TypeMap[MAIL].maxelem = 1; - - TypeMap[MAXCPUTIME].type = LONG; - TypeMap[MAXCPUTIME].maxelem = 1; - - TypeMap[MAXDISKSIZE].type = LONG; - TypeMap[MAXDISKSIZE].maxelem = 1; - - TypeMap[MAXRAMSIZE].type = LONG; - TypeMap[MAXRAMSIZE].maxelem = 1; - - TypeMap[MAXWALLTIME].type = LONG; - TypeMap[MAXWALLTIME].maxelem = 1; - - TypeMap[MODIFICATIONTIME].type = LONG; - TypeMap[MODIFICATIONTIME].maxelem = 1; - - TypeMap[NAME].type = STRING; - TypeMap[NAME].maxelem = 1; - - TypeMap[NBPROC].type = LONG; - TypeMap[NBPROC].maxelem = 1; - - TypeMap[OUTFILE].type = COUPLE; - TypeMap[OUTFILE].maxelem = 0; - - TypeMap[PID].type = LONG; - TypeMap[PID].maxelem = 1; - - TypeMap[QUEUE].type = STRING; - TypeMap[QUEUE].maxelem = 1; - - TypeMap[QUEUEDTIME].type = LONG; - TypeMap[QUEUEDTIME].maxelem = 1; - - TypeMap[SERVER].type = STRING; - TypeMap[SERVER].maxelem = 1; - - TypeMap[STARTTIME].type = LONG; - TypeMap[STARTTIME].maxelem = 1; - - TypeMap[STATE].type = STRING; - TypeMap[STATE].maxelem = 1; - - TypeMap[TEXT].type = STRING; - TypeMap[TEXT].maxelem = 1; - - TypeMap[TMPDIR].type = STRING; - TypeMap[TMPDIR].maxelem = 1; - - TypeMap[USEDCPUTIME].type = LONG; - TypeMap[USEDCPUTIME].maxelem = 1; - - TypeMap[USEDDISKSIZE].type = LONG; - TypeMap[USEDDISKSIZE].maxelem = 1; - - TypeMap[USEDRAMSIZE].type = LONG; - TypeMap[USEDRAMSIZE].maxelem = 1; - - TypeMap[USEDWALLTIME].type = LONG; - TypeMap[USEDWALLTIME].maxelem = 1; - - TypeMap[USER].type = STRING; - TypeMap[USER].maxelem = 1; - - TypeMap[WORKDIR].type = STRING; - TypeMap[WORKDIR].maxelem = 1; - - TypeMap[HOMEDIR].type = STRING; - TypeMap[HOMEDIR].maxelem = 1; } // Operateur de recherche dans la map @@ -167,7 +48,7 @@ namespace Batch { Versatile & Parametre::operator [] (const string & mk) { // On controle que la clef est valide - if (TypeMap.find(mk) == TypeMap.end()) throw InvalidKeyException(mk.c_str()); + if (!ParameterTypeMap::getInstance().hasKey(mk)) throw InvalidKeyException(mk); // On recherche la valeur associee... Versatile & V = map< string, Versatile >::operator [] (mk); @@ -177,8 +58,8 @@ namespace Batch { // different de celui inscrit dans TypeMap) une exception TypeMismatchException est // levee V.setName(mk); - V.setType(TypeMap[mk].type); - V.setMaxSize(TypeMap[mk].maxelem); + V.setType(ParameterTypeMap::getInstance()[mk].type); + V.setMaxSize(ParameterTypeMap::getInstance()[mk].maxelem); return V; } @@ -188,11 +69,11 @@ namespace Batch { const Versatile & Parametre::operator [] (const string & mk) const { // On controle que la clef est valide - if (TypeMap.find(mk) == TypeMap.end()) throw InvalidKeyException(mk.c_str()); + if (!ParameterTypeMap::getInstance().hasKey(mk)) throw InvalidKeyException(mk); // On recherche la valeur associee Parametre::const_iterator it = find(mk); - if (it == end()) throw InvalidKeyException(mk.c_str()); + if (it == end()) throw InvalidKeyException(mk); const Versatile & V = (*it).second; return V; @@ -207,17 +88,10 @@ namespace Batch { // On efface toute la map erase(begin(), end()); - // On recopie la map interne - // Meme si cela ne sert a rien pour le moment car les maps internes sont identiques, - // il n'est pas exclu que dans un avenir proche elles puissent etre differentes - (*this).TypeMap = PM.TypeMap; - // On recree la structure interne de la map avec les valeurs de celle passee en argument Parametre::const_iterator it; for(it=PM.begin(); it!=PM.end(); it++) - insert(make_pair( (*it).first , - Versatile( (*it).second) - ) ); + insert(make_pair((*it).first, Versatile((*it).second))); return *this; } @@ -225,28 +99,10 @@ namespace Batch { // Constructeur par recopie Parametre::Parametre(const Parametre & PM) : map< string, Versatile >() { - // inutile car l'objet est vierge : il vient d'etre cree - // On efface toute la map - // erase(begin(), end()); - - // On recopie la map interne - (*this).TypeMap = PM.TypeMap; - // On cree la structure interne de la map avec les valeurs de celle passee en argument Parametre::const_iterator it; - for(it=PM.begin(); - it!=PM.end(); - it++) - insert( - make_pair( - (*it).first , - Versatile( (*it).second) - ) ); + for(it=PM.begin(); it!=PM.end(); it++) + insert(make_pair((*it).first, Versatile((*it).second))); } - // map< string, TypeParam > Parametre::getTypeMap() const - // { - // return TypeMap; - // } - } diff --git a/src/Core/Batch_Parametre.hxx b/src/Core/Batch_Parametre.hxx index 09e0a48..2cb79a9 100644 --- a/src/Core/Batch_Parametre.hxx +++ b/src/Core/Batch_Parametre.hxx @@ -35,7 +35,6 @@ #include #include "Batch_Defines.hxx" -#include "Batch_Constants.hxx" #include "Batch_Versatile.hxx" namespace Batch { @@ -56,11 +55,6 @@ namespace Batch { // Operateur d'affectation Parametre & operator =(const Parametre & PM); - protected: - std::map< std::string, TypeParam > TypeMap; // map interne servant a controler le type de la valeur associee a chaque clef - - private: - }; } diff --git a/src/Core/Batch_Versatile.hxx b/src/Core/Batch_Versatile.hxx index 1e35495..b969bee 100644 --- a/src/Core/Batch_Versatile.hxx +++ b/src/Core/Batch_Versatile.hxx @@ -52,11 +52,6 @@ namespace Batch { // enum DiscriminatorType { UNDEFINED, BOOL, CHAR, INT, LONG, STRING}; enum DiscriminatorType { UNDEFINED, LONG, STRING, COUPLE }; - typedef struct { - DiscriminatorType type; // le type de l'element interne - int maxelem; // le nombre d'elements autorises - } TypeParam; - class BATCH_EXPORT Versatile : public std::list< GenericType * > { public: diff --git a/src/Core/CMakeLists.txt b/src/Core/CMakeLists.txt index b866c2e..cec2935 100644 --- a/src/Core/CMakeLists.txt +++ b/src/Core/CMakeLists.txt @@ -47,9 +47,9 @@ SET(CLASS_LIST Core/Batch_APIInternalFailureException Core/Batch_JobInfo Core/Batch_ListIsFullException Core/Batch_LongType - Core/Batch_MapKey Core/Batch_MpiImpl Core/Batch_NotYetImplementedException + Core/Batch_ParameterTypeMap Core/Batch_Parametre Core/Batch_RunTimeException Core/Batch_StringType diff --git a/src/Core/Test/batchtest.conf b/src/Core/Test/batchtest.conf index cb300f2..2e1b8f3 100644 --- a/src/Core/Test/batchtest.conf +++ b/src/Core/Test/batchtest.conf @@ -36,4 +36,5 @@ TEST_ELL_HOST = "localhost" # LoadLeveler server host TEST_ELL_USER = "username" # Login for the LoadLeveler server TEST_ELL_HOMEDIR = "/home/username" # Home directory on LoadLeveler server TEST_ELL_QUEUE = "classname" # Class for the test job test job on LoadLeveler server +TEST_ELL_JOBTYPE = "serial" # Job type for LoadLeveler TEST_ELL_TIMEOUT = 120 # Execution timeout (in seconds) for LoadLeveler Batch test diff --git a/src/LSF/Batch_BatchManager_eLSF.cxx b/src/LSF/Batch_BatchManager_eLSF.cxx index 4938070..44b6f97 100644 --- a/src/LSF/Batch_BatchManager_eLSF.cxx +++ b/src/LSF/Batch_BatchManager_eLSF.cxx @@ -47,6 +47,7 @@ #include #endif +#include "Batch_Constants.hxx" #include "Batch_BatchManager_eLSF.hxx" #include "Batch_JobInfo_eLSF.hxx" diff --git a/src/LSF/Batch_JobInfo_LSF.cxx b/src/LSF/Batch_JobInfo_LSF.cxx index 16412a4..04ca33e 100644 --- a/src/LSF/Batch_JobInfo_LSF.cxx +++ b/src/LSF/Batch_JobInfo_LSF.cxx @@ -32,6 +32,8 @@ #include #include #include + +#include "Batch_Constants.hxx" #include "Batch_Parametre.hxx" #include "Batch_Environnement.hxx" #include "Batch_RunTimeException.hxx" diff --git a/src/LSF/Batch_JobInfo_eLSF.cxx b/src/LSF/Batch_JobInfo_eLSF.cxx index 7ff8512..4fe6e4a 100644 --- a/src/LSF/Batch_JobInfo_eLSF.cxx +++ b/src/LSF/Batch_JobInfo_eLSF.cxx @@ -33,6 +33,8 @@ #include #include #include + +#include "Batch_Constants.hxx" #include "Batch_Parametre.hxx" #include "Batch_Environnement.hxx" #include "Batch_RunTimeException.hxx" diff --git a/src/LSF/Batch_Job_LSF.cxx b/src/LSF/Batch_Job_LSF.cxx index 2d3221f..8ac3f73 100644 --- a/src/LSF/Batch_Job_LSF.cxx +++ b/src/LSF/Batch_Job_LSF.cxx @@ -34,6 +34,8 @@ #include #include #include + +#include "Batch_Constants.hxx" #include "Batch_Job_LSF.hxx" using namespace std; diff --git a/src/LoadLeveler/Batch_BatchManager_eLL.cxx b/src/LoadLeveler/Batch_BatchManager_eLL.cxx index d8f4556..57d55e7 100644 --- a/src/LoadLeveler/Batch_BatchManager_eLL.cxx +++ b/src/LoadLeveler/Batch_BatchManager_eLL.cxx @@ -31,7 +31,9 @@ #include #include +#include +#include "Batch_FactBatchManager_eLL.hxx" #include "Batch_BatchManager_eLL.hxx" #include "Batch_JobInfo_eLL.hxx" @@ -154,16 +156,23 @@ namespace Batch { int nbproc = 1; if (params.find(NBPROC) != params.end()) nbproc = params[NBPROC]; - //if (nbproc == 1) - // tempOutputFile << "# @ job_type = serial" << endl; - //else { - // tempOutputFile << "# @ job_type = parallel" << endl; + + // If job type is not specified, try to guess it from number of procs + string job_type; + if (params.find(LL_JOBTYPE) != params.end()) + job_type = params[LL_JOBTYPE].str(); + else if (nbproc == 1) + job_type = "serial"; + else + job_type = "mpich"; + + tempOutputFile << "# @ job_type = " << job_type << endl; + + if (job_type != "serial") { int nodes_requested = (nbproc + _nb_proc_per_node -1) / _nb_proc_per_node; - tempOutputFile << "# @ job_type = mpich" << endl; tempOutputFile << "# @ node = " << nodes_requested << endl; tempOutputFile << "# @ tasks_per_node = " << _nb_proc_per_node << endl; - //} - //tempOutputFile << "# @ job_type = bluegene" << endl; + } if (params.find(MAXWALLTIME) != params.end()) tempOutputFile << "# @ wall_clock_limit = " << params[MAXWALLTIME] << ":00" << endl; diff --git a/src/LoadLeveler/Batch_FactBatchManager_eLL.cxx b/src/LoadLeveler/Batch_FactBatchManager_eLL.cxx index 6017873..f3997b4 100644 --- a/src/LoadLeveler/Batch_FactBatchManager_eLL.cxx +++ b/src/LoadLeveler/Batch_FactBatchManager_eLL.cxx @@ -26,16 +26,20 @@ * Author : Renaud BARATE - EDF R&D */ +#include "Batch_ParameterTypeMap.hxx" #include "Batch_BatchManager_eLL.hxx" #include "Batch_FactBatchManager_eLL.hxx" namespace Batch { + def_Constant(LL_JOBTYPE); + static FactBatchManager_eLL sFBM_eLL; FactBatchManager_eLL::FactBatchManager_eLL() : FactBatchManager_eClient("eLL") { - // Nothing to do + // Add specific parameters + ParameterTypeMap::getInstance().addParameter(LL_JOBTYPE, STRING, 1); } FactBatchManager_eLL::~FactBatchManager_eLL() diff --git a/src/LoadLeveler/Batch_FactBatchManager_eLL.hxx b/src/LoadLeveler/Batch_FactBatchManager_eLL.hxx index 5feefd9..ba6cc48 100644 --- a/src/LoadLeveler/Batch_FactBatchManager_eLL.hxx +++ b/src/LoadLeveler/Batch_FactBatchManager_eLL.hxx @@ -29,13 +29,16 @@ #ifndef _FACTBATCHMANAGER_ELL_H_ #define _FACTBATCHMANAGER_ELL_H_ -#include "Batch_Defines.hxx" +#include +#include #include "Batch_BatchManager_eClient.hxx" #include "Batch_FactBatchManager_eClient.hxx" namespace Batch { - + + decl_extern_Constant(LL_JOBTYPE); + class BatchManager_eLL; class BATCH_EXPORT FactBatchManager_eLL : public FactBatchManager_eClient diff --git a/src/LoadLeveler/Batch_JobInfo_eLL.cxx b/src/LoadLeveler/Batch_JobInfo_eLL.cxx index 33f9ef2..52f20ea 100644 --- a/src/LoadLeveler/Batch_JobInfo_eLL.cxx +++ b/src/LoadLeveler/Batch_JobInfo_eLL.cxx @@ -31,6 +31,7 @@ #include #include +#include #include "Batch_JobInfo_eLL.hxx" diff --git a/src/LoadLeveler/Test/Test_eLL.cxx b/src/LoadLeveler/Test/Test_eLL.cxx index ce5191e..d9096d2 100644 --- a/src/LoadLeveler/Test/Test_eLL.cxx +++ b/src/LoadLeveler/Test/Test_eLL.cxx @@ -31,10 +31,12 @@ #include #include +#include #include #include #include #include +#include #include #include @@ -83,6 +85,7 @@ int main(int argc, char** argv) const string & host = parser.getValue("TEST_ELL_HOST"); const string & user = parser.getValue("TEST_ELL_USER"); const string & queue = parser.getValue("TEST_ELL_QUEUE"); + const string & jobType = parser.getValue("TEST_ELL_JOBTYPE"); int timeout = parser.getValueAsInt("TEST_ELL_TIMEOUT"); // Define the job... @@ -98,9 +101,10 @@ int main(int argc, char** argv) p[TMPDIR] = "tmp/Batch/"; p[NBPROC] = 1; p[MAXWALLTIME] = 1; - p[MAXRAMSIZE] = 10; + p[MAXRAMSIZE] = 50; p[HOMEDIR] = homedir; p[QUEUE] = queue; + p[LL_JOBTYPE] = jobType; job.setParametre(p); // ... and its environment Environnement e; diff --git a/src/Local/Batch_BatchManager_Local.cxx b/src/Local/Batch_BatchManager_Local.cxx index 59e79a1..3337ee4 100644 --- a/src/Local/Batch_BatchManager_Local.cxx +++ b/src/Local/Batch_BatchManager_Local.cxx @@ -50,6 +50,8 @@ #include #include #include + +#include "Batch_Constants.hxx" #include "Batch_IOMutex.hxx" #include "Batch_BatchManager_Local.hxx" #include "Batch_RunTimeException.hxx" diff --git a/src/Local/Batch_Job_Local.cxx b/src/Local/Batch_Job_Local.cxx index 999858d..47beaf3 100644 --- a/src/Local/Batch_Job_Local.cxx +++ b/src/Local/Batch_Job_Local.cxx @@ -34,6 +34,8 @@ #ifndef WIN32 #include #endif + +#include "Batch_Constants.hxx" #include "Batch_Job_Local.hxx" using namespace std; diff --git a/src/Local/Test/Test_Local_RSH.cxx b/src/Local/Test/Test_Local_RSH.cxx index 070fbe4..db7203c 100644 --- a/src/Local/Test/Test_Local_RSH.cxx +++ b/src/Local/Test/Test_Local_RSH.cxx @@ -30,6 +30,7 @@ #include #include +#include #include #include #include diff --git a/src/Local/Test/Test_Local_SH.cxx b/src/Local/Test/Test_Local_SH.cxx index aad5806..89a593f 100644 --- a/src/Local/Test/Test_Local_SH.cxx +++ b/src/Local/Test/Test_Local_SH.cxx @@ -30,6 +30,7 @@ #include #include +#include #include #include #include diff --git a/src/Local/Test/Test_Local_SSH.cxx b/src/Local/Test/Test_Local_SSH.cxx index 82e85f9..433e73e 100644 --- a/src/Local/Test/Test_Local_SSH.cxx +++ b/src/Local/Test/Test_Local_SSH.cxx @@ -31,6 +31,7 @@ #include #include +#include #include #include #include diff --git a/src/PBS/Batch_BatchManager_ePBS.cxx b/src/PBS/Batch_BatchManager_ePBS.cxx index 12f79eb..3191b6b 100644 --- a/src/PBS/Batch_BatchManager_ePBS.cxx +++ b/src/PBS/Batch_BatchManager_ePBS.cxx @@ -47,6 +47,7 @@ #include #endif +#include "Batch_Constants.hxx" #include "Batch_BatchManager_ePBS.hxx" #include "Batch_JobInfo_ePBS.hxx" diff --git a/src/PBS/Batch_JobInfo_PBS.cxx b/src/PBS/Batch_JobInfo_PBS.cxx index 02b4d81..cbe7890 100644 --- a/src/PBS/Batch_JobInfo_PBS.cxx +++ b/src/PBS/Batch_JobInfo_PBS.cxx @@ -33,6 +33,8 @@ #include #include #include + +#include "Batch_Constants.hxx" #include "Batch_Parametre.hxx" #include "Batch_Environnement.hxx" #include "Batch_RunTimeException.hxx" diff --git a/src/PBS/Batch_JobInfo_ePBS.cxx b/src/PBS/Batch_JobInfo_ePBS.cxx index e9f86ea..1d0d968 100644 --- a/src/PBS/Batch_JobInfo_ePBS.cxx +++ b/src/PBS/Batch_JobInfo_ePBS.cxx @@ -33,6 +33,8 @@ #include #include #include + +#include "Batch_Constants.hxx" #include "Batch_Parametre.hxx" #include "Batch_Environnement.hxx" #include "Batch_RunTimeException.hxx" diff --git a/src/PBS/Batch_Job_PBS.cxx b/src/PBS/Batch_Job_PBS.cxx index cd84b8f..ea66fd0 100644 --- a/src/PBS/Batch_Job_PBS.cxx +++ b/src/PBS/Batch_Job_PBS.cxx @@ -33,6 +33,8 @@ #include #include #include + +#include "Batch_Constants.hxx" #include "Batch_Job_PBS.hxx" using namespace std; diff --git a/src/PBS/Test/Test_PBS.cxx b/src/PBS/Test/Test_PBS.cxx index 543f9de..1425cbd 100644 --- a/src/PBS/Test/Test_PBS.cxx +++ b/src/PBS/Test/Test_PBS.cxx @@ -30,6 +30,7 @@ #include #include +#include #include #include #include diff --git a/src/PBS/Test/Test_ePBS.cxx b/src/PBS/Test/Test_ePBS.cxx index 1a3b92d..35f0cc5 100644 --- a/src/PBS/Test/Test_ePBS.cxx +++ b/src/PBS/Test/Test_ePBS.cxx @@ -31,6 +31,7 @@ #include #include +#include #include #include #include diff --git a/src/Python/libBatch_Swig.i b/src/Python/libBatch_Swig.i index ac94be8..b56e734 100644 --- a/src/Python/libBatch_Swig.i +++ b/src/Python/libBatch_Swig.i @@ -57,6 +57,7 @@ %{ #include "Batch_Defines.hxx" +#include "Batch_Constants.hxx" #include "Batch_Job.hxx" #include "Batch_JobId.hxx" #include "Batch_JobInfo.hxx" diff --git a/src/SGE/Batch_BatchManager_eSGE.cxx b/src/SGE/Batch_BatchManager_eSGE.cxx index 4f0d305..51447b2 100644 --- a/src/SGE/Batch_BatchManager_eSGE.cxx +++ b/src/SGE/Batch_BatchManager_eSGE.cxx @@ -46,6 +46,7 @@ #include #endif +#include "Batch_Constants.hxx" #include "Batch_BatchManager_eSGE.hxx" #include "Batch_JobInfo_eSGE.hxx" diff --git a/src/SGE/Batch_JobInfo_eSGE.cxx b/src/SGE/Batch_JobInfo_eSGE.cxx index bf50973..57c4fdc 100644 --- a/src/SGE/Batch_JobInfo_eSGE.cxx +++ b/src/SGE/Batch_JobInfo_eSGE.cxx @@ -33,6 +33,8 @@ #include #include #include + +#include "Batch_Constants.hxx" #include "Batch_Parametre.hxx" #include "Batch_Environnement.hxx" #include "Batch_RunTimeException.hxx" diff --git a/src/SSH/Batch_BatchManager_eSSH.cxx b/src/SSH/Batch_BatchManager_eSSH.cxx index 2d184af..5b05539 100644 --- a/src/SSH/Batch_BatchManager_eSSH.cxx +++ b/src/SSH/Batch_BatchManager_eSSH.cxx @@ -41,6 +41,7 @@ #include #endif +#include "Batch_Constants.hxx" #include "Batch_BatchManager_eSSH.hxx" #include "Batch_JobInfo_eSSH.hxx" diff --git a/src/SSH/Batch_JobInfo_eSSH.cxx b/src/SSH/Batch_JobInfo_eSSH.cxx index 19ab1d0..97d0cb8 100644 --- a/src/SSH/Batch_JobInfo_eSSH.cxx +++ b/src/SSH/Batch_JobInfo_eSSH.cxx @@ -30,6 +30,8 @@ #include #include #include + +#include "Batch_Constants.hxx" #include "Batch_Parametre.hxx" #include "Batch_Environnement.hxx" #include "Batch_RunTimeException.hxx" -- 2.39.2