Salome HOME
Added possibility to add specific parameters in the client classes. Added parameter...
authorbarate <barate>
Fri, 4 Mar 2011 15:20:19 +0000 (15:20 +0000)
committerbarate <barate>
Fri, 4 Mar 2011 15:20:19 +0000 (15:20 +0000)
40 files changed:
src/CCC/Batch_BatchManager_eCCC.cxx
src/CCC/Batch_JobInfo_eCCC.cxx
src/Core/Batch_BatchManager.cxx
src/Core/Batch_BatchManagerCatalog.hxx
src/Core/Batch_BatchManager_eClient.cxx
src/Core/Batch_JobInfo.cxx
src/Core/Batch_MapKey.cxx [deleted file]
src/Core/Batch_MapKey.hxx [deleted file]
src/Core/Batch_ParameterTypeMap.cxx [new file with mode: 0644]
src/Core/Batch_ParameterTypeMap.hxx [new file with mode: 0644]
src/Core/Batch_Parametre.cxx
src/Core/Batch_Parametre.hxx
src/Core/Batch_Versatile.hxx
src/Core/CMakeLists.txt
src/Core/Test/batchtest.conf
src/LSF/Batch_BatchManager_eLSF.cxx
src/LSF/Batch_JobInfo_LSF.cxx
src/LSF/Batch_JobInfo_eLSF.cxx
src/LSF/Batch_Job_LSF.cxx
src/LoadLeveler/Batch_BatchManager_eLL.cxx
src/LoadLeveler/Batch_FactBatchManager_eLL.cxx
src/LoadLeveler/Batch_FactBatchManager_eLL.hxx
src/LoadLeveler/Batch_JobInfo_eLL.cxx
src/LoadLeveler/Test/Test_eLL.cxx
src/Local/Batch_BatchManager_Local.cxx
src/Local/Batch_Job_Local.cxx
src/Local/Test/Test_Local_RSH.cxx
src/Local/Test/Test_Local_SH.cxx
src/Local/Test/Test_Local_SSH.cxx
src/PBS/Batch_BatchManager_ePBS.cxx
src/PBS/Batch_JobInfo_PBS.cxx
src/PBS/Batch_JobInfo_ePBS.cxx
src/PBS/Batch_Job_PBS.cxx
src/PBS/Test/Test_PBS.cxx
src/PBS/Test/Test_ePBS.cxx
src/Python/libBatch_Swig.i
src/SGE/Batch_BatchManager_eSGE.cxx
src/SGE/Batch_JobInfo_eSGE.cxx
src/SSH/Batch_BatchManager_eSSH.cxx
src/SSH/Batch_JobInfo_eSSH.cxx

index 8ba7597a46a997f467672647194c984aa337067c..7284e50faa810b8242973c51b5817dba57c71b2c 100644 (file)
@@ -47,6 +47,7 @@
 #include <libgen.h>
 #endif
 
+#include "Batch_Constants.hxx"
 #include "Batch_BatchManager_eCCC.hxx"
 #include "Batch_JobInfo_eCCC.hxx"
 
index 19058aaa225630b93497609eaeab03fb5848a8fb..83792a492cb1f0d447256237f37581df2f2e3507 100644 (file)
@@ -33,6 +33,8 @@
 #include <iostream>
 #include <fstream>
 #include <sstream>
+
+#include "Batch_Constants.hxx"
 #include "Batch_Parametre.hxx"
 #include "Batch_Environnement.hxx"
 #include "Batch_RunTimeException.hxx"
index 55b065f3d22b29be78f84e2f4eddfd926644338b..e3fcc58d1abd13ce8971e46660a3d994e9f45413 100644 (file)
@@ -37,6 +37,7 @@
 # include <netdb.h>
 #endif
 
+#include "Batch_Constants.hxx"
 #include "Batch_Job.hxx"
 #include "Batch_JobId.hxx"
 #include "Batch_JobInfo.hxx"
index 4da699a8dcbade82735578a6a43dca4f03d561a4..7286c5966704dc3e572a31dd844839ce57ce1119 100644 (file)
@@ -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) {}
 
   };
 
index a96d8a742f8efdbdeeafc853f80e84b6b132be75..babdb826a83d1561c65cfc0be6d98fdda2518219 100644 (file)
@@ -46,6 +46,7 @@
 
 #include <Batch_config.h>
 
+#include "Batch_Constants.hxx"
 #include "Batch_BatchManager_eClient.hxx"
 #include "Batch_RunTimeException.hxx"
 
index d7cd989239ad8335080f8a23a845079d5d49d57e..f754d07d95c68e78de6bdaf5a1f11f32c1cba6a4 100644 (file)
@@ -32,7 +32,8 @@
 #include <iostream>
 #include <string>
 #include <sstream>
