From 98e1405bf97744b260ed3703a84e2bdbd1752901 Mon Sep 17 00:00:00 2001 From: dutka Date: Thu, 10 Feb 2005 15:39:37 +0000 Subject: [PATCH] IDM : Batch sur CCRT --- configure.in.base | 12 ++++++++++ src/Batch/Batch_BatchManager.hxx | 3 ++- src/Batch/Batch_BatchManagerCatalog.cxx | 8 +++---- src/Batch/Batch_BoolType.cxx | 1 + src/Batch/Batch_CharType.cxx | 1 + src/Batch/Batch_CoupleType.cxx | 1 + src/Batch/Batch_Date.cxx | 12 ++++++---- src/Batch/Batch_DateType.cxx | 1 + src/Batch/Batch_GenericType.cxx | 1 + src/Batch/Batch_IntType.cxx | 1 + src/Batch/Batch_JobId.cxx | 1 + src/Batch/Batch_Job_LSF.cxx | 8 +++---- src/Batch/Batch_LongType.cxx | 1 + src/Batch/Batch_Parametre.cxx | 23 ++++++++++++++---- src/Batch/Batch_Parametre.hxx | 32 +++++++++++++++---------- src/Batch/Batch_StringType.cxx | 1 + src/Batch/Batch_Versatile.cxx | 1 + src/Makefile.in | 2 +- 18 files changed, 80 insertions(+), 30 deletions(-) diff --git a/configure.in.base b/configure.in.base index a382869d9..687d5d093 100644 --- a/configure.in.base +++ b/configure.in.base @@ -202,6 +202,18 @@ lsf_ok=no CHECK_LSF dnl lsf_ok is set to yes by CHECK_LSF +dnl +dnl --------------------------------------------- +dnl testing Batch +dnl --------------------------------------------- +dnl + +WITH_BATCH=no +test x$openpbs_ok = xyes || test x$lsf_ok = xyes && WITH_BATCH=yes +AC_SUBST(WITH_BATCH) + + + echo echo --------------------------------------------- echo testing LEX \& YACC diff --git a/src/Batch/Batch_BatchManager.hxx b/src/Batch/Batch_BatchManager.hxx index 60d80e376..8cac3447c 100644 --- a/src/Batch/Batch_BatchManager.hxx +++ b/src/Batch/Batch_BatchManager.hxx @@ -49,7 +49,8 @@ namespace Batch { protected: std::string _hostname; // serveur ou tourne le BatchManager - std::map< const std::string, const Batch::JobId * > jobid_map; // table des jobs deja soumis + // std::map< const std::string, const Batch::JobId * > jobid_map; // table des jobs deja soumis + std::map< std::string, const Batch::JobId * > jobid_map; // table des jobs deja soumis const Batch::FactBatchManager * _parent; private: diff --git a/src/Batch/Batch_BatchManagerCatalog.cxx b/src/Batch/Batch_BatchManagerCatalog.cxx index 6485411bc..76a017f21 100644 --- a/src/Batch/Batch_BatchManagerCatalog.cxx +++ b/src/Batch/Batch_BatchManagerCatalog.cxx @@ -17,7 +17,7 @@ using namespace std; namespace Batch { pthread_mutex_t BatchManagerCatalog::_mutex = PTHREAD_MUTEX_INITIALIZER; - map * BatchManagerCatalog::_p_catalog = 0; + std::map * BatchManagerCatalog::_p_catalog = 0; // Constructeur BatchManagerCatalog::BatchManagerCatalog() @@ -42,7 +42,7 @@ namespace Batch { if (pFBM) { // *** section critique *** pthread_mutex_lock(&_mutex); - if (! BatchManagerCatalog::_p_catalog) BatchManagerCatalog::_p_catalog = new map; + if (! BatchManagerCatalog::_p_catalog) BatchManagerCatalog::_p_catalog = new std::map; (*BatchManagerCatalog::_p_catalog)[type] = pFBM; pthread_mutex_unlock(&_mutex); @@ -54,7 +54,7 @@ namespace Batch { return BatchManagerCatalog::getFactBatchManager(type); } - map * BatchManagerCatalog::dict() const + std::map * BatchManagerCatalog::dict() const { return _p_catalog; } @@ -64,7 +64,7 @@ namespace Batch { ostringstream oss; oss << "::const_iterator it = (*_p_catalog).begin(); it != (*_p_catalog).end(); it++, sep=", ") { + for(std::map::const_iterator it = (*_p_catalog).begin(); it != (*_p_catalog).end(); it++, sep=", ") { oss << sep << "'" << (*it).first << "' : '" << (*it).second->__repr__() << "'"; } oss << "}>"; diff --git a/src/Batch/Batch_BoolType.cxx b/src/Batch/Batch_BoolType.cxx index 6e28f197b..7a1c8b9e6 100644 --- a/src/Batch/Batch_BoolType.cxx +++ b/src/Batch/Batch_BoolType.cxx @@ -8,6 +8,7 @@ */ #include +#include #include "Batch_BoolType.hxx" using namespace std; diff --git a/src/Batch/Batch_CharType.cxx b/src/Batch/Batch_CharType.cxx index 52f64146d..da4cb9aed 100644 --- a/src/Batch/Batch_CharType.cxx +++ b/src/Batch/Batch_CharType.cxx @@ -8,6 +8,7 @@ */ #include +#include #include "Batch_CharType.hxx" using namespace std; diff --git a/src/Batch/Batch_CoupleType.cxx b/src/Batch/Batch_CoupleType.cxx index 2cf112a26..ae2ca4be0 100644 --- a/src/Batch/Batch_CoupleType.cxx +++ b/src/Batch/Batch_CoupleType.cxx @@ -8,6 +8,7 @@ * */ +#include #include "Batch_CoupleType.hxx" using namespace std; diff --git a/src/Batch/Batch_Date.cxx b/src/Batch/Batch_Date.cxx index 9c48d233d..da0a22194 100644 --- a/src/Batch/Batch_Date.cxx +++ b/src/Batch/Batch_Date.cxx @@ -17,7 +17,8 @@ namespace Batch { Date::Date(const long l) { - struct tm * p_tm = localtime(&l); + time_t l_t = l; + struct tm * p_tm = localtime(&l_t); _day = p_tm->tm_mday; _month = p_tm->tm_mon + 1; _year = p_tm->tm_year + 1900; @@ -30,7 +31,8 @@ namespace Batch { { if ((s == "now") || (s == "Now") || (s == "NOW")) { long l = time(0); - struct tm * p_tm = localtime(&l); + time_t l_t = l; + struct tm * p_tm = localtime(&l_t); _day = p_tm->tm_mday; _month = p_tm->tm_mon + 1; _year = p_tm->tm_year + 1900; @@ -53,7 +55,8 @@ namespace Batch { Date & Date::operator =(long l) { - struct tm * p_tm = localtime(&l); + time_t l_t = l; + struct tm * p_tm = localtime(&l_t); _day = p_tm->tm_mday; _month = p_tm->tm_mon + 1; _year = p_tm->tm_year + 1900; @@ -92,7 +95,8 @@ namespace Batch { { if ((s == "now") || (s == "Now") || (s == "NOW")) { long l = time(0); - struct tm * p_tm = localtime(&l); + time_t l_t = l; + struct tm * p_tm = localtime(&l_t); _day = p_tm->tm_mday; _month = p_tm->tm_mon + 1; _year = p_tm->tm_year + 1900; diff --git a/src/Batch/Batch_DateType.cxx b/src/Batch/Batch_DateType.cxx index 4e08dd2a5..90819ae6e 100644 --- a/src/Batch/Batch_DateType.cxx +++ b/src/Batch/Batch_DateType.cxx @@ -10,6 +10,7 @@ extern "C" { #include } +#include #include "Batch_DateType.hxx" using namespace std; diff --git a/src/Batch/Batch_GenericType.cxx b/src/Batch/Batch_GenericType.cxx index dc00c838f..8b8ae01ac 100644 --- a/src/Batch/Batch_GenericType.cxx +++ b/src/Batch/Batch_GenericType.cxx @@ -10,6 +10,7 @@ #include #include +#include #include "Batch_GenericType.hxx" using namespace std; diff --git a/src/Batch/Batch_IntType.cxx b/src/Batch/Batch_IntType.cxx index a9aa692ff..2a642b3bb 100644 --- a/src/Batch/Batch_IntType.cxx +++ b/src/Batch/Batch_IntType.cxx @@ -9,6 +9,7 @@ #include #include +#include //#include "MEDMEM_STRING.hxx" #include "Batch_IntType.hxx" using namespace std; diff --git a/src/Batch/Batch_JobId.cxx b/src/Batch/Batch_JobId.cxx index 370fe4476..2c977cce8 100644 --- a/src/Batch/Batch_JobId.cxx +++ b/src/Batch/Batch_JobId.cxx @@ -10,6 +10,7 @@ #include "Batch_JobId.hxx" #include "Batch_BatchManager.hxx" #include +#include //#include "MEDMEM_STRING.hxx" using namespace std; diff --git a/src/Batch/Batch_Job_LSF.cxx b/src/Batch/Batch_Job_LSF.cxx index 91466145c..4d7a76141 100644 --- a/src/Batch/Batch_Job_LSF.cxx +++ b/src/Batch/Batch_Job_LSF.cxx @@ -146,8 +146,8 @@ namespace Batch { } else { struct xFile xf; - strncpy(xf.subFn, local.c_str(), MAXFILENAMELEN); xf.subFn[MAXFILENAMELEN] = 0; - strncpy(xf.execFn, remote.c_str(), MAXFILENAMELEN); xf.execFn[MAXFILENAMELEN] = 0; + strncpy(xf.subFn, local.c_str(), MAXFILENAMELEN - 1); xf.subFn[MAXFILENAMELEN - 1] = 0; + strncpy(xf.execFn, remote.c_str(), MAXFILENAMELEN - 1); xf.execFn[MAXFILENAMELEN - 1] = 0; xf.options = XF_OP_SUB2EXEC; xf_tab.push_back(xf); } @@ -200,8 +200,8 @@ namespace Batch { } else { struct xFile xf; - strncpy(xf.subFn, local.c_str(), MAXFILENAMELEN); xf.subFn[MAXFILENAMELEN] = 0; - strncpy(xf.execFn, remote.c_str(), MAXFILENAMELEN); xf.execFn[MAXFILENAMELEN] = 0; + strncpy(xf.subFn, local.c_str(), MAXFILENAMELEN - 1); xf.subFn[MAXFILENAMELEN - 1] = 0; + strncpy(xf.execFn, remote.c_str(), MAXFILENAMELEN - 1); xf.execFn[MAXFILENAMELEN - 1] = 0; xf.options = XF_OP_EXEC2SUB; xf_tab.push_back(xf); } diff --git a/src/Batch/Batch_LongType.cxx b/src/Batch/Batch_LongType.cxx index 6a7c10038..9e7dd3ac0 100644 --- a/src/Batch/Batch_LongType.cxx +++ b/src/Batch/Batch_LongType.cxx @@ -9,6 +9,7 @@ #include #include +#include //#include "MEDMEM_STRING.hxx" #include "Batch_LongType.hxx" using namespace std; diff --git a/src/Batch/Batch_Parametre.cxx b/src/Batch/Batch_Parametre.cxx index 47547061f..84a0b122c 100644 --- a/src/Batch/Batch_Parametre.cxx +++ b/src/Batch/Batch_Parametre.cxx @@ -11,20 +11,22 @@ #include "Batch_Versatile.hxx" #include "Batch_InvalidKeyException.hxx" #include "Batch_Parametre.hxx" -using namespace std; // Definition des membres constants statiques // Definition des noms globaux pour les clefs en tant que references // TODO : supprimer les declarations statiques des clefs de la map def_static_MapKey(ACCOUNT); +def_static_MapKey(ARGUMENTS); def_static_MapKey(CHECKPOINT); def_static_MapKey(CKPTINTERVAL); def_static_MapKey(CREATIONTIME); def_static_MapKey(EGROUP); def_static_MapKey(ELIGIBLETIME); +def_static_MapKey(ENDTIME); def_static_MapKey(EUSER); def_static_MapKey(EXECUTABLE); def_static_MapKey(EXECUTIONHOST); +def_static_MapKey(EXITCODE); def_static_MapKey(HOLD); def_static_MapKey(ID); def_static_MapKey(INFILE); @@ -35,12 +37,13 @@ def_static_MapKey(MAXRAMSIZE); def_static_MapKey(MAXWALLTIME); def_static_MapKey(MODIFICATIONTIME); def_static_MapKey(NAME); +def_static_MapKey(NBPROC); def_static_MapKey(OUTFILE); def_static_MapKey(PID); def_static_MapKey(QUEUE); def_static_MapKey(QUEUEDTIME); def_static_MapKey(SERVER); -def_static_MapKey(STARTDATE); +def_static_MapKey(STARTTIME); def_static_MapKey(STATE); def_static_MapKey(TEXT); def_static_MapKey(TMPDIR); @@ -62,6 +65,9 @@ namespace Batch { TypeMap[ACCOUNT].type = STRING; TypeMap[ACCOUNT].maxelem = 1; + TypeMap[ARGUMENTS].type = STRING; + TypeMap[ARGUMENTS].maxelem = 0; + TypeMap[CHECKPOINT].type = LONG; TypeMap[CHECKPOINT].maxelem = 1; @@ -77,6 +83,9 @@ namespace Batch { TypeMap[ELIGIBLETIME].type = LONG; TypeMap[ELIGIBLETIME].maxelem = 1; + TypeMap[ENDTIME].type = LONG; + TypeMap[ENDTIME].maxelem = 1; + TypeMap[EUSER].type = STRING; TypeMap[EUSER].maxelem = 1; @@ -86,6 +95,9 @@ namespace Batch { TypeMap[EXECUTIONHOST].type = STRING; TypeMap[EXECUTIONHOST].maxelem = 0; + TypeMap[EXITCODE].type = LONG; + TypeMap[EXITCODE].maxelem = 1; + TypeMap[HOLD].type = LONG; TypeMap[HOLD].maxelem = 1; @@ -116,6 +128,9 @@ namespace Batch { TypeMap[NAME].type = STRING; TypeMap[NAME].maxelem = 1; + TypeMap[NBPROC].type = LONG; + TypeMap[NBPROC].maxelem = 1; + TypeMap[OUTFILE].type = COUPLE; TypeMap[OUTFILE].maxelem = 0; @@ -131,8 +146,8 @@ namespace Batch { TypeMap[SERVER].type = STRING; TypeMap[SERVER].maxelem = 1; - TypeMap[STARTDATE].type = LONG; - TypeMap[STARTDATE].maxelem = 1; + TypeMap[STARTTIME].type = LONG; + TypeMap[STARTTIME].maxelem = 1; TypeMap[STATE].type = STRING; TypeMap[STATE].maxelem = 1; diff --git a/src/Batch/Batch_Parametre.hxx b/src/Batch/Batch_Parametre.hxx index e4ed4d889..ae031342f 100644 --- a/src/Batch/Batch_Parametre.hxx +++ b/src/Batch/Batch_Parametre.hxx @@ -22,38 +22,41 @@ // TODO : d'une descrption dans un fichier exterieur (genre XML) #define def_extern_MapKey(mk) extern const std::string & mk; -#define def_static_MapKey(mk) const std::string Batch::Parametre::mk(#mk); \ - const std::string & mk = Batch::Parametre::mk; +#define def_static_MapKey(mk) const std::string Batch::Parametre::mk(#mk); \ + const std::string & mk = Batch::Parametre::mk; namespace Batch { class Parametre : public std::map< std::string, Versatile > { public: - // Constructeur standard + // Constructeur standard Parametre(); - // Constructeur par recopie - Parametre::Parametre(const Parametre & PM); + // Constructeur par recopie + Parametre(const Batch::Parametre & PM); - // Operateur de recherche dans la map + // Operateur de recherche dans la map Versatile & operator [] (const std::string &); const Versatile & operator [] (const std::string &) const; - // Operateur d'affectation - Parametre & operator =(const Parametre & PM); + // Operateur d'affectation + Parametre & operator =(const Batch::Parametre & PM); - // Declarations statique des clefs de la map - // TODO : supprimer les declarations statiques des clefs de la map + // Declarations statique des clefs de la map + // TODO : supprimer les declarations statiques des clefs de la map static const std::string ACCOUNT; + static const std::string ARGUMENTS; static const std::string CHECKPOINT; static const std::string CKPTINTERVAL; static const std::string CREATIONTIME; static const std::string EGROUP; static const std::string ELIGIBLETIME; + static const std::string ENDTIME; static const std::string EUSER; static const std::string EXECUTABLE; static const std::string EXECUTIONHOST; + static const std::string EXITCODE; static const std::string HOLD; static const std::string ID; static const std::string INFILE; @@ -64,12 +67,13 @@ namespace Batch { static const std::string MAXWALLTIME; static const std::string MODIFICATIONTIME; static const std::string NAME; + static const std::string NBPROC; static const std::string OUTFILE; static const std::string PID; static const std::string QUEUE; static const std::string QUEUEDTIME; static const std::string SERVER; - static const std::string STARTDATE; + static const std::string STARTTIME; static const std::string STATE; static const std::string TEXT; static const std::string TMPDIR; @@ -89,14 +93,17 @@ namespace Batch { } def_extern_MapKey(ACCOUNT); +def_extern_MapKey(ARGUMENTS); def_extern_MapKey(CHECKPOINT); def_extern_MapKey(CKPTINTERVAL); def_extern_MapKey(CREATIONTIME); def_extern_MapKey(EGROUP); def_extern_MapKey(ELIGIBLETIME); +def_extern_MapKey(ENDTIME); def_extern_MapKey(EUSER); def_extern_MapKey(EXECUTABLE); def_extern_MapKey(EXECUTIONHOST); +def_extern_MapKey(EXITCODE); def_extern_MapKey(HOLD); def_extern_MapKey(ID); def_extern_MapKey(INFILE); @@ -107,12 +114,13 @@ def_extern_MapKey(MAXRAMSIZE); def_extern_MapKey(MAXWALLTIME); def_extern_MapKey(MODIFICATIONTIME); def_extern_MapKey(NAME); +def_extern_MapKey(NBPROC); def_extern_MapKey(OUTFILE); def_extern_MapKey(PID); def_extern_MapKey(QUEUE); def_extern_MapKey(QUEUEDTIME); def_extern_MapKey(SERVER); -def_extern_MapKey(STARTDATE); +def_extern_MapKey(STARTTIME); def_extern_MapKey(STATE); def_extern_MapKey(TEXT); def_extern_MapKey(TMPDIR); diff --git a/src/Batch/Batch_StringType.cxx b/src/Batch/Batch_StringType.cxx index fa01f0331..98c9e8447 100644 --- a/src/Batch/Batch_StringType.cxx +++ b/src/Batch/Batch_StringType.cxx @@ -8,6 +8,7 @@ */ #include +#include #include "Batch_StringType.hxx" using namespace std; diff --git a/src/Batch/Batch_Versatile.cxx b/src/Batch/Batch_Versatile.cxx index 8ed9d9a3e..efc505a15 100644 --- a/src/Batch/Batch_Versatile.cxx +++ b/src/Batch/Batch_Versatile.cxx @@ -11,6 +11,7 @@ #include #include #include +#include //#include "MEDMEM_STRING.hxx" #include "Batch_GenericType.hxx" #include "Batch_IntType.hxx" diff --git a/src/Makefile.in b/src/Makefile.in index 91f81257e..c64ecb109 100644 --- a/src/Makefile.in +++ b/src/Makefile.in @@ -60,7 +60,7 @@ ifeq (@mpi_ok@,yes) SUBDIRS+= MPIContainer MPILifeCycleCORBA TestMPIContainer endif -ifeq (@WITHOPENPBS@,yes) +ifeq (@WITH_BATCH@,yes) SUBDIRS += Batch Batch_SWIG endif -- 2.39.2