-//#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 (file)
index 7242aae..0000000
+++ /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 <string>
-#include "Batch_MapKey.hxx"
-using namespace std;
-
-namespace Batch {
-
-
-}
-
-
-// COMMENTS
diff --git a/src/Core/Batch_MapKey.hxx b/src/Core/Batch_MapKey.hxx
deleted file mode 100644 (file)
index d6d9856..0000000
+++ /dev/null
@@ -1,69 +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.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
- *
- */
-
-#ifndef _MAPKEY_H_
-#define _MAPKEY_H_
-
-#include "Batch_Defines.hxx"
-
-
-#include <string>
-
-namespace Batch {
-
-  // une classe privee pour les differents types
-  // ces types ne peuvent pas etre redefinis
-  class BATCH_EXPORT MapKey : public std::string
-  {
-  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<class InputIterator>
-    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) {}
-
-  };
-
-}
-
-#endif
-
-// COMMENTS
diff --git a/src/Core/Batch_ParameterTypeMap.cxx b/src/Core/Batch_ParameterTypeMap.cxx
new file mode 100644 (file)
index 0000000..81675ed
--- /dev/null
@@ -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 <string>
+#include <map>
+
+#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<string, ParameterType>::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_ParameterTypeMap.hxx b/src/Core/Batch_ParameterTypeMap.hxx
new file mode 100644 (file)
index 0000000..9daddcc
--- /dev/null
@@ -0,0 +1,78 @@
+//  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.hxx :
+ *
+ * Auteur : Renaud Barate - EDF R&D
+ * Date   : Mars 2011
+ *
+ */
+
+#ifndef _PARAMETERTYPEMAP_H_
+#define _PARAMETERTYPEMAP_H_
+
+#include "Batch_Defines.hxx"
+#include "Batch_Versatile.hxx"
+
+#include <string>
+#include <map>
+
+namespace Batch {
+
+  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<std::string, ParameterType> _map;
+
+  private:
+
+    // Forbid the use of copy constructor and assignment operator
+    ParameterTypeMap(const ParameterTypeMap & orig) {}
+    void operator=(const ParameterTypeMap & orig) {}
+
+  };
+
+}
+
+#endif
index df57cfe8a8a76be4f6e46ef0702672200a2264e3..68b05b266c1765dbedc6a1187de7652db4dd2cf9 100644 (file)
@@ -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;
-  //   }
-
 }
index 09e0a48cfc9ad8c52f00e5298ffda6897ee956ff..2cb79a9e0bc92539546b0a94e5a6de85a295cc73 100644 (file)
@@ -35,7 +35,6 @@
 #include <string>
 
 #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:
-
   };
 
 }
index 1e3549590815479c4925f0445b3ba22a9a01494c..b969beee1f3ffc57bbf3f50caaf0b3100ef8b563 100644 (file)
@@ -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:
index b866c2e1e858a326bdc3a4a5e95f112cda9671f2..cec2935027c74ef021ca168bd23f4cae407da4dc 100644 (file)
@@ -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
index cb300f24a0baa6b7a9708d98495baa466b334866..2e1b8f32a896c67c86fafbd2445f80231ac3e699 100644 (file)
@@ -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
index 4938070e52025cf320e2780eeb50512b33174485..44b6f978257bd1290fa193c5927ad8fc8e4ee4e3 100644 (file)
@@ -47,6 +47,7 @@
 #include <libgen.h>
 #endif
 
+#include "Batch_Constants.hxx"
 #include "Batch_BatchManager_eLSF.hxx"
 #include "Batch_JobInfo_eLSF.hxx"
 
index 16412a492ccf9b58073ff7e0bd0f4eb1e1314598..04ca33eb58fab178a165af81034a1da6d9fbdc9a 100644 (file)
@@ -32,6 +32,8 @@
 #include <cstdio>
 #include <sstream>
 #include <string>
+
+#include "Batch_Constants.hxx"
 #include "Batch_Parametre.hxx"
 #include "Batch_Environnement.hxx"
 #include "Batch_RunTimeException.hxx"
index 7ff8512000e490e2de323cbd2ed632ce58a21dc2..4fe6e4a0a765d5703e582042bf531cbcc69f3c67 100644 (file)
@@ -33,6 +33,8 @@
 #include <iostream>
 #include <fstream>
 #include <sstream>
+
+#include "Batch_Constants.hxx"
 #include "Batch_Parametre.hxx"
 #include "Batch_Environnement.hxx"
 #include "Batch_RunTimeException.hxx"
index 2d3221f46493904502d2ab2645c23c8a47bdb71e..8ac3f73d2bcbedfd34922c43ad17873918875ff1 100644 (file)
@@ -34,6 +34,8 @@
 #include <unistd.h>
 #include <string>
 #include <vector>
+
+#include "Batch_Constants.hxx"
 #include "Batch_Job_LSF.hxx"
 
 using namespace std;
index d8f4556d22ee04d6664eb2a657b9e0bdf0902493..57d55e7ce7efe63bf4bd96a31d09b7aacc2eafa6 100644 (file)
@@ -31,7 +31,9 @@
 #include <fstream>
 
 #include <Batch_NotYetImplementedException.hxx>
+#include <Batch_Constants.hxx>
 
+#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;
index 60178736b6ce3a51bc020c196999152e11e9711c..f3997b4bf9f775ed6d20e95cd9f520fda0d97f87 100644 (file)
  *  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()
index 5feefd953284542deaa87639530955aee689d5e6..ba6cc48ba058505abebc2a340a5141cb96661fd4 100644 (file)
 #ifndef _FACTBATCHMANAGER_ELL_H_
 #define _FACTBATCHMANAGER_ELL_H_
 
-#include "Batch_Defines.hxx"
+#include <Batch_Defines.hxx>
+#include <Batch_Constants.hxx>
 
 #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
index 33f9ef27c582b19d962e9921445d53627f9dc6fd..52f20ea5ea7b18fe5bef2d97eb49663ca093e97f 100644 (file)
@@ -31,6 +31,7 @@
 #include <sstream>
 
 #include <Batch_RunTimeException.hxx>
+#include <Batch_Constants.hxx>
 
 #include "Batch_JobInfo_eLL.hxx"
 
index ce5191ef85e66f84d0cab56a16f31c03f4d4863a..d9096d2b77071eb2e3431111a6a5f928f3c6323e 100644 (file)
 #include <fstream>
 #include <cstring>
 
+#include <Batch_Constants.hxx>
 #include <Batch_Job.hxx>
 #include <Batch_BatchManagerCatalog.hxx>
 #include <Batch_FactBatchManager.hxx>
 #include <Batch_FactBatchManager_eClient.hxx>
+#include <Batch_FactBatchManager_eLL.hxx>
 #include <Batch_BatchManager.hxx>
 #include <Batch_BatchManager_eClient.hxx>
 
@@ -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;
index 59e79a10746e4bd0709c1349fdb906b896de1876..3337ee4fa29de6570c33c3a47ae91602984f18ae 100644 (file)
@@ -50,6 +50,8 @@
 #include <signal.h>
 #include <errno.h>
 #include <string.h>
+
+#include "Batch_Constants.hxx"
 #include "Batch_IOMutex.hxx"
 #include "Batch_BatchManager_Local.hxx"
 #include "Batch_RunTimeException.hxx"
index 999858d93d02250c3baf71497ca6c041cc0cd434..47beaf35c719d3837f962677daba0a0df76a5a2a 100644 (file)
@@ -34,6 +34,8 @@
 #ifndef WIN32
 #include <unistd.h>
 #endif
+
+#include "Batch_Constants.hxx"
 #include "Batch_Job_Local.hxx"
 
 using namespace std;
index 070fbe42ad31a2ac138d214da043fb018b6f5386..db7203cfec4c6d8700e483bd5ed01e6656e56346 100644 (file)
@@ -30,6 +30,7 @@
 #include <iostream>
 #include <fstream>
 
+#include <Batch_Constants.hxx>
 #include <Batch_Job.hxx>
 #include <Batch_BatchManagerCatalog.hxx>
 #include <Batch_FactBatchManager.hxx>
index aad5806990a662916e19b74d74fac6721c881af9..89a593fb09f2900df1529d17748cd0cb528764b3 100644 (file)
@@ -30,6 +30,7 @@
 #include <iostream>
 #include <fstream>
 
+#include <Batch_Constants.hxx>
 #include <Batch_Job.hxx>
 #include <Batch_BatchManagerCatalog.hxx>
 #include <Batch_FactBatchManager.hxx>
index 82e85f9d6ba35afedb238624dd3df284e9fb5a1e..433e73eca4430a589814bfda26e76a91b084e878 100644 (file)
@@ -31,6 +31,7 @@
 #include <fstream>
 #include <cstdlib>
 
+#include <Batch_Constants.hxx>
 #include <Batch_Job.hxx>
 #include <Batch_BatchManagerCatalog.hxx>
 #include <Batch_FactBatchManager.hxx>
index 12f79eb60b21a789f51a6f4425278b4eb644166c..3191b6b8c35a310eb457b63ca6dfcb7ff882f4f3 100644 (file)
@@ -47,6 +47,7 @@
 #include <libgen.h>
 #endif
 
+#include "Batch_Constants.hxx"
 #include "Batch_BatchManager_ePBS.hxx"
 #include "Batch_JobInfo_ePBS.hxx"
 
index 02b4d810d28efe2c84692f9ba9fd9f7d5f673a87..cbe7890349684f5345c1ec04291763c6fa7fea77 100644 (file)
@@ -33,6 +33,8 @@
 #include <sstream>
 #include <string.h>
 #include <stdlib.h>
+
+#include "Batch_Constants.hxx"
 #include "Batch_Parametre.hxx"
 #include "Batch_Environnement.hxx"
 #include "Batch_RunTimeException.hxx"
index e9f86ea9ece457f979d804dc80c8ab0cd1e4839a..1d0d9681fc9a4fd0e031f17dc2fbfe4da9aa302c 100644 (file)
@@ -33,6 +33,8 @@
 #include <iostream>
 #include <fstream>
 #include <sstream>
+
+#include "Batch_Constants.hxx"
 #include "Batch_Parametre.hxx"
 #include "Batch_Environnement.hxx"
 #include "Batch_RunTimeException.hxx"
index cd84b8f476fa356f5465a9e03a170e94328cf04f..ea66fd0bb45e298ccd09959e89a375097a29589e 100644 (file)
@@ -33,6 +33,8 @@
 #include <stdlib.h>
 #include <unistd.h>
 #include <cstring>
+
+#include "Batch_Constants.hxx"
 #include "Batch_Job_PBS.hxx"
 using namespace std;
 
index 543f9de28f9dfe6b700b8f8260c1943061739cf9..1425cbd28055439cb8fe7b490e5219842c771e42 100644 (file)
@@ -30,6 +30,7 @@
 #include <iostream>
 #include <fstream>
 
+#include <Batch_Constants.hxx>
 #include <Batch_Job.hxx>
 #include <Batch_BatchManagerCatalog.hxx>
 #include <Batch_FactBatchManager.hxx>
index 1a3b92d2879323cc6ba63e27a209907bc5f1313a..35f0cc554e2332026520c53e815ffa146b1511b4 100644 (file)
@@ -31,6 +31,7 @@
 #include <fstream>
 #include <cstring>
 
+#include <Batch_Constants.hxx>
 #include <Batch_Job.hxx>
 #include <Batch_BatchManagerCatalog.hxx>
 #include <Batch_FactBatchManager.hxx>
index ac94be86f1979432576f28c45fc6ac79240f9782..b56e7343fa3bff31ad51c851aa5ea5f9461a71b3 100644 (file)
@@ -57,6 +57,7 @@
 
 %{
 #include "Batch_Defines.hxx"
+#include "Batch_Constants.hxx"
 #include "Batch_Job.hxx"
 #include "Batch_JobId.hxx"
 #include "Batch_JobInfo.hxx"
index 4f0d305ce6cc6699be632a204d6d649fc1ad1640..51447b231feb5a3c0c969f7c7686df150fabc880 100644 (file)
@@ -46,6 +46,7 @@
 #include <libgen.h>
 #endif
 
+#include "Batch_Constants.hxx"
 #include "Batch_BatchManager_eSGE.hxx"
 #include "Batch_JobInfo_eSGE.hxx"
 
index bf5097339e14db5accb9981c77777f39b4a2df5a..57c4fdc6063c7cc10c3fb823292524c566c1cfc9 100644 (file)
@@ -33,6 +33,8 @@
 #include <iostream>
 #include <fstream>
 #include <sstream>
+
+#include "Batch_Constants.hxx"
 #include "Batch_Parametre.hxx"
 #include "Batch_Environnement.hxx"
 #include "Batch_RunTimeException.hxx"
index 2d184afd59e57a45f4ed64b4fbdcd82352182ceb..5b05539d18c680b7f7701d70e5002e703cb687d8 100644 (file)
@@ -41,6 +41,7 @@
 #include <libgen.h>
 #endif
 
+#include "Batch_Constants.hxx"
 #include "Batch_BatchManager_eSSH.hxx"
 #include "Batch_JobInfo_eSSH.hxx"
 
index 19ab1d07c2424d350aa9ceabb6c358c7f5999848..97d0cb8d0b3a63bd03464bcfd50c32b05900f7e0 100644 (file)
@@ -30,6 +30,8 @@
 #include <iostream>
 #include <fstream>
 #include <sstream>
+
+#include "Batch_Constants.hxx"
 #include "Batch_Parametre.hxx"
 #include "Batch_Environnement.hxx"
 #include "Batch_RunTimeException.hxx"