From 3dec672cc4995a022d5fce9c3053bcd4f9bcd4ce Mon Sep 17 00:00:00 2001 From: barate Date: Wed, 23 Sep 2009 09:25:25 +0000 Subject: [PATCH] Removed Batch from KERNEL and added libBatch dependency. --- configure.ac | 77 +- doc/salome/Batch.texi | 4962 ----------------- doc/salome/batch.dox | 10 - doc/salome/gui/Makefile.am | 7 +- doc/salome/gui/doxyfile.in | 2 +- doc/salome/main.dox | 1 - salome_adm/unix/SALOMEconfig.ref.in | 35 - salome_adm/unix/config_files/Makefile.am | 4 +- .../unix/config_files/check_libbatch.m4 | 115 + salome_adm/unix/config_files/check_local.m4 | 90 - salome_adm/unix/config_files/check_lsf.m4 | 105 - salome_adm/unix/config_files/check_openpbs.m4 | 88 - .../Batch_APIInternalFailureException.cxx | 37 - .../Batch_APIInternalFailureException.hxx | 51 - src/Batch/Batch_BatchManager.cxx | 149 - src/Batch/Batch_BatchManager.hxx | 85 - src/Batch/Batch_BatchManagerCatalog.cxx | 101 - src/Batch/Batch_BatchManagerCatalog.hxx | 70 - src/Batch/Batch_BatchManager_LSF.cxx | 194 - src/Batch/Batch_BatchManager_LSF.hxx | 97 - src/Batch/Batch_BatchManager_Local.cxx | 828 --- src/Batch/Batch_BatchManager_Local.hxx | 174 - src/Batch/Batch_BatchManager_Local_RSH.cxx | 151 - src/Batch/Batch_BatchManager_Local_RSH.hxx | 82 - src/Batch/Batch_BatchManager_Local_SH.cxx | 118 - src/Batch/Batch_BatchManager_Local_SH.hxx | 82 - src/Batch/Batch_BatchManager_Local_SSH.cxx | 152 - src/Batch/Batch_BatchManager_Local_SSH.hxx | 82 - src/Batch/Batch_BatchManager_PBS.cxx | 216 - src/Batch/Batch_BatchManager_PBS.hxx | 98 - src/Batch/Batch_BatchManager_eClient.cxx | 252 - src/Batch/Batch_BatchManager_eClient.hxx | 77 - src/Batch/Batch_BatchManager_eLSF.cxx | 362 -- src/Batch/Batch_BatchManager_eLSF.hxx | 96 - src/Batch/Batch_BatchManager_ePBS.cxx | 341 -- src/Batch/Batch_BatchManager_ePBS.hxx | 95 - src/Batch/Batch_BatchManager_eSGE.cxx | 343 -- src/Batch/Batch_BatchManager_eSGE.hxx | 95 - src/Batch/Batch_BoolType.cxx | 66 - src/Batch/Batch_BoolType.hxx | 69 - src/Batch/Batch_CharType.cxx | 66 - src/Batch/Batch_CharType.hxx | 70 - src/Batch/Batch_ConnexionFailureException.cxx | 37 - src/Batch/Batch_ConnexionFailureException.hxx | 53 - src/Batch/Batch_Couple.cxx | 63 - src/Batch/Batch_Couple.hxx | 74 - src/Batch/Batch_CoupleType.cxx | 73 - src/Batch/Batch_CoupleType.hxx | 72 - src/Batch/Batch_Date.cxx | 195 - src/Batch/Batch_Date.hxx | 67 - src/Batch/Batch_DateType.cxx | 74 - src/Batch/Batch_DateType.hxx | 74 - src/Batch/Batch_Defines.hxx | 42 - src/Batch/Batch_Environnement.cxx | 38 - src/Batch/Batch_Environnement.hxx | 48 - src/Batch/Batch_FactBatchManager.cxx | 68 - src/Batch/Batch_FactBatchManager.hxx | 63 - src/Batch/Batch_FactBatchManager_LSF.cxx | 60 - src/Batch/Batch_FactBatchManager_LSF.hxx | 57 - src/Batch/Batch_FactBatchManager_Local.cxx | 60 - src/Batch/Batch_FactBatchManager_Local.hxx | 57 - .../Batch_FactBatchManager_Local_RSH.cxx | 58 - .../Batch_FactBatchManager_Local_RSH.hxx | 57 - src/Batch/Batch_FactBatchManager_Local_SH.cxx | 60 - src/Batch/Batch_FactBatchManager_Local_SH.hxx | 57 - .../Batch_FactBatchManager_Local_SSH.cxx | 60 - .../Batch_FactBatchManager_Local_SSH.hxx | 57 - src/Batch/Batch_FactBatchManager_PBS.cxx | 58 - src/Batch/Batch_FactBatchManager_PBS.hxx | 57 - src/Batch/Batch_FactBatchManager_eClient.cxx | 50 - src/Batch/Batch_FactBatchManager_eClient.hxx | 60 - src/Batch/Batch_FactBatchManager_eLSF.cxx | 63 - src/Batch/Batch_FactBatchManager_eLSF.hxx | 63 - src/Batch/Batch_FactBatchManager_ePBS.cxx | 64 - src/Batch/Batch_FactBatchManager_ePBS.hxx | 63 - src/Batch/Batch_FactBatchManager_eSGE.cxx | 66 - src/Batch/Batch_FactBatchManager_eSGE.hxx | 61 - src/Batch/Batch_GenericException.cxx | 37 - src/Batch/Batch_GenericException.hxx | 54 - src/Batch/Batch_GenericType.cxx | 65 - src/Batch/Batch_GenericType.hxx | 72 - src/Batch/Batch_IOMutex.cxx | 38 - src/Batch/Batch_IOMutex.hxx | 47 - src/Batch/Batch_IntType.cxx | 72 - src/Batch/Batch_IntType.hxx | 69 - src/Batch/Batch_InvalidArgumentException.cxx | 37 - src/Batch/Batch_InvalidArgumentException.hxx | 53 - src/Batch/Batch_InvalidKeyException.cxx | 38 - src/Batch/Batch_InvalidKeyException.hxx | 58 - src/Batch/Batch_Job.cxx | 117 - src/Batch/Batch_Job.hxx | 78 - src/Batch/Batch_JobId.cxx | 137 - src/Batch/Batch_JobId.hxx | 91 - src/Batch/Batch_JobInfo.cxx | 96 - src/Batch/Batch_JobInfo.hxx | 79 - src/Batch/Batch_JobInfo_LSF.cxx | 204 - src/Batch/Batch_JobInfo_LSF.hxx | 76 - src/Batch/Batch_JobInfo_Local.cxx | 54 - src/Batch/Batch_JobInfo_Local.hxx | 60 - src/Batch/Batch_JobInfo_PBS.cxx | 198 - src/Batch/Batch_JobInfo_PBS.hxx | 72 - src/Batch/Batch_JobInfo_eLSF.cxx | 107 - src/Batch/Batch_JobInfo_eLSF.hxx | 72 - src/Batch/Batch_JobInfo_ePBS.cxx | 118 - src/Batch/Batch_JobInfo_ePBS.hxx | 71 - src/Batch/Batch_JobInfo_eSGE.cxx | 113 - src/Batch/Batch_JobInfo_eSGE.hxx | 72 - src/Batch/Batch_Job_LSF.cxx | 264 - src/Batch/Batch_Job_LSF.hxx | 65 - src/Batch/Batch_Job_Local.cxx | 106 - src/Batch/Batch_Job_Local.hxx | 71 - src/Batch/Batch_Job_PBS.cxx | 472 -- src/Batch/Batch_Job_PBS.hxx | 96 - src/Batch/Batch_ListIsFullException.cxx | 37 - src/Batch/Batch_ListIsFullException.hxx | 50 - src/Batch/Batch_LongType.cxx | 71 - src/Batch/Batch_LongType.hxx | 69 - src/Batch/Batch_MapKey.cxx | 42 - src/Batch/Batch_MapKey.hxx | 69 - .../Batch_NotYetImplementedException.cxx | 37 - .../Batch_NotYetImplementedException.hxx | 52 - src/Batch/Batch_Parametre.cxx | 295 - src/Batch/Batch_Parametre.hxx | 159 - src/Batch/Batch_PyVersatile.cxx | 202 - src/Batch/Batch_PyVersatile.hxx | 69 - src/Batch/Batch_RunTimeException.cxx | 37 - src/Batch/Batch_RunTimeException.hxx | 51 - src/Batch/Batch_StringType.cxx | 66 - src/Batch/Batch_StringType.hxx | 67 - src/Batch/Batch_TypeMismatchException.cxx | 36 - src/Batch/Batch_TypeMismatchException.hxx | 51 - src/Batch/Batch_Versatile.cxx | 323 -- src/Batch/Batch_Versatile.hxx | 123 - src/Batch/Makefile.am | 219 - src/Batch/MpiImpl.cxx | 277 - src/Batch/MpiImpl.hxx | 170 - src/Batch_SWIG/Batch_test.py | 74 - src/Batch_SWIG/Makefile.am | 91 - src/Batch_SWIG/libBatch_Swig.i | 84 - src/Batch_SWIG/libBatch_Swig_exception.i | 45 - src/Batch_SWIG/libBatch_Swig_typemap.i | 247 - src/Container/Makefile.am | 2 - src/Container/SALOME_ContainerManager.cxx | 1 - src/Launcher/BatchTest.cxx | 4 +- src/Launcher/Launcher.cxx | 26 +- src/Launcher/Makefile.am | 9 +- src/Makefile.am | 11 +- 147 files changed, 155 insertions(+), 18964 deletions(-) delete mode 100755 doc/salome/Batch.texi delete mode 100644 doc/salome/batch.dox create mode 100644 salome_adm/unix/config_files/check_libbatch.m4 delete mode 100755 salome_adm/unix/config_files/check_local.m4 delete mode 100755 salome_adm/unix/config_files/check_lsf.m4 delete mode 100644 salome_adm/unix/config_files/check_openpbs.m4 delete mode 100644 src/Batch/Batch_APIInternalFailureException.cxx delete mode 100644 src/Batch/Batch_APIInternalFailureException.hxx delete mode 100644 src/Batch/Batch_BatchManager.cxx delete mode 100644 src/Batch/Batch_BatchManager.hxx delete mode 100644 src/Batch/Batch_BatchManagerCatalog.cxx delete mode 100644 src/Batch/Batch_BatchManagerCatalog.hxx delete mode 100644 src/Batch/Batch_BatchManager_LSF.cxx delete mode 100644 src/Batch/Batch_BatchManager_LSF.hxx delete mode 100644 src/Batch/Batch_BatchManager_Local.cxx delete mode 100644 src/Batch/Batch_BatchManager_Local.hxx delete mode 100644 src/Batch/Batch_BatchManager_Local_RSH.cxx delete mode 100644 src/Batch/Batch_BatchManager_Local_RSH.hxx delete mode 100644 src/Batch/Batch_BatchManager_Local_SH.cxx delete mode 100644 src/Batch/Batch_BatchManager_Local_SH.hxx delete mode 100644 src/Batch/Batch_BatchManager_Local_SSH.cxx delete mode 100644 src/Batch/Batch_BatchManager_Local_SSH.hxx delete mode 100644 src/Batch/Batch_BatchManager_PBS.cxx delete mode 100644 src/Batch/Batch_BatchManager_PBS.hxx delete mode 100644 src/Batch/Batch_BatchManager_eClient.cxx delete mode 100644 src/Batch/Batch_BatchManager_eClient.hxx delete mode 100644 src/Batch/Batch_BatchManager_eLSF.cxx delete mode 100644 src/Batch/Batch_BatchManager_eLSF.hxx delete mode 100644 src/Batch/Batch_BatchManager_ePBS.cxx delete mode 100644 src/Batch/Batch_BatchManager_ePBS.hxx delete mode 100644 src/Batch/Batch_BatchManager_eSGE.cxx delete mode 100644 src/Batch/Batch_BatchManager_eSGE.hxx delete mode 100644 src/Batch/Batch_BoolType.cxx delete mode 100644 src/Batch/Batch_BoolType.hxx delete mode 100644 src/Batch/Batch_CharType.cxx delete mode 100644 src/Batch/Batch_CharType.hxx delete mode 100644 src/Batch/Batch_ConnexionFailureException.cxx delete mode 100644 src/Batch/Batch_ConnexionFailureException.hxx delete mode 100644 src/Batch/Batch_Couple.cxx delete mode 100644 src/Batch/Batch_Couple.hxx delete mode 100644 src/Batch/Batch_CoupleType.cxx delete mode 100644 src/Batch/Batch_CoupleType.hxx delete mode 100644 src/Batch/Batch_Date.cxx delete mode 100644 src/Batch/Batch_Date.hxx delete mode 100644 src/Batch/Batch_DateType.cxx delete mode 100644 src/Batch/Batch_DateType.hxx delete mode 100755 src/Batch/Batch_Defines.hxx delete mode 100644 src/Batch/Batch_Environnement.cxx delete mode 100644 src/Batch/Batch_Environnement.hxx delete mode 100644 src/Batch/Batch_FactBatchManager.cxx delete mode 100644 src/Batch/Batch_FactBatchManager.hxx delete mode 100644 src/Batch/Batch_FactBatchManager_LSF.cxx delete mode 100644 src/Batch/Batch_FactBatchManager_LSF.hxx delete mode 100644 src/Batch/Batch_FactBatchManager_Local.cxx delete mode 100644 src/Batch/Batch_FactBatchManager_Local.hxx delete mode 100644 src/Batch/Batch_FactBatchManager_Local_RSH.cxx delete mode 100644 src/Batch/Batch_FactBatchManager_Local_RSH.hxx delete mode 100644 src/Batch/Batch_FactBatchManager_Local_SH.cxx delete mode 100644 src/Batch/Batch_FactBatchManager_Local_SH.hxx delete mode 100644 src/Batch/Batch_FactBatchManager_Local_SSH.cxx delete mode 100644 src/Batch/Batch_FactBatchManager_Local_SSH.hxx delete mode 100644 src/Batch/Batch_FactBatchManager_PBS.cxx delete mode 100644 src/Batch/Batch_FactBatchManager_PBS.hxx delete mode 100644 src/Batch/Batch_FactBatchManager_eClient.cxx delete mode 100644 src/Batch/Batch_FactBatchManager_eClient.hxx delete mode 100644 src/Batch/Batch_FactBatchManager_eLSF.cxx delete mode 100644 src/Batch/Batch_FactBatchManager_eLSF.hxx delete mode 100644 src/Batch/Batch_FactBatchManager_ePBS.cxx delete mode 100644 src/Batch/Batch_FactBatchManager_ePBS.hxx delete mode 100644 src/Batch/Batch_FactBatchManager_eSGE.cxx delete mode 100644 src/Batch/Batch_FactBatchManager_eSGE.hxx delete mode 100644 src/Batch/Batch_GenericException.cxx delete mode 100644 src/Batch/Batch_GenericException.hxx delete mode 100644 src/Batch/Batch_GenericType.cxx delete mode 100644 src/Batch/Batch_GenericType.hxx delete mode 100644 src/Batch/Batch_IOMutex.cxx delete mode 100644 src/Batch/Batch_IOMutex.hxx delete mode 100644 src/Batch/Batch_IntType.cxx delete mode 100644 src/Batch/Batch_IntType.hxx delete mode 100644 src/Batch/Batch_InvalidArgumentException.cxx delete mode 100644 src/Batch/Batch_InvalidArgumentException.hxx delete mode 100644 src/Batch/Batch_InvalidKeyException.cxx delete mode 100644 src/Batch/Batch_InvalidKeyException.hxx delete mode 100644 src/Batch/Batch_Job.cxx delete mode 100644 src/Batch/Batch_Job.hxx delete mode 100644 src/Batch/Batch_JobId.cxx delete mode 100644 src/Batch/Batch_JobId.hxx delete mode 100644 src/Batch/Batch_JobInfo.cxx delete mode 100644 src/Batch/Batch_JobInfo.hxx delete mode 100644 src/Batch/Batch_JobInfo_LSF.cxx delete mode 100644 src/Batch/Batch_JobInfo_LSF.hxx delete mode 100644 src/Batch/Batch_JobInfo_Local.cxx delete mode 100644 src/Batch/Batch_JobInfo_Local.hxx delete mode 100644 src/Batch/Batch_JobInfo_PBS.cxx delete mode 100644 src/Batch/Batch_JobInfo_PBS.hxx delete mode 100644 src/Batch/Batch_JobInfo_eLSF.cxx delete mode 100644 src/Batch/Batch_JobInfo_eLSF.hxx delete mode 100644 src/Batch/Batch_JobInfo_ePBS.cxx delete mode 100644 src/Batch/Batch_JobInfo_ePBS.hxx delete mode 100644 src/Batch/Batch_JobInfo_eSGE.cxx delete mode 100644 src/Batch/Batch_JobInfo_eSGE.hxx delete mode 100644 src/Batch/Batch_Job_LSF.cxx delete mode 100644 src/Batch/Batch_Job_LSF.hxx delete mode 100644 src/Batch/Batch_Job_Local.cxx delete mode 100644 src/Batch/Batch_Job_Local.hxx delete mode 100644 src/Batch/Batch_Job_PBS.cxx delete mode 100644 src/Batch/Batch_Job_PBS.hxx delete mode 100644 src/Batch/Batch_ListIsFullException.cxx delete mode 100644 src/Batch/Batch_ListIsFullException.hxx delete mode 100644 src/Batch/Batch_LongType.cxx delete mode 100644 src/Batch/Batch_LongType.hxx delete mode 100644 src/Batch/Batch_MapKey.cxx delete mode 100644 src/Batch/Batch_MapKey.hxx delete mode 100644 src/Batch/Batch_NotYetImplementedException.cxx delete mode 100644 src/Batch/Batch_NotYetImplementedException.hxx delete mode 100644 src/Batch/Batch_Parametre.cxx delete mode 100644 src/Batch/Batch_Parametre.hxx delete mode 100644 src/Batch/Batch_PyVersatile.cxx delete mode 100644 src/Batch/Batch_PyVersatile.hxx delete mode 100644 src/Batch/Batch_RunTimeException.cxx delete mode 100644 src/Batch/Batch_RunTimeException.hxx delete mode 100644 src/Batch/Batch_StringType.cxx delete mode 100644 src/Batch/Batch_StringType.hxx delete mode 100644 src/Batch/Batch_TypeMismatchException.cxx delete mode 100644 src/Batch/Batch_TypeMismatchException.hxx delete mode 100644 src/Batch/Batch_Versatile.cxx delete mode 100644 src/Batch/Batch_Versatile.hxx delete mode 100644 src/Batch/Makefile.am delete mode 100644 src/Batch/MpiImpl.cxx delete mode 100644 src/Batch/MpiImpl.hxx delete mode 100644 src/Batch_SWIG/Batch_test.py delete mode 100644 src/Batch_SWIG/Makefile.am delete mode 100644 src/Batch_SWIG/libBatch_Swig.i delete mode 100644 src/Batch_SWIG/libBatch_Swig_exception.i delete mode 100644 src/Batch_SWIG/libBatch_Swig_typemap.i diff --git a/configure.ac b/configure.ac index ec63ffb86..b46a9257e 100644 --- a/configure.ac +++ b/configure.ac @@ -86,9 +86,9 @@ AC_ARG_ENABLE(corba_gen, esac],[corba_gen=true]) AM_CONDITIONAL(CORBA_GEN, test x$corba_gen = xtrue) -# ---- option to build only launcher, resources manager and batch classes +# ---- option to build only launcher and resources manager AC_ARG_WITH(onlylauncher, - [AC_HELP_STRING([--with-onlylauncher],[Build only launcher, resources manager and batch classes [default=no]])], + [AC_HELP_STRING([--with-onlylauncher],[Build only launcher and resources manager [default=no]])], [], [with_onlylauncher="no"]) AM_CONDITIONAL(WITHONLYLAUNCHER, test x$with_onlylauncher = xyes) @@ -154,6 +154,7 @@ echo cc_ok=no AC_PROG_CC AC_PROG_CXX +AC_LANG(C++) AC_CXX_WARNINGS AC_CXX_TEMPLATE_OPTIONS AC_DEPEND_FLAG @@ -220,6 +221,14 @@ echo CHECK_LIBXML +echo +echo --------------------------------------------- +echo Testing libBatch +echo --------------------------------------------- +echo + +CHECK_LIBBATCH + if test x$with_onlylauncher = xno; then echo echo --------------------------------------------- @@ -349,53 +358,6 @@ echo testing optionnal products echo ============================================================ echo -echo -echo --------------------------------------------- -echo Testing Batch -echo --------------------------------------------- -echo - -dnl Several batch systems (OpenPBS, LSF, ...) can be operated using -dnl the Batch classes library integrated in the KERNEL module. The -dnl checking process tests here the presence of underlying batch -dnl softwares. If none is detected, the KERNEL is declared to be -dnl "without batch". - -echo testing OpenPBS -echo --------------- -openpbs_ok=no -CHECK_OPENPBS -dnl openpbs_ok is set to yes by CHECK_OPENPBS - -echo testing LSF -echo ----------- -lsf_ok=no -CHECK_LSF -dnl lsf_ok is set to yes by CHECK_LSF -echo lsf = $lsf_ok - -echo testing Local batch system -echo -------------------------- -localbatch_ok=no -CHECK_LOCAL -dnl localbatch_ok is set to yes by CHECK_LOCAL - -WITH_BATCH=no -test x$openpbs_ok = xyes || test x$lsf_ok = xyes || test x$localbatch_ok = xyes && WITH_BATCH=yes - -AC_ARG_ENABLE(batch, - [AC_HELP_STRING([--enable-batch],[Batch [default=yes]])], - [case "${enableval}" in - yes) test x$openpbs_ok = xyes || test x$lsf_ok = xyes || test x$localbatch_ok = xyes && WITH_BATCH=yes;; - no) WITH_BATCH=no ;; - *) AC_MSG_ERROR(bad value ${enableval} for --enable-batch) ;; - esac],[test x$openpbs_ok = xyes || test x$lsf_ok = xyes || test x$localbatch_ok = xyes && WITH_BATCH=yes]) - -echo Batch mode = $WITH_BATCH - -AC_SUBST(WITH_BATCH) -AM_CONDITIONAL(WITH_BATCH, [test x"$WITH_BATCH" = xyes]) - echo echo ---------------------------------------------- echo testing CPPUNIT only required for unit testing @@ -458,12 +420,12 @@ function check_fatal_error { if test x$with_onlylauncher = xno; then if test x$corba_gen = xtrue; then - basic_mandatory_products="cc_ok threads_ok python_ok swig_ok hdf5_ok libxml_ok" + basic_mandatory_products="cc_ok threads_ok python_ok swig_ok hdf5_ok libxml_ok libbatch_ok" else - basic_mandatory_products="cc_ok threads_ok hdf5_ok libxml_ok" + basic_mandatory_products="cc_ok threads_ok hdf5_ok libxml_ok libbatch_ok" fi else - basic_mandatory_products="cc_ok threads_ok libxml_ok" + basic_mandatory_products="cc_ok threads_ok libxml_ok libbatch_ok" fi echo --- General mandatory products - Light configuration: @@ -479,13 +441,6 @@ if test x$with_onlylauncher = xno; then check_fatal_error $corba_mandatory_products else echo --- CORBA products not required - option --disable-corba-gen - if test x"$WITH_BATCH" = xyes; then - echo --- BATCH mode mandatory products - default configuration: - summary "python_ok" - check_fatal_error "python_ok" - else - echo --- Python not required - option --enable-batch=no - fi fi fi echo @@ -495,7 +450,7 @@ echo --- Kernel parallel extensions: summary $parallel_products echo -optional_products="cppunit_ok openpbs_ok lsf_ok numpy_ok" +optional_products="cppunit_ok numpy_ok" echo --- Optional products: echo [" These products are optional because the KERNEL functions"] echo [" using them are built only if the products are detected."] @@ -565,8 +520,6 @@ AC_OUTPUT([ \ src/Makefile \ src/Basics/Makefile \ src/Basics/Test/Makefile \ - src/Batch/Makefile \ - src/Batch_SWIG/Makefile \ src/Communication/Makefile \ src/Communication_SWIG/Makefile \ src/Container/Makefile \ diff --git a/doc/salome/Batch.texi b/doc/salome/Batch.texi deleted file mode 100755 index 817e5b996..000000000 --- a/doc/salome/Batch.texi +++ /dev/null @@ -1,4962 +0,0 @@ -\input texinfo @c -*-texinfo-*- -@c %**start of header -@setfilename Batch.info -@settitle Documentation de Batch -@setchapternewpage odd -@iftex -@afourpaper -@end iftex - -@include version.texi - -@dircategory Bibliotheque de classes Batch -@direntry -* Batch: (Batch); Documentation de la bibliotheque de classes Batch. -@end direntry - -@c %**end of header - - - -@titlepage -@sp 10 -@comment The title is printed in a large font. -@title Bibliotheque de classes Batch -@subtitle Documentation - version @value{VERSION} -@subtitle @value{UPDATED} -@author Ivan DUTKA-MALEN - EDF R&D - -@c The following two commands start the copyright page. -@page -@vskip 0pt plus 1filll -Copyright @copyright{} 2003-2004 EDF R&D sous licence GPL -@end titlepage - -@contents - - -@c ---------------------- -@c ---------------------- -@c ---------------------- - -@node Top, Description, Index , (dir) -@comment node-name, next, previous, up -@ifinfo -Copyright @copyright{} 2003-2004 EDF R&D sous licence GPL -@end ifinfo - -@unnumbered Introduction - -Ceci est la documentation de la bibliotheque de classes Batch version -@value{VERSION}. - -Ce manuel est normalement disponible sous la forme de fichiers -@file{.info}, PostScript @file{.ps}, PDF @file{.pdf} et HTML -@file{.html}. Merci a Texinfo. - - -@menu -* Description:: Le batch, c'est quoi ? Ca sert a quoi ? -* Classes:: Une description des classes internes. -* Utilisation:: Comment on s'en sert ? Quelques exemples. -* Installation de la bibliotheque:: Comment ca s'installe ? -* Divers:: D'autres petits details. -* Index:: Index generaux. -@end menu - - - - - - - - -@c ---------------------- -@c ---------------------- -@c ---------------------- - -@node Description, Classes, Top, Top -@comment node-name, next, previous, up -@chapter Description Generale -@cindex description - -Dans le domaine du batch, nombreux sont les gestionnaires qui sont -apparus et se sont popularises en fonction des plates-formes et des -constructeurs. On peut notamment citer NQS, le premier de tous, LSF, -LoadLeveler, PBS (et ses derives OpenPBS et PBS Pro), etc. qui se -prevalent tous d'une compatibilite avec NQS. - -Si l'ensemble de ces produits offrent les fonctionnalites de base de -NQS, a savoir soumission, controle, destruction, modification, etc. de -travaux batch, ils se distinguent tous par leur incompatibilite mutuelle -et par les syntaxes de fichiers et les appels de fonction specifiques -qu'ils ont developpes. - -Or il est interessant de pouvoir acceder d'une facon homogene et -generique aux fonctionnalites de ces gestionnaires quitte a se -restreindre a un sous-ensemble minimal mais essentiel de leurs -possibilites. - -La bibliotheque de classes Batch fournit ce moyen de soumettre et -controler des travaux batch depuis une machine cliente sans s'occuper du -type de gestionnaire present sur le serveur sur lequel se deroule -l'execution du travail. Seul doit etre precise le nom du serveur sur -lequel sera soumis le travail batch et le type de gestionnaire qui s'y -trouve. Tout le reste est generique et ne depend plus de l'implementation. - - - - - - - -@c ---------------------- -@c ---------------------- -@c ---------------------- - -@node Classes, Terminologie, Description, Top -@comment node-name, next, previous, up -@chapter Classes Internes -@cindex classe - -Les classes de la bibliotheque reposent sur des concepts issus du monde -de la gestion de batch, qui meritent d'etre reprecises pour ne pas -introduire d'ambiguite semantique dans le discours. - -@menu -* Terminologie:: Description des termes employes. -* Classes generiques:: Les classes communes a tous les gestionnaires. -* Classes specifiques:: Les classes d'implementation. -@end menu - - - - -@c ---------------------- -@c ---------------------- -@c ---------------------- - -@node Terminologie, Batch, Classes, Classes -@comment node-name, next, previous, up -@section Terminologie -@cindex terminologie - -Pour les non-inities aux mysteres de la gestion de batch, un petit -glossaire des termes employes dans cette documentation, assaisonne a la -sauce de la bibliotheque de classes Batch. - -@menu -* Batch:: Gestion par lots, execution differee. -* BatchManager:: Gestionnaire de batch. -* Job:: Travail. -* Parametre:: Configuration de l'execution. -* Environnement:: Environnement d'execution. -* JobId:: Identifiant de travail. -* JobInfo:: Informations sur le travail. -@end menu - - -@c ---------------------- -@c ---------------------- -@c ---------------------- - -@node Batch, BatchManager, Terminologie, Terminologie -@comment node-name, next, previous, up -@subsection Batch -@cindex batch - -Le traitement batch (batch processing en anglais), ou traitement par -lot, fait reference au mode de sequencage et d'utilisation des -ressources d'un calculateur tel qu'il a ete premierement employe dans -les debuts de l'ere informatique. Mais il faut preciser que cette -anteriorite ne condamne pas le traitement batch aux oubliettes au motif -d'une quelconque obsolescence. Si le traitement par lot a vu le jour et -existe encore aujourd'hui, c'est parce qu'il repond de maniere -satisfaisante a une certaine utilisation des ressources d'un -calculateur, et que cette utilisation est encore d'actualite. Present -depuis plus de quarante ans, le batch est encore largement utilise sur -les grands serveurs, et le sera vraisemblablement pour quelques annees -encore. - -Le traitement par lot se distingue de l'execution interactive par le -fait que les travaux a effectuer sont places dans une file d'attente -avec une indication pour chaque lot des ressources dont il doit disposer -pour aboutir correctement. Une fois les travaux inscrits dans la file, -c'est au systeme de traitement batch (@xref{BatchManager}.) de veiller a -leur bonne execution en leur fournissant les ressources demandees. Tout -travail qui ne disposerait pas des ressources adequates ne peut pas etre -active. - - -@c ---------------------- -@c ---------------------- -@c ---------------------- - -@node BatchManager, Job, Batch, Terminologie -@comment node-name, next, previous, up -@subsection Batch Manager -@cindex batch manager -@cindex gestionnaire - -Le role du gestionnaire de batch, ou batch manager en anglais, est -d'executer et eventuellement d'ordonner les travaux places en file -d'attente en leur allouant exclusivement les ressources necessaires a -leur execution. Son objectif est d'optimiser les ressources du systeme -dont il a la charge de maniere a ecouler le maximum de travaux en un -minimum de temps et un minimum de ressources materielles. - -@c ---------------------- -@c ---------------------- -@c ---------------------- - -@node Job, Parametre, BatchManager, Terminologie -@comment node-name, next, previous, up -@subsection Job -@cindex Job -@cindex travail - -Le travail, ou job en anglais, est l'unite elementaire de traitement qui -peut etre soumis au gestionnaire de batch. Il peut s'agir d'une simple -commande systeme, comme d'une application ou bien meme de l'enchainement -complexe mais indivisible de plusieurs applications ou commandes. - -Pour s'executer correctement, c'est-a-dire sans erreur, le job doit -disposer de certaines ressources --- de la memoire, du temps, de -l'espace disque @dots{} --- pendant toute la duree de son -execution. C'est au gestionnaire de batch (@xref{BatchManager}.) de -garantir au job la presence et la persistence de ces ressources pendant -l'execution du job. - -Par contre c'est a l'utilisateur qui soumet le job d'informer le -gestionnaire de batch des ressources necessaires au job. Pour des -raisons evidentes de bonne gestion des ressources, le job ne peut -consommer plus de ressources que celles qu'il a demande et obtenu du -gestionnaire de batch sans etre arrete ou reclasse. - -@c ---------------------- -@c ---------------------- -@c ---------------------- - -@node Parametre, Environnement, Job, Terminologie -@comment node-name, next, previous, up -@subsection Parametre -@cindex parametre - -Le premier type de ressource necessaire a un job concerne les elements -materiels ou temporels, en un mot, physiques. Parmi ces ressources, on -trouve le temps de calcul, le temps de presence en machine, l'espace -disque, la quantite de memoire vive, l'architecture du calculateur, etc. - -Dans la terminologie de la bibliotheque de classes Batch, tous ces -elements ont ete regroupes sous le terme de @emph{Parametre}. - -@c ---------------------- -@c ---------------------- -@c ---------------------- - -@node Environnement, JobId, Parametre, Terminologie -@comment node-name, next, previous, up -@subsection Environnement -@cindex environnement - -Le second type de ressource necessaire a un job concerne les elements -logiciels. Cela se traduit le plus souvent, et particulierement, dans -les systemes Unix par la notion de variable d'environnement. Lorsque le -job s'execute, il doit pouvoir trouver l'ensemble des commandes et des -applications auquel il souhaite faire appel. Les variables -d'environnement decrivent donc les localisations des ces -programmes. Elles peuvent egalement contenir des informations influant -sur le comportement des programmes. - -Dans la terminologie de la bibliotheque de classes Batch, tous ces -elements on ete regroupes sous le terme de @emph{Environnement}. - -@c ---------------------- -@c ---------------------- -@c ---------------------- - -@node JobId, JobInfo, Environnement, Terminologie -@comment node-name, next, previous, up -@subsection JobId -@cindex jobid -@cindex identifier - -Si un job (@xref{Job}.) decrit les actions qui doivent etre effectues -par le systeme sous le controle du gestionnaire de batch, il est clair -qu'il est possible de soumettre plusieurs fois de suite le meme job, et -par la-meme d'executer plusieurs fois (et parfois simultanement) ces -memes actions. On a donc plusieurs instances du meme job qui sont -presentes en machine. Chaque instance peut etre distinguee des autres -par un identifiant unique qui lui est propre : c'est le @emph{jobId}. - -Le JobId est determine par le gestionnaire de batch au moment de la -soumission. - -@c ---------------------- -@c ---------------------- -@c ---------------------- - -@node JobInfo, Classes generiques, JobId, Terminologie -@comment node-name, next, previous, up -@subsection JobInfo -@cindex jobinfo - - -Des qu'un job (@xref{Job}.) est soumis donc des qu'il dispose d'un -JobId (@xref{JobId}.), il est possible d'interroger le gestionnaire de -batch pour etre informe de son comportement, de son evolution au sein du -systeme pendant son execution. - -On peut ainsi connaitre les parametres reellement consommes par rapport -aux parametres alloues, ainsi que l'environnement d'execution du job. - -Le JobInfo est une structure qui collecte ses informations sur l'etat du -job. - - - - - -@c ---------------------- -@c ---------------------- -@c ---------------------- - -@node Classes generiques, Namespace, JobInfo, Classes -@comment node-name, next, previous, up -@section Classes generiques -@cindex classes generiques - -Schematiquement, les classes composant la bibliotheque sont regroupees -en trois categories. Celles appartenant au groupe @emph{Types de base} -ne servent que de support au fonctionnement des classes de plus haut -niveau, egalement appellees @emph{Classes utilisateur}. Seules ces -dernieres sont vraiment interessantes pour l'utilisateur de la -bibliotheque. Les exceptions sont regroupees dans une categorie qui leur -est propre. - -@menu -* Namespace:: Espace de noms pour la bibliotheque. -* Types de base:: Les classes elementaires. -* Classes utilisateur:: Les classes de haut-niveau. -* Exceptions:: Les exceptions de la bibliotheque. -@end menu - -@c ---------------------- -@c ---------------------- -@c ---------------------- - -@node Namespace, Types de base, Classes generiques, Classes generiques -@comment node-name, next, previous, up -@subsection Namespace -@cindex namespace - -Toutes les classes de la bibliotheque sont regroupees dans un unique -namespace nomme @emph{Batch} afin de ne pas introduire de conflit avec -d'autres classes de meme nom. - -Ainsi lorsque par exemple on cite la classe @emph{BatchManager}, il -faudra declarer un objet @emph{Batch::BatchManager} ou bien faire appel -au namespace @emph{Batch} en C++. En Python, les objets sont regroupes -dans un module nomme @emph{libBatch_Swig}. - - -@c ---------------------- -@c ---------------------- -@c ---------------------- - -@node Types de base, Classe Couple, Namespace, Classes generiques -@comment node-name, next, previous, up -@subsection Types de base -@cindex types de base - -Les classes decrites ici sont toutes utilisees ou utilisables par les -classes utilisateur de la bibliotheque, et en particulier par la classe -Versatile. @xref{Classe Versatile}. - -Ces classes implementent sous forme d'objet les types de base du langage -C++. Ainsi la classe @emph{Booltype} implemente le type de base -@emph{bool}. Certains types de base n'existant pas dans le langage ont -ete crees et encapsules dans une classe : c'est le cas notamment du type -de base @emph{Date} et de la classe @emph{DateType}, et du type de base -@emph{Couple} et de la classe @emph{CoupleType}. - -Tous les classes heritent de la classe generique @emph{GenericType}. - -@menu --- Types de base -- - -* Classe Couple:: Association de fichiers. -* Classe Date:: Type elementaire de date. - --- Classes d'implementation des types de base -- - -* Classe GenericType:: Classe-mere de tous les types. -* Classe BoolType:: Encapsulation du type bool. -* Classe CharType:: Encapsulation du type char. -* Classe CoupleType:: Encapsulation du type Couple. -* Classe DateType:: Encapsulation du type Date. -* Classe IntType:: Encapsulation du type int. -* Classe LongType:: Encapsulation du type long. -* Classe StringType:: Encapsulation du type string. - -@end menu - -@c ---------------------- -@c ---------------------- -@c ---------------------- - -@node Classe Couple, Classe Date, Types de base, Types de base -@comment node-name, next, previous, up -@page -@subsubsection Couple -@findex Couple - -La classe @emph{Couple} implemente le comportement d'un couple de deux -chaines de type @emph{string} qui sont respectivement nommees -@emph{local} et @emph{remote}. - -Cette classe est utilisee essentiellement pour la designation des -fichiers a transferer lors des soumissions de travaux, d'ou les noms -employes. - -@cartouche -Il faut toutefois faire attention a designer correctement ce qui est -local ou distant. Ainsi dans la bibliotheque de classes Batch, on a -adopte la convention qu'un fichier dit @emph{local} est celui present -sur la machine qui execute la bibliotheque de classes Batch, alors qu'un -fichier dit @emph{remote} (ou distant) est celui present sur le serveur -du gestionnaire de batch. -L'approche est donc clairement orientee utilisateur plutot que serveur. -@end cartouche - -@itemize @bullet{} -@item Entete - -@example -class Couple -@{ - public: - // Constructeur standard - Couple(const string & local, const string & remote); - - // Constructeur par recopie - Couple(const Couple & C); - - // Operateur pour l'affichage sur un stream - friend ostream & operator << (ostream & os, const Couple & cp); - - // Operateur d'affectation - virtual Couple & operator =(const Couple &); - - // Conversion en chaine - virtual string str() const; - - // Accesseurs - virtual string getLocal() const; - virtual string getRemote() const; - - protected: - string _local; // chemin d'acces au fichier local - string _remote; // chemin d'acees au fichier distant - - private: - -@}; -@end example -@end itemize - - -@c ---------------------- -@c ---------------------- -@c ---------------------- - -@node Classe Date, Classe GenericType, Classe Couple, Types de base -@comment node-name, next, previous, up -@page -@subsubsection Date -@findex Date - -La classe @emph{Date} sert a stocker n'importe quelle information de -temps et peut la representer sous une forme plus lisible a l'utilisateur -que le traditionnel appel a la fonction @emph{ctime}. @xref{(*manpages*)ctime}. - -@itemize @bullet{} -@item Entete - -@example -class Date -@{ - public: - // Constructeur standard (a partir d'une valeur epoch) - Date(const long l=0); - - // Constructeur a partir d'une chaine hh:mm:ss - Date(const string s); - - // Operateurs portant sur les Dates - virtual Date & operator =(long l); - virtual Date & operator +(long l); - virtual Date & operator -(long l); - virtual Date & operator +=(long l); - virtual Date & operator -=(long l); - virtual Date & operator =(const string & s); - - // Conversions en types standards - virtual string str() const; - virtual long epoch() const; - - protected: - int _day, _month, _year; - int _hour, _min, _sec; - - private: - -@}; -@end example -@end itemize - - - -@c ---------------------- -@c ---------------------- -@c ---------------------- - -@node Classe GenericType, Classe BoolType, Classe Date, Types de base -@comment node-name, next, previous, up -@page -@subsubsection GenericType -@findex GenericType - -La classe @emph{GenericType} est la classe-mere de toutes les classes -utilisees par la classe @emph{Versatile}. @xref{Classe Versatile}. - -Elle definit une interface que @emph{Versatile} utilise pour controler -les objets : constructeur simple et destructeur, operateur sur -@emph{ostream}, conversion en chaine et surtout methode @emph{clone}. - -La methode @emph{clone} permet de recuperer un nouvel objet identique au -premier qui sera automatiquement alloue sur le tas par un appel a -@emph{new}. Il est important de noter ici que le nouvel objet @strong{DEVRA} -etre desalloue par un appel a @emph{delete}. Cette desallocation est a -la charge de l'utilisateur de l'objet sans quoi une fuite memoire en -resultera. - -@itemize @bullet{} -@item Entete - -@example -class GenericType -@{ - public: - // Constructeur et destructeur - GenericType(); - virtual ~GenericType(); - - // Operateur pour l'affichage sur un stream - friend ostream & operator << (ostream & os, - const GenericType & obj); - - // Conversion en chaine - virtual string affiche() const; - - // Clone duplique l'objet et en fabrique un nouveau a l'aide de new - // qu'il faudra detruire ensuite manuellement - virtual GenericType * clone() const; - - // Retourne le nombre d'objets GenericType et al. - static int getNb(); - - protected: - - private: - static int _nb; // nombre total d'objets GenericType et al. - -@}; -@end example -@end itemize - - -@c ---------------------- -@c ---------------------- -@c ---------------------- - -@node Classe BoolType, Classe CharType, Classe GenericType, Types de base -@comment node-name, next, previous, up -@page -@subsubsection BoolType -@findex BoolType - -Cette classe encapsule le type C++ @emph{bool} dans un objet herite de -@emph{GenericType} de maniere a pouvoir le stocker aisement dans un -objet de classe @emph{Versatile}. - -@itemize @bullet{} -@item Entete - -@example -class BoolType : public GenericType -@{ - public: - // Constructeur - BoolType(const bool b=false); - - // Conversion en chaine - virtual string affiche() const; - - // Operateur d'affectation - virtual BoolType & operator =(bool); - - // Conversion en bool - virtual operator bool() const; - - // Clone duplique l'objet et en fabrique un nouveau a l'aide de new - // qu'il faudra detruire ensuite manuellement - virtual GenericType * clone() const; - - protected: - bool _data; - - private: - -@}; -@end example -@end itemize - - -@c ---------------------- -@c ---------------------- -@c ---------------------- - -@node Classe CharType, Classe CoupleType, Classe BoolType, Types de base -@comment node-name, next, previous, up -@page -@subsubsection CharType -@findex CharType - -Cette classe encapsule le type C++ @emph{char} dans un objet herite de -@emph{GenericType} de maniere a pouvoir le stocker aisement dans un -objet de classe @emph{Versatile}. - - -@itemize @bullet{} -@item Entete - -@example -class CharType : public GenericType -@{ - public: - // Constructeur - CharType(const char c=0); - - // Conversion en chaine - virtual string affiche() const; - - // Operateur d'affectation - virtual CharType & operator =(char); - - // Conversion en char - virtual operator char() const; - - // Clone duplique l'objet et en fabrique un nouveau a l'aide de new - // qu'il faudra detruire ensuite manuellement - virtual GenericType * clone() const; - - protected: - char _data; - - private: - -@}; -@end example -@end itemize - - -@c ---------------------- -@c ---------------------- -@c ---------------------- - -@node Classe CoupleType, Classe DateType, Classe CharType, Types de base -@comment node-name, next, previous, up -@page -@subsubsection CoupleType -@findex CoupleType - -Cette classe encapsule le type interne @emph{Couple} dans un objet herite de -@emph{GenericType} de maniere a pouvoir le stocker aisement dans un -objet de classe @emph{Versatile}. - - -@itemize @bullet{} -@item Entete - -@example -class CoupleType : public GenericType -@{ - public: - // Constructeur - CoupleType(const Couple & C); - - // Conversion en chaine - virtual string affiche() const; - virtual operator string() const; - - // Operateur d'affectation - virtual CoupleType & operator =(const Couple & C); - - // Conversion en char - virtual operator Couple() const; - - // Clone duplique l'objet et en fabrique un nouveau a l'aide de new - // qu'il faudra detruire ensuite manuellement - virtual GenericType * clone() const; - - protected: - Couple _data; - - private: - -@}; -@end example -@end itemize - - -@c ---------------------- -@c ---------------------- -@c ---------------------- - -@node Classe DateType, Classe IntType, Classe CoupleType, Types de base -@comment node-name, next, previous, up -@page -@subsubsection DateType -@findex DateType - -Cette classe encapsule le type interne @emph{Date} dans un objet herite de -@emph{GenericType} de maniere a pouvoir le stocker aisement dans un -objet de classe @emph{Versatile}. - - -@itemize @bullet{} -@item Entete - -@example -class DateType : public GenericType -@{ - public: - // Constructeur - DateType(const Date & d); - - // Conversion en chaine - virtual string affiche() const; - - // Operateur d'affectation - virtual DateType & operator =(const Date &); - - // Conversion en Date - virtual operator Date() const; - - // Conversion en long - virtual operator long() const; - - // Clone duplique l'objet et en fabrique un nouveau a l'aide de new - // qu'il faudra detruire ensuite manuellement - virtual GenericType * clone() const; - - protected: - Date _data; - - private: -@}; -@end example -@end itemize - - -@c ---------------------- -@c ---------------------- -@c ---------------------- - -@node Classe IntType, Classe LongType, Classe DateType, Types de base -@comment node-name, next, previous, up -@page -@subsubsection IntType -@findex IntType - -Cette classe encapsule le type C++ @emph{int} dans un objet herite de -@emph{GenericType} de maniere a pouvoir le stocker aisement dans un -objet de classe @emph{Versatile}. - - -@itemize @bullet{} -@item Entete - -@example -class IntType : public GenericType -@{ - public: - // Constructeur - IntType(const int i=0); - - // Conversion en chaine - virtual string affiche() const; - - // Operateur d'affectation - virtual IntType & operator =(int); - - // Conversion en int - virtual operator int() const; - - // Clone duplique l'objet et en fabrique un nouveau a l'aide de new - // qu'il faudra detruire ensuite manuellement - virtual GenericType * clone() const; - - protected: - int _data; - - private: - -@}; -@end example -@end itemize - - -@c ---------------------- -@c ---------------------- -@c ---------------------- - -@node Classe LongType, Classe StringType, Classe IntType, Types de base -@comment node-name, next, previous, up -@page -@subsubsection LongType -@findex LongType - -Cette classe encapsule le type C++ @emph{long} dans un objet herite de -@emph{GenericType} de maniere a pouvoir le stocker aisement dans un -objet de classe @emph{Versatile}. - -@itemize @bullet{} -@item Entete - -@example -class LongType : public GenericType -@{ - public: - // Constructeur - LongType(const long l=0L); - - // Conversion en chaine - virtual string affiche() const; - - // Operateur d'affectation - virtual LongType & operator =(long); - - // Conversion en long - virtual operator long() const; - - // Clone duplique l'objet et en fabrique un nouveau a l'aide de new - // qu'il faudra detruire ensuite manuellement - virtual GenericType * clone() const; - - protected: - long _data; - - private: - -@}; -@end example -@end itemize - - -@c ---------------------- -@c ---------------------- -@c ---------------------- - -@node Classe StringType, Classes utilisateur, Classe LongType, Types de base -@comment node-name, next, previous, up -@page -@subsubsection StringType -@findex StringType - -Cette classe encapsule le type C++ @emph{string} de la STL dans un objet -herite de @emph{GenericType} de maniere a pouvoir le stocker aisement -dans un objet de classe @emph{Versatile}. - -@itemize @bullet{} -@item Entete - -@example -class StringType : public GenericType -@{ - public: - // Constructeur - StringType(const string & s=""); - - // Conversion en chaine - virtual string affiche() const; - virtual operator string() const; - - // Operateur d'affectation - virtual StringType & operator =(string); - - // Clone duplique l'objet et en fabrique un nouveau a l'aide de new - // qu'il faudra detruire ensuite manuellement - virtual GenericType * clone() const; - - protected: - string _data; - - private: - -@}; -@end example -@end itemize - - - - -@c ---------------------- -@c ---------------------- -@c ---------------------- - -@node Classes utilisateur, Exemple, Classe StringType, Classes generiques -@comment node-name, next, previous, up -@page -@subsection Classes utilisateur -@cindex classes utilisateur - -Les classes dites classes utilisateur sont en realite les classes de -plus haut niveau de la biliotheque de classes Batch. Ces classes -remplissent les unes avec les autres l'ensemble des fonctionnalites -proposees par la bibliotheque. L'utilisateur trouvera donc dans cette -section la description des possibilites de la bibliotheque et le moyen -de les mettre en oeuvre. - -La premiere section montre un exemple complet de soumission et de -controle d'un job soumis a travers les classes de la biliotheque. Les -sections suivantes reprennent les elements de l'exemple pour le -detailler et le completer. - -@menu -* Exemple:: Exemple simple mais complet d'utilisation. -* Classe BatchManagerCatalog:: Description de la classe BatchManagerCatalog. -* Classe FactBatchManager:: Description de la classe FactBatchManager. -* Classe BatchManager:: Description de la classe BatchManager. -* Classe Environnement:: Description de la classe Environnement. -* Classe Job:: Description de la classe Job. -* Classe JobId:: Description de la classe JobId. -* Classe JobInfo:: Description de la classe JobInfo. -* Classe Parametre:: Description de la classe Parametre. -* Classe Versatile:: Description de la classe Versatile. -@end menu - - -@c ---------------------- -@c ---------------------- -@c ---------------------- - -@node Exemple, Classe BatchManagerCatalog, Classes utilisateur, Classes utilisateur -@comment node-name, next, previous, up -@page -@subsubsection Exemple -@cindex exemple - -Cet exemple decrit le processus type de creation et de soumission d'un -job a travers les classes de la bibliotheque. - -Il faut toutefois penser que les appels aux methodes peuvent lever des -exceptions qu'il faudra intercepter et gerer. @xref{Exceptions}. - -@example - @dots{} - - // On instancie le catalogue de gestionnaires de batch - Batch::BatchManagerCatalog cata; - - // On cree un BatchManager qui se connecte au veritable gestionnaire - // de batch - Batch::BatchManager & bm = (* cata("PBS"))("monserver.mondomaine.fr"); - - // Pour fabriquer un Job, on doit d'abord creer un objet Parametre et - // un objet Environnement qui contiennent respectivement la liste des - // parametres du job au sein du gestionnaire de batch et la liste des - // variables d'environnement necessaires au fonctionnement du job - Batch::Parametre param; - - param[EXECUTABLE] = "/home/user/mon_application/executable"; - param[NAME] = "MonJob"; - param[ACCOUNT] = "MonProjet"; // code d'imputation/facturation - param[MAXCPUTIME] = 360L; // 6min - param[MAXWALLTIME] = 480L; // 8min - param[INFILE] = Batch::Couple("/tmp/infich1", rempath+"/infich1"); - param[OUTFILE] = Batch::Couple("/tmp/outfich1", rempath+"/outfich1"); - param[OUTFILE] += Batch::Couple("stderr", path + "/STDERR"); - param[OUTFILE] += Batch::Couple("stdout", path + "/STDOUT"); - param[MAIL] = "user@@domaine.fr"; - param[USER] = "user"; - - Batch::Environnement env; - env["DEBUG"] = "3"; // un niveau de debug exige par l'application - env["MYAPP_FILE"] = "/home/user/mon_application/data/mydatafile"; - - // Creation du job - Batch::Job job(param, env); - - // On soumet le Job au BatchManager qui le relaie jusqu'au veritable - // gestionnaire de batch sur le serveur. En retour on obtient un - // identifiant unique de notre job (JobId). - const Batch::JobId jobid = bm.submitJob(job); - - // On interroge le BatchManager pour connaitre l'etat du Job - const Batch::JobInfo jinfo = jobid.queryJob(); - cout << jinfo << endl; - - // On detruit l'objet BatchManager - delete &bm; - - @dots{} -@end example - - -@c ---------------------- -@c ---------------------- -@c ---------------------- - -@node Classe BatchManagerCatalog, Classe FactBatchManager, Exemple, Classes utilisateur -@comment node-name, next, previous, up -@page -@subsubsection BatchManagerCatalog -@findex BatchManagerCatalog - -La classe @emph{BatchManagerCatalog} definit une interface d'acces au -catalogue de fabriques de BatchManager. @xref{Classe FactBatchManager}. - -Pourquoi utiliser une fabrique et ne pas instancier directement un objet -@emph{BatchManager} en fonction de sa classe ? C'est l'option qui avait ete -choisie dans la premiere version de la bibliotheque de classes -Batch. Cette facon de proceder est simple, aussi bien pour le -developpeur de la classe que pour l'utilisateur, mais elle se revele a -terme penalisante dans la souplesse d'utilisation des classes. Elle -permet aussi moins facilement de mettre en place une strategie de -singleton pour les objets @emph{BatchManager}, ce qui peut se reveler utile non -pas en termes de performance mais plutot en termes de genericite et -toujours de souplesse. - -En resume, l'utilisation de fabiques permet d'acceder a la genericite, -qui rappelons-le est l'objet de cette biliotheque, a la souplesse et a -la performance au prix d'une legere complication pour le developpeur -mais pas pour l'utilisateur. - -Le catalogue de fabriques est une @emph{map}, ou tableau associatif, -auquel on passe le nom d'une fabrique et qui retourne un pointeur sur -une instance de cette fabrique. - -Le catalogue est renseigne statiquement par les fabriques declarees -elles-memes statiquement dans la biliotheque. Il est donc precharge avec -les fabriques correspondant a chacune des API disponibles. Comme le -catalogue n'est pas declare constant, il est possible de rajouter ou de -supprimer des fabriques dans le catalogue dynamiquement. - -@itemize @bullet{} -@item Entete - -@example -class BatchManagerCatalog -@{ -public: - // Constructeur - BatchManagerCatalog(); - // Destructeur - virtual ~BatchManagerCatalog(); - - // Accesseurs - static FactBatchManager * getFactBatchManager(const char * type); - static void addFactBatchManager(const char * type, - FactBatchManager * pFBM); - virtual FactBatchManager * operator() (const char * type) const; - - // Wrapping Python - virtual map * dict() const; - virtual string __repr__() const; - -protected: - // Le catalogue est gere en singleton et en multi-thread - static map * _p_catalog; - static pthread_mutex_t _mutex; - -private: - -@}; -@end example - -@item Exemple - -@example -@dots{} - -// On instancie le catalogue de gestionnaires de batch -Batch::BatchManagerCatalog cata; - -@dots{} -@end example - -@item Methodes -@itemize @minus{} -@item -@b{BatchManagerCatalog()} - -Le constructeur par defaut permet d'obtenir une instance de -@emph{BatchManagerCatalog} qui permet de manipuler un objet statique -interne. Cet objet interne est le veritable catalogue et se trouve etre -un singleton. - - -@item -@b{~BatchManagerCatalog()} - -Le destructeur n'a pas d'action particuliere. - -@item -@b{static FactBatchManager * getFactBatchManager(const char * type)} - -Cet accesseur retourne un pointeur sur un objet de type -@emph{FactBatchManager} en fonction du nom (le type) sous lequel il -s'est enregistre dans le catalogue. - -Cette fonction est statique et peut donc etre utilisee pour interroger -le catalogue depuis des objets statiques. - -@item -@b{static void addFactBatchManager(const char * type, FactBatchManager * pFBM)} - -Cet accesseur enregistre dans le catalogue un pointeur sur un objet de type -@emph{FactBatchManager} sous le nom (le type) passe en argument. - -Cette fonction est statique et peut donc etre utilisee pour enregistrer -des objets statiques dans le catalogue. - -@item -@b{FactBatchManager * operator() (const char * type) const} - -Cet accesseur retourne un pointeur sur un objet de type -@emph{FactBatchManager} en fonction du nom (le type) sous lequel il -s'est enregistre dans le catalogue. - -Cette fonction non statique est utilisable sur une instance de -@emph{BatchManagerCatalog}. - -@item -@b{map * dict() const} - -Cette methode utilisable depuis Python permet de recuperer un -dictionnaire decrivant le contenu du catalogue. - -@item -@b{string __repr__() const} - -Cette methode utilisable depuis Python retourne une description de -l'objet @emph{BatchManagerCatalog}. - -@end itemize - - -@end itemize - - -@c ---------------------- -@c ---------------------- -@c ---------------------- - -@node Classe FactBatchManager, Classe BatchManager, Classe BatchManagerCatalog, Classes utilisateur -@comment node-name, next, previous, up -@page -@subsubsection FactBatchManager -@findex FactBatchManager - -La classe @emph{FactBatchManager} est abstraite. Elle definit une interface -qui doit etre implementee par des classes specialisees en fonction du -gestionnaire de batch et de son API de communication. @xref{Classes specifiques}. - -Les objets repondant a l'interface de @emph{FactBatchManager} sont -automatiquement inseres dans le catalogue des fabriques de -@emph{BatchManager} a la construction de l'objet. Il est ainsi possible -de definir statiquement des objets de ce type qui enrichiront le -catalogue des la compilation. @xref{Classe -BatchManagerCatalog}. @xref{Classe BatchManager}. - -Les objets de la classe @emph{FactBatchManager} ou de ses derivees sont -des functors et renvoient au moment de l'appel un pointeur sur un objet -gestionnaire de batch @emph{BatchManager} associe a un -serveur. L'allocation de l'objet est faite sur le tas et celui-ci doit -donc etre desalloue manuellement par l'utilisateur de la bibliotheque au -moment opportun. - -@itemize @bullet{} -@item Entete - -@example -class FactBatchManager -@{ -public: - // Constructeur - FactBatchManager(const string & type); - - // Destructeur - virtual ~FactBatchManager(); - - // Functor - virtual BatchManager * operator() (const char * hostname) const = 0; - - // Accesseur au type interne - string getType() const; - - // Wrapping Python - string __repr__() const; - -protected: - string type; // Le type interne - -private: - -@}; -@end example - -@item Exemple - -@example -@dots{} - -// On instancie le catalogue de gestionnaires de batch -Batch::BatchManagerCatalog cata; - -// On cree une fabrique de BatchManager de type PBS -Batch::FactBatchManager & fbm = * cata("PBS"); - -@dots{} -@end example - -@item Methodes -@itemize @minus{} - -@item -@b{FactBatchManager(const string & type)} - -Le constructeur de la classe prend un type qui doit identifer de maniere -unique la fabrique au sein du catalogue de fabrique. Ce type sert de cle au -catalogue. @xref{Classe BatchManagerCatalog}. - -@item -@b{~FactBatchManager()} - -Le destructeur de la classe n'a pas d'action particuliere. - -@item -@b{BatchManager * operator() (const char * hostname) const} - -Cette methode est virtuelle pure. Elle doit etre surchargee dans les -classes derivees et doit retourner un pointeur sur un objet de type -@emph{BatchManager} correpondant au type de la classe et oeuvrant sur la -machine passee en argument. Le @emph{hostname} est soit alphabetique -soit numerique et doit etre soit un nom de machine valide soit une -adresse IP valide. Aucun controle n'est a priori realise et cet argument -est passe tel quel a l'API du gestionnaire de batch. - -Cet objet agit comme @emph{parent} vis-a-vis de l'objet -@emph{BatchManager} qu'il retourne. - -@item -@b{string getType() const} - -Cette methode renvoie le type interne de l'objet, c'est-a-dire la cle -sous lequel il est enregistre dans le catalogue. - -@item -@b{string __repr__() const} - -Cette methode utilisable depuis Python retourne une description de -l'objet @emph{FactBatchManager}. - -@end itemize - - -@end itemize - - -@c ---------------------- -@c ---------------------- -@c ---------------------- - -@node Classe BatchManager, Classe Environnement, Classe FactBatchManager, Classes utilisateur -@comment node-name, next, previous, up -@page -@subsubsection BatchManager -@findex BatchManager - -La classe @emph{BatchManager} est abstraite. Elle definit une interface -qui doit etre implementee par des classes specialisees en fonction du -gestionnaire de batch et de son API de communication. @xref{Classes -specifiques}. - -Toute action a destination du gestionnaire de batch doit etre precedee -de l'instanciation d'un objet derivant de la classe @emph{BatchManager} -puisque c'est a travers cet objet que l'on aura acces a l'interface du -gestionnaire. - -Cette instanciation est realisee par une fabrique de gestionnaire de -batch, instance elle-meme derivee de la classe abstraite -FactBatchManager. @xref{Classe FactBatchManager}. - -@itemize @bullet{} -@item Entete - -@example -class BatchManager -@{ - public: - // Constructeur et destructeur - BatchManager(const FactBatchManager * parent, - const char * host="localhost") - throw(InvalidArgumentException); - virtual ~BatchManager(); - - // Recupere l'identifiant d'un job deja soumis au BatchManager - virtual const JobId getJobIdByReference(const string & ref); - - // Methodes pour le controle des jobs : virtuelles pures - // soumet un job au gestionnaire - virtual const JobId submitJob(const Job & job) = 0; - - // retire un job du gestionnaire - virtual void deleteJob(const JobId & jobid) = 0; - - // suspend un job en file d'attente - virtual void holdJob(const JobId & jobid) = 0; - - // relache un job suspendu - virtual void releaseJob(const JobId & jobid) = 0; - - // modifie un job en file d'attente - virtual void alterJob(const JobId & jobid, - const Parametre & param, - const Environnement & env) = 0; - virtual void alterJob(const JobId & jobid, - const Parametre & param) = 0; - virtual void alterJob(const JobId & jobid, - const Environnement & env) = 0; - - // renvoie l'etat du job - virtual JobInfo queryJob(const JobId & jobid) = 0; - - // wrapping Python - virtual string __repr__() const; - - protected: - string _hostname; // serveur ou tourne le BatchManager - const FactBatchManager * _parent; // fabrique qui a produit l'instance - - private: - -@}; -@end example - -@item Exemple - -@example -@dots{} - -// On instancie le catalogue de gestionnaires de batch -Batch::BatchManagerCatalog cata; - -// On cree un BatchManager qui se connecte au veritable gestionnaire -// de batch -Batch::BatchManager & bm = (* cata("PBS"))("monserver.mondomaine.fr"); - -// Maintenant, on peut utiliser toutes les fonctionnalites du -// gestionnaire de batch a travers le variable myBM - -// On detruit l'objet BatchManager -delete &bm; - -@dots{} -@end example - -@item Methodes -@itemize @minus{} -@item -@b{BatchManager(const FactBatchManager * parent,$* -const char * host="localhost") throw(InvalidArgumentException)} - -Excepte un pointeur sur la fabrique qui a produit l'objet, @xref{Classe FactBatchManager}, - le constructeur accepte zero ou un argument de type -@emph{string} decrivant soit le nom de domaine completement qualifie -(FQDN, @i{fully qualified domain name}) du serveur de batch, soit son -adresse IP dans un format decimal "aaa.bbb.ccc.ddd". - -Une resolution du nom ou de l'adresse peut etre realisee en fonction des -capacites de la plate-forme pour s'assurer que le serveur est connu et -joignable. En cas d'echec, une exception InvalidArgumentException est -levee. @xref{Classe InvalidArgumentException}. A priori, aucune -verification n'est faite par defaut. - -Ceci fait, une connexion est etablie avec le gestionnaire de batch qui -est maintenue jusqu'a destruction de l'objet, si le gestionnaire le permet. - -@item -@b{~BatchManager()} - -Le destructeur supprime la connexion precedemment etablie par le -constructeur lorsque celle-ci a reussi. - -@item -@b{const JobId submitJob(const Job & job)} - -Cette methode soumet le job passe en argument au gestionnaire de -batch. Etant donne que le job ne peut pas etre envoye tel quel puisqu'il -a un format generique au sein de la bibliotheque de classes Batch, cette -methode est chargee de le convertir dans un format adapte au -gestionnaire de batch sous-jacent. - -Ce n'est que lorsque cette conversion est realisee que le job est soumis -au gestionnaire a travers son API. L'identifiant propose par le -gestionnaire est alors renvoye a l'appelant. Si la soumission echoue -pour une raison ou une autre, une exception APIInternalFailureException est -levee. @xref{Classe APIInternalFailureException}. - -@item -@b{void deleteJob(const JobId & jobid)} - -Cette methode retire le job dont l'identifiant est passe en argument de -la file d'attente du gestionnaire, ou bien l'arrete s'il est en cours -d'execution. Cette methode est inoperante sur des travaux deja termines, -auquel cas une exception APIInternalFailureException est -levee. @xref{Classe APIInternalFailureException}. - - -@item -@b{void holdJob(const JobId & jobid)} - -Cette methode suspend le job dont l'identifiant est passe en argument au -sein de la file d'attente du gestionnaire. Cette methode est inoperante -sur des travaux en cours d'execution ou deja termines, ainsi que sur des -travaux deja suspendus. -En cas de probleme, une exception APIInternalFailureException est -levee. @xref{Classe APIInternalFailureException}. - -@item -@b{void releaseJob(const JobId & jobid)} - -Cette methode relache un job precedemment suspendu en file -d'attente dont l'identifiant est passe en argument. Elle est inoperante -sur des travaux deja relaches, en cours d'execution ou termines. -En cas de probleme, une exception APIInternalFailureException est -levee. @xref{Classe APIInternalFailureException}. - - -@item -@b{void alterJob(const JobId & jobid, const Parametre & param, const Environnement & env)@* -void alterJob(const JobId & jobid, const Parametre & param)@* -void alterJob(const JobId & jobid, const Environnement & env)} - -Ces methodes permettent de modifier les parametres d'execution et -d'environnement d'un job dont l'identifiant est passe en -argument. @xref{Classe Parametre}. @xref{Classe Environnement}. Il -est important de noter que le job doit etre encore place en file -d'attente sinon la methode est inoperante. -En cas de probleme, une exception APIInternalFailureException est -levee. @xref{Classe APIInternalFailureException}. - -@item -@b{JobInfo queryJob(const JobId & jobid)} - -Cette methode permet de recuperer les informations concernant le job -dont l'identifiant est passe en argument dans un objet de classe -@emph{JobInfo}. @xref{Classe JobInfo}. On y retrouve les parametres -d'execution et d'environnement du job tels qu'ils ont ete passes au -gestionnaire au moment de la soumission, ainsi que des informations -concernant l'execution du job comme par exemple la machine d'execution, -le temps consomme, la memoire consommee, etc. - -Il n'est pas toujours possible d'interroger un job deja termine. -En cas de probleme, une exception APIInternalFailureException est -levee. @xref{Classe APIInternalFailureException}. - - -@item -@b{const JobId getJobIdByReference(const string & ref)} - -Cette methode permet de recuperer au sein de la classe un identifiant de -job a partir d'une chaine de caracteres obtenue par un biais -externe. Cet identifiant pourra etre utilise par la suite au sein de la -biliotheque de classes pour controler le job comme s'il avait ete cree -et soumis depuis la biliotheque-meme. - -@end itemize - - -@end itemize - - -@c ---------------------- -@c ---------------------- -@c ---------------------- - -@node Classe Environnement, Classe Job, Classe BatchManager, Classes utilisateur -@comment node-name, next, previous, up -@page -@subsubsection Environnement -@findex Environnement - -La classe @emph{Environnement} permet de definir les variables -d'environnement necessaires a l'execution d'un job. Ces variables seront -creees automatiquement dans l'environnement du job lorsque celui-ci -debutera son execution sur la machine. - -Une variable d'environnement est traditionnellement composee d'un nom et -d'une valeur qui peut etre vide ou absente. L'ensemble des variables -d'environnement peut ainsi etre represente sous la forme d'une table -associative dans laquelle le nom de la variable correspond a la clef de la -table, et la valeur de la variable correspond a la valeur de la table -pour la clef donnee. - -Chaque objet de la classe @emph{Environnement} se comporte comme une -table associative telle que decrite auparavant. - -@itemize @bullet{} -@item Entete - -@example -typedef map < string, string > Environnement; -@end example - - -@item Exemple -@example -@dots{} - -Environnement env; -env["MYAPP_ROOTDIR"] = "/home/user/myapplication"; -env["MYAPP_LICENSEFILE"] = env["MYAPP_ROOTDIR"] + "/license.dat"; -env["CXX"] = "g++"; -env["CXXFLAGS"] = "-g -O2"; - -@dots{} -@end example - -@item Methodes - -Compte tenu de la definition actuelle de la classe @emph{Environnement} -en tant que map STL, elle beneficie de toutes les fonctionnalites -classiques des maps STL. - -@end itemize - - -@c ---------------------- -@c ---------------------- -@c ---------------------- - -@node Classe Job, Classe JobId, Classe Environnement, Classes utilisateur -@comment node-name, next, previous, up -@page -@subsubsection Job -@findex Job - -La classe @emph{Job} represente la notion de travail, ou job, dans la -bibliotheque de classes Batch. Elle se comporte essentiellement comme -une collection de parametres et de variables necessaires a la -description des actions qui doivent etre realisees dans des conditions -precisees. - -Elle se repose sur deux autres classes qui distinguent la notion de -parametre d'execution et celle de variable d'environnement : les classes -@emph{Parametre} et @emph{Environnement}. @xref{Classe -Parametre}. @xref{Classe Environnement}. - -Son role est de preparer la soumission qui aura lieu et qui concretisera -l'incarnation du job dans le gestionnaire de batch. Tant que le job n'a -pas ete soumis, on ne peut pas vraiment considerer son existence et de -fait les interactions qu'on peut avoir avec l'objet sont tres limitees. - -@itemize @bullet{} -@item Entete - -@example -class Job -@{ - public: - // Constructeurs et destructeur - Job(); - Job(Parametre param); - Job(Environnement env); - Job(Parametre param, Environnement env); - virtual ~Job(); - - // Operateur pour l'affichage sur un stream - friend ostream & operator <<(ostream & os, const Job & job); - - // Accesseurs - Parametre getParametre() const; - void setParametre(const Parametre &); - - // Accesseurs - Environnement getEnvironnement() const; - void setEnvironnement(const Environnement &); - - // Methodes pour l'interfacage avec Python (SWIG) - string __repr__() const; - - protected: - Parametre _param; // table des parametres batch du job - Environnement _env; // table des variables d'environnement - - private: - -@}; -@end example - - -@item Exemple -@example -@dots{} - -@dots{} (ici on cree un BatchManager bm) -Parametre param; -Environnement env; - -@dots{} (ici on cree les parametres du job) - -Job job(param, env); -JobId jobid = bm.sumbitJob(job); - -@dots{} -@end example - -@item Methodes -@itemize @minus{} - -@item -@b{Job()$* -Job(Parametre param)$* -Job(Environnement env)$* -Job(Parametre param, Environnement env)} - -Le constructeur, en plus de creer l'objet, peut faire des verifications -sur la coherence des objets passes en argument s'il y en a. - -@item -@b{~Job()} - -Le destructeur libere simplement les espaces alloues. - -@item -@b{ostream & operator <<(ostream & os, const Job & job)} - -Cette methode permet a l'utilisateur d'afficher sur un stream le contenu -d'un objet de classe @emph{Job}. - -@item -@b{Parametre getParametre() const} - -Un accesseur pour recuperer l'objet Parametre passe en argument du -constructeur. - -@item -@b{void setParametre(const Parametre &)} - -Cette methode permet de positionner @i{a posteriori} l'objet -@emph{Parametre}. Des tests complementaires peuvent etre faits pour -verifier la coherence de l'objet. - -@item -@b{Environnement getEnvironnement() const} - -Un accesseur pour recuperer l'objet Environnement passe en argument du constructeur. - -@item -@b{void setEnvironnement(const Environnement &)} - -Cette methode permet de positionner @i{a posteriori} l'objet -@emph{Environnement}. Des tests complementaires peuvent etre faits pour -verifier la coherence de l'objet. - -@item -@b{string __repr__() const} - -Cette methode sert dans l'interfacage Python de l'objet et permet d'en -realiser l'affichage a travers l'interpreteur Python. - -@end itemize -@end itemize - -@c ---------------------- -@c ---------------------- -@c ---------------------- - -@node Classe JobId, Classe JobInfo, Classe Job, Classes utilisateur -@comment node-name, next, previous, up -@page -@subsubsection JobId -@findex JobId - -La classe @emph{JobId} represente l'incarnation d'un objet de classe -@emph{Job} une fois soumis au travers du gestionnaire de batch. A chaque -objet @emph{JobId} correspond une et une seule soumission d'un objet -@emph{Job}. Ainsi un meme objet @emph{Job} peut etre soumis plusieurs -fois de suite a un ou plusieurs gestionnaires de batch et produira -autant d'objets @emph{JobId}. - -L'objet @emph{JobId} assure le controle et la gestion du job au travers -du gestionnaire de batch. Chaque objet @emph{JobId} est associe a un -gestionnaire particulier aupres duquel il relaie les actions qu'on lui -soumet. - - -@itemize @bullet{} -@item Entete - -@example -class JobId -@{ - friend class BatchManager; - - public: - // Constructeur standard et destructeur - JobId(); - virtual ~JobId(); - - // Constructeur avec le pointeur sur le BatchManager associe - // et avec une reference - JobId(BatchManager *, string ref); - - // Operateur d'affectation entre objets - virtual JobId & operator =(const JobId &); - - // Constructeur par recopie - JobId(const JobId &); - - // Accesseur pour la reference interne - virtual string getReference() const; - - // Methodes pour le controle du job - // retire un job du gestionnaire - virtual void deleteJob() const; - - // suspend un job en file d'attente - virtual void holdJob() const; - - // relache un job suspendu - virtual void releaseJob() const; - - // modifie un job en file d'attente - virtual void alterJob(const Parametre & param, - const Environnement & env) const; - virtual void alterJob(const Parametre & param) const; - virtual void alterJob(const Environnement & env) const; - - // modifie un job en file d'attente - virtual void setParametre(const Parametre & param); - virtual void setEnvironnement(const Environnement & env); - - // renvoie l'etat du job - virtual Batch::JobInfo queryJob() const; - - // Methodes pour l'interfacage avec Python (SWIG) - string __str__() const; // SWIG : affichage en Python - string __repr__() const; // SWIG : affichage en Python - - protected: - BatchManager * _p_batchmanager; // pointeur sur le BatchManager - // qui controle le job - string _reference; // reference du job au sein du BatchManager - - private: - -@}; -@end example - - -@item Exemple -@example -@dots{} (ici on cree un BatchManager bm et un Job job) - -// On soumet le job et on recupere un identifiant -JobId jobid = bm.submitJob(job); - -// Ce qui permet d'interroger l'etat du job en cours -JobInfo jinfo = jobid.queryJob(); - -@dots{} -@end example - -@item Methodes - -@itemize @minus{} -@item -@b{JobId()@* -JobId(BatchManager *, string ref)} - -Le constructeur par defaut cree un @emph{JobId} qui devra etre complete -par la suite. Ceci n'est pas directement realisable par l'utilisateur -mais sert pour certaines classes amies de la classe @emph{JobId}. - -D'un point de vue utilisateur la construction d'un objet @emph{JobId} -necessite un pointeur sur un gestionnaire de batch existant et une -chaine de caractere representant une reference au sein de ce -gestionnaire de batch. - -Ces parametres sont en general issus de la -communication avec l'API du gestionnaire de batch et ne peuvent etre -aisement deduits. C'est pourquoi il est recommande de passer par une -classe d'implementation pour fabriquer un objet @emph{JobId}. - - -@item -@b{~JobId()} - -Le destructeur libere l'espace occupe par l'objet. - -@item -@b{JobId & operator =(const JobId &)} - -L'affectation d'un objet @emph{JobId} duplique les donnees internes de -l'objet passe en argument. Les deux objets sont totalement independants -a l'issue de l'affectation et designent chacun la meme instance du job -dans le meme gestionnaire de batch. Le controle du job peut etre realise -avec l'un ou l'autre des objets. - -@item -@b{JobId(const JobId &)} - -De meme que l'affectation le constructeur par recopie produit un objet -@emph{JobId} totalement independant de l'objet passe en argument et qui -designe le meme job dans le meme gestionnaire de batch. Le controle du -job peut etre realise avec l'un ou l'autre des objets. - -@item -@b{string getReference() const} - -Cet accesseur retourne la reference du job pour le gestionnaire de batch -qui a produit l'objet. - -@item -@b{void deleteJob() const} - -Cette methode relaie aupres au gestionnaire de batch qui a produit -l'objet la demande d'arret du job. - -@item -@b{void holdJob() const} - -Cette methode relaie aupres au gestionnaire de batch qui a produit -l'objet la demande de suspension du job. - -@item -@b{void releaseJob() const} - -Cette methode relaie aupres au gestionnaire de batch qui a produit -l'objet la demande de liberation du job. - -@item -@b{void alterJob(const Parametre & param, const Environnement & env) const@* -void alterJob(const Parametre & param) const@* -void alterJob(const Environnement & env) const} - -Ces methodes relaient aupres du gestionnaire de batch qui a produit -l'objet la demande de modification des parametres et/ou des variables -d'environnement du job. - -@item -@b{void setParametre(const Parametre & param)} - -Cette methode n'est utile que pour l'interfacage avec Python, car Python -ne sait pas gerer la surcharge de methode, et de fait leve des -exceptions lors d'appels a de telles methodes. - -Elle est equivalente a la methode @samp{void alterJob(const Parametre & param) const}. - - -@item -@b{void setEnvironnement(const Environnement & env)} - -Cette methode n'est utile que pour l'interfacage avec Python, car Python -ne sait pas gerer la surcharge de methode, et de fait leve des -exceptions lors d'appels a de telles methodes. - -Elle est equivalente a la methode @samp{void alterJob(const Environnement & env) const}. - -@item -@b{Batch::JobInfo queryJob() const} - -Cette methode relaie aupres du gestionnaire de batch qui a produit -l'objet la demande d'interrogation de l'etat du job. - -@item -@b{string __str__() const} - -Cette methode n'est utile que pour l'interfacage avec Python. Elle -permet d'afficher l'etat de l'objet @emph{JobId}. - -@item -@b{string __repr__() const} - -Cette methode n'est utile que pour l'interfacage avec Python. Elle -permet d'afficher l'etat de l'objet @emph{JobId}. - -@end itemize -@end itemize - -@c ---------------------- -@c ---------------------- -@c ---------------------- - -@node Classe JobInfo, Classe Parametre, Classe JobId, Classes utilisateur -@comment node-name, next, previous, up -@page -@subsubsection JobInfo -@findex JobInfo - -Un objet de classe @emph{JobInfo} represente l'ensemble des informations -disponibles sur un travail actif, c'est-a-dire soumis au gestionnaire de -batch, a un instant donne. - -Cet objet reprend des informations issues du job tel qu'il a ete soumis, -@xref{Classe Job}, mais aussi des informations produites par le -gestionnaire de batch a partir de la soumission et du transit du job en -son sein : nom de la queue dans laquelle le job est inscrit, duree -d'execution, date de soumission, etc. - -Ces informations sont disponibles aupres de l'utilisateur de la classe a -travers les objets @emph{Parametre} et @emph{Environnement} que l'objet -@emph{JobInfo} peut fournir. - -@itemize @bullet{} -@item Entete - -@example -class JobInfo -@{ - public: - // Constructeur standard et destructeur - JobInfo(); - virtual ~JobInfo(); - - // Constructeur par recopie - JobInfo(const JobInfo & jinfo); - - // Operateur pour l'affichage sur un stream - friend ostream & operator <<(ostream & os, const JobInfo & ji); - - // Accesseurs - virtual Parametre getParametre() const; - virtual Environnement getEnvironnement() const; - - // Methodes pour l'interfacage avec Python (SWIG) - string __str__() const; // SWIG : affichage en Python - string __repr__() const; // SWIG : affichage en Python - - protected: - Parametre _param; // parametres du job - Environnement _env; // variables d'environnement du job - - private: -@}; -@end example - - -@item Exemple -@example -@dots{} (ici on cree un BatchManager bm et un Job job) - -// On soumet le job et on recupere un identifiant -JobId jobid = bm.submitJob(job); - -// Ce qui permet d'interroger l'etat du job en cours -JobInfo jinfo = jobid.queryJob(); - -// On recupere l'objet Parametre interne modifie -// par le gestionnaire de batch -Parametre param = jinfo.getParametre(); - -// On recupere l'objet Environnement interne modifie -// par le gestionnaire de batch -Environnement env = jinfo.getEnvironnement(); - -@dots{} -@end example - -@item Methodes -@itemize @minus{} -@item -@b{JobInfo()} - -Ce constructeur cree un objet @emph{JobInfo} vide. - -@item -@b{~JobInfo()} - -Le destructeur libere l'espace memoire alloue par l'objet. - -@item -@b{JobInfo(const JobInfo & jinfo)} - -Le constructeur par recopie produit un objet identique a celui passe en -argument. Les deux objets sont totalement independants l'un de l'autre. - -@item -@b{ostream & operator <<(ostream & os, const JobInfo & ji)} - -Cet operateur permet de voir le contenu de l'objet sur un flot de sortie. - -@item -@b{Parametre getParametre() const} - -Cet accesseur retourne l'objet interne @emph{Parametre} modifie par le -gestionnaire de batch. En particulier on y retrouve toutes les clefs et -les valeurs correspondant aux informations produites dynamiquement par -le gestionnaire (duree d'execution, machine d'execution, etc.). -Il n'est pas garanti que les valeurs passees au moment de la soumission -soient inchangees car des modifications ont pu etre apportees a ces -valeurs pendant le traitement du job par le gestionnaire. - -@item -@b{Environnement getEnvironnement() const} - -Cet accesseur retourne l'objet interne @emph{Environnement} modifie par le -gestionnaire de batch. En particulier on y retrouve toutes les clefs et -les valeurs correspondant aux informations produites dynamiquement par -le gestionnaire (chemin d'acces, variables d'environnement specifiques a -la machine d'execution, etc.). -Il n'est pas garanti que les valeurs passees au moment de la soumission -soient inchangees car des modifications ont pu etre apportees a ces -valeurs pendant le traitement du job par le gestionnaire. - -@item -@b{string __str__() const} - -Cette methode n'est utile que pour l'interfacage avec Python. Elle -permet d'afficher l'etat de l'objet @emph{JobInfo}. - -@item -@b{string __repr__() const} - -Cette methode n'est utile que pour l'interfacage avec Python. Elle -permet d'afficher l'etat de l'objet @emph{JobInfo}. - -@end itemize - -@end itemize - -@c ---------------------- -@c ---------------------- -@c ---------------------- - -@node Classe Parametre, Classe Versatile, Classe JobInfo, Classes utilisateur -@comment node-name, next, previous, up -@page -@subsubsection Parametre -@findex Parametre - -Les objets de la classe @emph{Parametre} se comportent comme des maps -STL, dont ils ont les fonctionnalites, decrivant les parametres -d'execution du job. - -Contrairement aux variables d'environnement qui sont decrites par les -objets de la classe @emph{Environnement}, les parametres d'execution -servent a preciser les contraintes qui pesent sur le job, comme par -exemple la duree maximale d'execution autorisee, la quantite maximale de -memoire utilisable ou la queue de soumission, ou bien a renseigner le -job avec des informations specifiques a l'utilisateur, comme son -username, son adresse email, le code d'imputation du job, etc. - -En raison du caractere tres specifique et precis des informations qui -doivent etre fournies au gestionnaire de batch, une nomenclature est -proposee par la classe @emph{Parametre} qu'il est vivement conseille de -suivre. De plus tout a ete fait pour rendre cette ecriture naturelle et -facile, donc il ne devrait pas y avoir de probleme pour l'utiliser. - -Ainsi, a titre d'exemple, pour preciser le temps maximal autorise pour -un job, il faut creer une clef de nom @var{maxcputime} dans un objet de -classe @emph{Parametre} qui sera ensuite passe au job. Et pour preciser -le code d'imputation du job, il faut creer une clef de nom @var{account}. - -Mais cet exemple simple montre que la valeur associee a la clef -@var{maxcputime} est semantiquement une duree, et que la valeur associee a -la clef @var{account} est semantiquement un nom. On a donc un probleme de -type puisque dans la definition d'une map STL le type de la valeur doit -etre le meme, et ce meme si les valeurs doivent par la suite avoir des -types semantiques differents. C'est pourquoi on a definit une classe -@emph{Versatile} qui encapsule des types differents. @xref{Classe -Versatile}. - -Quoiqu'il en soit toute la mecanique est cachee et seul importe pour -l'utilisateur de savoir que les valeurs associees aux clefs sont typees -et que ces types sont definis dans l'enumeration @emph{DiscriminatorType}. -@xref{Classe Versatile}. - - -@itemize @bullet{} -@item Entete - -@example -class Parametre : public map< string, Versatile > -@{ - public: - // Constructeur standard - Parametre(); - - // Constructeur par recopie - Parametre(const Parametre & PM); - - // Operateur de recherche dans la map - Versatile & operator [] (const string &); - const Versatile & operator [] (const string &) const; - - // Operateur d'affectation - Parametre & operator =(const Parametre & PM); - - // Declarations statique des clefs de la map - static const string ACCOUNT; - static const string CHECKPOINT; - static const string CKPTINTERVAL; - static const string CREATIONTIME; - static const string EGROUP; - static const string ELIGIBLETIME; - static const string EUSER; - static const string EXECUTABLE; - static const string EXECUTIONHOST; - static const string HOLD; - static const string ID; - static const string INFILE; - static const string MAIL; - static const string MAXCPUTIME; - static const string MAXDISKSIZE; - static const string MAXRAMSIZE; - static const string MAXWALLTIME; - static const string MODIFICATIONTIME; - static const string NAME; - static const string OUTFILE; - static const string PID; - static const string QUEUE; - static const string QUEUEDTIME; - static const string SERVER; - static const string STARTDATE; - static const string STATE; - static const string TEXT; - static const string TMPDIR; - static const string USEDCPUTIME; - static const string USEDDISKSIZE; - static const string USEDRAMSIZE; - static const string USEDWALLTIME; - static const string USER; - - protected: - // map interne servant a controler le type - // de la valeur associee a chaque clef - map< string, TypeParam > TypeMap; - - private: - -@}; -@end example - - -@item Exemple -@example -@dots{} - -Parametre param; - -param[EXECUTABLE] = "/home/user/mon_application/executable"; -param[NAME] = "MonJob"; -param[ACCOUNT] = "MonProjet"; // code d'imputation/facturation -param[MAXCPUTIME] = 360L; // 6min -param[MAXWALLTIME] = 480L; // 8min -param[INFILE] = Couple("/tmp/infich1", rempath + "/infich1"); -param[OUTFILE] = Couple("/tmp/outfich1", rempath + "/outfich1"); -param[OUTFILE] += Couple("stderr", path + "/STDERR"); -param[OUTFILE] += Couple("stdout", path + "/STDOUT"); -param[MAIL] = "user@@domaine.fr"; -param[USER] = "user"; - -@dots{} -@end example - -@item Methodes -@itemize @minus{} - -@item -@b{Parametre()} - -Le constructeur par defaut initialise l'objet @emph{Parametre} et cree -la table des types internes. Par contre l'objet ne contient aucune valeur. - -@item -@b{Parametre(const Parametre & PM)} - -Le constructeur par recopie cree un objet @emph{Parametre} a l'image de -celui qui lui est passe en argument. La table des types internes est -dupliquee ainsi que tous les objets correspondant a chacune des clefs. - -@item -@b{Versatile & operator [] (const string &)} - -Cet operateur permet de recuperer la valeur designee par la clef passee -en argument. Cette valeur est de classe @emph{Versatile} qui encapsule -tous les types de base utilisables dans la bibliotheque en tant que -parametre. @xref{Classe Versatile}. - - -@item -@b{const Versatile & operator [] (const string &) const} - -A l'image de l'operateur precedent, cet operateur permet de recuperer la -valeur designee par la clef passee en argument mais uniquement pour des -objets constants. - -@item -@b{Parametre & operator =(const Parametre & PM)} - -L'operateur d'affectation remplace l'ensemble du contenu de l'objet -@emph{Parametre} par le contenu de l'objet passe en argument. Les -valeurs sont dupliquees par rapport a l'objet @var{pm}. - -@end itemize - -@item Description des clefs - -Selon les gestionnaires de batch utilises, certaines clefs sont actives -ou inactives. Une definition superflue ne pose pas de probleme et se -trouve ignoree au moment de la soumission. Par contre l'absence d'un -clef peut empecher la soumission d'aboutir et lever une exception. - -@itemize @minus{} -@item ACCOUNT : type STRING - -Le code de facturation sur lequel le job doit s'imputer. - -@item CHECKPOINT : type LONG - -Une valeur non nulle indique au gestionnaire de batch que le job est -@dfn{checkpointable}, c'est-a-dire interruptible pour une reprise -ulterieure. - -@item CKPTINTERVAL : type LONG - -En liaison avec la clef @var{CHECKPOINT}, la clef @var{CKPTINTERVAL} -indique l'intervalle en secondes entre deux interruptions du code -(@dfn{checkpoint}). - -@item CREATIONTIME : type LONG - -La date a laquelle le job a ete cree (soumis) dans le gestionnaire de batch. - -@item EGROUP : type STRING - -Le groupe effectif au sens Unix du terme dans lequel le job s'execute. - -@item ELIGIBLETIME : type LONG - -La date a laquelle le job a pu disposer des ressources necessaires a son -execution. - -@item EUSER : type STRING - -L'utilisateur effectif au sens Unix du terme pour lequel le job s'execute. - -@item EXECUTABLE : type STRING - -Le chemin d'acces absolu a l'executable sur la machine qui soumet le job. - -@item EXECUTIONHOST : type STRING - -Le nom de la machine qui execute le job. - -@item HOLD : type LONG - -Une valeur non nulle indique au gestionnaire de batch que le job doit -etre place dans l'etat suspendu. Une valeur nulle libere le job. - -@item ID : type STRING - -L'identifiant unique du job pour le gestionnaire de batch. - -@item INFILE : type liste de COUPLE - -La clef @var{infile} liste les fichiers qui seront envoyes au job avant -son execution. Chaque fichier peut avoir un nom different sur la machine -cliente --- qui soumet le job --- et sur le serveur. C'est pourquoi -chaque fichier a envoyer est represente par un couple dont le nom @var{local} -est le chemin absolu du fichier sur la machine cliente et le nom -@var{remote} est le chemin absolu du fichier sur le -serveur. @xref{Classe Couple}. - -Si le nom @var{remote} vaut @samp{stdin}, alors le contenu du fichier -designe par le nom @var{local} est envoye sur l'entree standard du job -au moment de son execution. - -@item MAIL : type STRING - -L'adresse email de l'utilisateur ou lui seront envoyes les eventuels -messages d'information et d'alerte du gestionnaire de batch. - -@item MAXCPUTIME : type LONG - -Le temps de calcul (@i{CPU time}) en secondes que ne devra pas depasser le job. - -@item MAXDISKSIZE : type LONG - -L'espace disque en octets que ne devra pas depasser le job. - -@item MAXRAMSIZE : type LONG - -La quantite de memoire vive en octets que ne devra pas depasser le job. - -@item MAXWALLTIME : type LONG - -Le temps reel (@i{elapsed time}) en secondes que ne devra pas depasser le job. - -@item MODIFICATIONTIME : type LONG - -La date a laquelle le job a ete modifie pour la derniere fois dans le -gestionnaire de batch. Cette date correspond le plus souvent a la -derniere operation realisee par le gestionnaire dans la gestion du job : -routage au sein des files, suspension ou reprise, etc. - -@item NAME : type STRING - -Le nom du job tel qu'il apparait a l'utilisateur dans son dialogue avec -le gestionnaire de batch. Ce nom n'a pas besoin d'etre unique et ne -remplace pas l'identifiant (ID). Il n'est la que pour informer -l'utilisateur de la nature de son job. - -@item OUTFILE : type liste de COUPLE - -La clef @var{outfile} liste les fichiers qui sont produits par le job et -qui seront recuperes sur la machine locale de l'utilisateur apres -son execution. Chaque fichier peut avoir un nom different sur la machine -cliente --- qui soumet le job --- et sur le serveur. C'est pourquoi -chaque fichier a recuperer est represente par un couple dont le nom @var{local} -est le chemin absolu du fichier sur la machine cliente et le nom -@var{remote} est le chemin absolu du fichier sur le -serveur. @xref{Classe Couple}. - -Si le nom @var{local} vaut @samp{stdout}, alors le contenu du fichier -designe par le nom @var{local} contient la sortie standard du job -au moment de son execution. - -Si le nom @var{local} vaut @samp{stderr}, alors le contenu du fichier -designe par le nom @var{local} contient la sortie d'erreur du job -au moment de son execution. - -@item PID : type LONG - -La valeur du PID (@i{process identifier}) du job sur la machine sur -lqsuelle il s'execute. - -@item QUEUE : type STRING - -Le nom de la queue, aussi appelee classe ou file suivant les -terminologies, qui accueille le job. - -@item QUEUEDTIME : type LONG - -La date depuis laquelle le job a ete place en queue dans le gestionnaire -de batch. - -@item SERVER : type STRING - -Le nom complet du serveur qui recoit les soumissions de job. - -@item STARTDATE : type LONG - -La date a partir de laquelle l'utilisateur desire que le job soit -execute. L'execution ne demarrera qu'au dela de cette date et a -condition que toutes les conditions de ressources soient remplies. - -@item STATE : type STRING - -L'etat actuel du job. - -ATTENTION : Ces valeurs ne sont pas encore normalisees. - -@item TEXT : type STRING - -Un texte d'information que le gestionnaire peut emettre a destination de -l'utilisateur lorsque l'ensemble des parametres n'est pas suffisant pour -traduire l'etat reel du job. Par exemple, ce message peut informer -l'utilisateur de la raison qui maintient un job dans un etat suspendu ou -qui l'empeche de s'executer. - -@item TMPDIR : type STRING - -Un chemin d'acces absolu a un repertoire qui sera cree au demarrage du -job et qui isolera le job des autres travaux en cours d'execution sur la -meme machine. - -@item USEDCPUTIME : type LONG - -Le temps de calcul (@i{CPU time}) en secondes reellement consomme par le job. - -@item USEDDISKSIZE : type LONG - -L'espace disque en octets reellement consomme par le job. - -@item USEDRAMSIZE : type LONG - -L'espace disque en octets reellement consommee par le job. - -@item USEDWALLTIME : type LONG - -Le temps reel (@i{elapsed time}) en secondes reellement consomme par le job. - -@item USER : type STRING - -Le nom de l'utilisateur (@i{username}) sous lequel le job devra tourner -sur la machine d'execution. Ce parametre est utile lorsque l'utilisateur -possede des comptes differents sur les machines sur lequel il soumet et calcule. - -@end itemize - - -@end itemize - -@c ---------------------- -@c ---------------------- -@c ---------------------- - -@node Classe Versatile, Exceptions, Classe Parametre, Classes utilisateur -@comment node-name, next, previous, up -@page -@subsubsection Versatile -@findex Versatile - -Cette classe est normalement invisible en tant que telle a l'utilsateur -de la bibliotheque de classes Batch. Mais il est tout de meme utile de -la presenter car son action est visible, notamment dans son interaction -fine avec la classe @emph{Parametre}. @xref{Classe Parametre}. - -Comme il a ete precise dans la descrption de la classe @emph{Parametre}, -la classe @emph{Versatile} a ete concue pour encapsuler les valeurs de -la map @emph{Parametre} qui peuvent etre de types effectifs differents. - -Ces types, decrits par l'enumeration @emph{DiscriminatorType}, sont -actuellement au nombre de trois : @var{long}, @var{string} et -@var{couple}. Ces types correpondent au types de base du langage C++ ou -de la biliotheque de classes Batch. @xref{Types de base}. - -Le type special @var{undefined} ne sert que pour l'objet -@emph{Versatile} juste cree mais non encore affecte d'une valeur et donc -d'un type. La premiere affection d'une valeur a un objet -@emph{Versatile} non encore affecte lui donne automatiquement le type de -la valeur. - -Les objets de classe @emph{Versatile} peuvent se comporter soit comme -des variables scalaires, c'est-a-dire ne contenant qu'une valeur unique, -soit comme des listes, auquel cas elles utilisent l'interface des -@emph{list} de la STL. Toutefois afin de faciliter l'ecriture pour -l'utilisateur basique de la classe @emph{Versatile} --- et de la classe -@emph{Parametre} ---, des operateurs de concatenation @samp{+=} et -@samp{,} ont ete ajoutes. - - -@itemize @bullet{} -@item Entete - -@example -// Les types autorises -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 Versatile : public list< GenericType * > -@{ - public: - // Constructeur standard et destructeur - Versatile(); - virtual ~Versatile(); - - // Constructeur par recopie - Versatile(const Versatile & V); - - // Constructeur depuis le type de "base" - Versatile(long l); - Versatile(const string & s); - Versatile(const Couple & c); - - // Operateur d'affectation et de concatenation - // a partir d'un type de "base" - Versatile & operator = (const long l) - throw(TypeMismatchException); - Versatile & operator = (const string & ch) - throw(TypeMismatchException); - Versatile & operator +=(const string & ch) - throw(TypeMismatchException,ListIsFullException); - Versatile & operator , (const string & ch) - throw(TypeMismatchException,ListIsFullException); - Versatile & operator = (const Couple & cp) - throw(TypeMismatchException); - Versatile & operator +=(const Couple & cp) - throw(TypeMismatchException,ListIsFullException); - Versatile & operator , (const Couple & cp) - throw(TypeMismatchException,ListIsFullException); - - // Operateur d'affectation entre objets - Versatile & operator = (const Versatile & V) - throw(TypeMismatchException); - - // Conversion de type vers un type de "base" - operator long() const throw(TypeMismatchException); - operator string() const throw(TypeMismatchException); - operator Couple() const throw(TypeMismatchException); - string str() const throw(TypeMismatchException); - - // Operateur pour l'affichage sur un stream - friend ostream & operator << (ostream & os, const Versatile & ); - - // Positionnement et recuperation du type de l'element interne - void setType(DiscriminatorType) throw(TypeMismatchException); - DiscriminatorType getType() const; - - // Positionnement et recuperation du nombre d'elements internes - void setMaxSize(int i); - int getMaxSize() const; - - // Positionnement et recuperation du nom de l'objet - string getName() const; - void setName(const string & name); - - protected: - // Efface tous les elements internes de l'objet - virtual void eraseAll(); - - DiscriminatorType _discriminator; // type de l'element interne - int _maxsize; // nombre max d'elements internes - string _name; // nom de l'objet (sert pour les exceptions) - - private: - -@}; -@end example - - -@item Exemple -@example -@dots{} - -// On cree un objet Versatile non encore affecte (scalaire) -Versatile Vlong; - -// L'affectation d'un long lui donne le type LONG -Vlong = 1024L * 1024L * 1024L; -cout << "Versatile long (must be 1073741824) : " << Vlong << endl; - -// On cree un objet Versatile non encore affecte (scalaire) -Versatile Vstring; - -// L'affectation d'une string (const char * promu en string) -// lui donne le type STRING -Vstring = "UneChaine"; -cout << "Versatile string (must be UneChaine) : " << Vstring << endl; - -try - @{ - // L'affectation d'un autre type leve une exception. - // Il n'y a pas de retypage dynamique. - Vlong = ""; - cout << "ERR : No TypeMismatchException catched for Versatile long" - << endl; - @} -catch (TypeMismatchException & ex) - @{ - cout << "OK : TypeMismatchException catched for Versatile long" - << endl; - @} - -// Reaffectation avec le meme type -Vlong = 1024L * 1024L; -cout << "Versatile long (must be 1048576) : " << Vlong << endl; - -// On cree un objet Versatile non encore affecte (scalaire) ... -Versatile Vcat1; - -// ... que l'on transforme en liste (non limitee) -Vcat1.setMaxSize(0); - -// On affecte la premiere valeur ... -Vcat1 = "A"; - -// ... puis les suivantes par concatenation -Vcat1 += "B"; -Vcat1 += "C"; -Vcat1 += "D"; -Vcat1 += "E"; -cout << "Versatile string concatenation (must be A B C D E) : " - << Vcat1 << endl; - -// Idem que pour Vcat1, mais avec une limite a 5 elements dans la liste -Versatile Vcat2; -Vcat2.setMaxSize(5); -Vcat2 = "a", "b", "c", "d", "e"; -cout << "Versatile string concatenation (must be a b c d e) : " - << Vcat2 << endl; - -// On tronque les 2 derniers elements de la liste (il en reste 3) -Vcat2.setMaxSize(3); -cout << "Versatile string concatenation (must be a b c) : " - << Vcat2 << endl; - - -Versatile Vcopy2(Vcat2); -cout << "Versatile copy (must be a b c) : " << Vcopy2 << endl; - -Versatile Vaffect; -Vaffect = Vcat1; -cout << "Versatile affect (must be A B C D E) : " << Vaffect << endl; -Vaffect = Vcat2; -cout << "Versatile affect (must be a b c) : " << Vaffect << endl; - -try - @{ - // Retypage dynamique interdit - Vaffect = Vlong; - cout << "ERR : No TypeMismatchException catched for Versatile" - << endl; - @} -catch (TypeMismatchException & ex) - @{ - cout << "OK : TypeMismatchException catched for Versatile string" - << endl; - @} - -try - @{ - // Concatenation au dela de la limite interdit - Vcat2 += "En trop"; - cout << "ERR : No ListIsFullException catched for Versatile string" - << endl; - @} -catch (ListIsFullException & ex) - @{ - cout << "OK : ListIsFullException catched for Versatile string" - << endl; - @} - -// Les objets Versatile se comportent (presque) comme des objets -// standards du langage -long L = Vlong; -cout << "Long value of Versatile long (must be 1048576) : " - << L << endl; - -string S = Vstring; -cout << "String value of Versatile (must be EncoreUneAutreChaine):" - << S << endl; - -@dots{} -@end example - -@item Methodes -@itemize @minus{} -@item -@b{Versatile()} - -Le constructeur par defaut fabrique un objet scalaire de type -@var{undefined} et de nom @samp{undefined}. - -@item -@b{~Versatile()} - -Le destructeur efface tout le contenu de l'objet si celui-ci avait ete affecte. - -@item -@b{Versatile(const Versatile & V)} - -Le constructeur par recopie duplique l'objet passe en argument ainsi que -les valeurs qu'il contient. Le nouvel objet est totalement independant -de son geniteur. - -@item -@b{Versatile(long l)@* -Versatile(const string & s)@* -Versatile(const Couple & c)} - -Ces constructeurs fabriquent des objets scalaires @emph{Versatile} a partir des -types de base passes en argument. Chaque objet acquerera definitivement -le type correspondant au type de base : @var{long} pour @samp{long}, -@var{string} pour @samp{string} et @var{couple} pour @samp{Couple}. - -@item -@b{Versatile & operator = (const long l) throw(TypeMismatchException)@* -Versatile & operator = (const string & ch) throw(TypeMismatchException)@* -Versatile & operator = (const Couple & cp) throw(TypeMismatchException)} - -Ces operateurs affectent ou reaffectent la valeur passee en argument a -l'objet. Le type de la valeur doit correspondre au type de l'objet si -celui-ci a deja ete affecte, sinon une exception @emph{TypeMismatchException} est -levee. @xref{Classe TypeMismatchException}. - -L'ancienne valeur de l'objet est perdue. - -@item -@b{Versatile & operator += (const string & ch) - throw(TypeMismatchException, ListIsFullException)@* -Versatile & operator , (const string & ch) - throw(TypeMismatchException, ListIsFullException)@* -Versatile & operator += (const Couple & cp) - throw(TypeMismatchException, ListIsFullException)@* -Versatile & operator , (const Couple & cp) - throw(TypeMismatchException, ListIsFullException)} - -Ces operateurs concatenent la valeur passee en argument a l'objet. Le -type de la valeur doit correspondre au type interne de l'objet si -celui-ci a deja ete affecte, sinon une exception @emph{TypeMismatchException} est -levee. @xref{Classe TypeMismatchException}. - -Si la taille maximale de la liste est depasse, une exception @emph{ListIsFullException} est -levee. @xref{Classe ListIsFullException}. - -@item -@b{Versatile & operator = (const Versatile & V) throw(TypeMismatchException)} - -L'operateur d'affectation duplique l'objet passe en argument dans -l'objet. Toutes les valeurs internes sont dupliquees de maniere a avoir -une independance totale entre les deux objets a l'issue de -l'affectation. - -Il est a noter qu'il est possible d'affecter a un objet un objet -possedant un type different, auquel cas l'objet courant change de type -pour acquerir celui de l'objet passe en argument. C'est le seul cas de -changement de type autorise pour un objet. - -@item -@b{operator long() const throw(TypeMismatchException)@* -operator string() const throw(TypeMismatchException)@* -operator Couple() const throw(TypeMismatchException)@* -string str() const throw(TypeMismatchException)} - -Ces operateur de conversion dans les types de base permettent de -recuperer la valeur interne de l'objet. Lorsque le type interne est -incompatible avec la conversion une exception @emph{TypeMismatchException} est -levee. @xref{Classe TypeMismatchException}. - -@item -@b{ostream & operator << (ostream & os, const Versatile & )} - -Cet operateur permet de voir le contenu de l'objet sur un flot de sortie. - -@item -@b{void setType(DiscriminatorType) throw(TypeMismatchException)} - -Cette methode change le type interne de l'objet en celui passe en -argument. Ceci n'est possible que pour un objet non encore affecte. Si -le nouveau type est different du type actuel une exception @emph{TypeMismatchException} est -levee. @xref{Classe TypeMismatchException}. - -@item -@b{DiscriminatorType getType() const} - -Cet accesseur renvoie le type interne de l'objet. - -@item -@b{void setMaxSize(int i)} - -Cette methode permet de changer le nombre d'elements que l'objet est -capable de stocker. Par defaut ce nombre est 1 a la construction de -l'objet, signifiant qu'il ne peut contenir qu'une seule valeur a la fois -(scalaire). - -Si ce nombre est superieur a 1 alors il represente une -limite qui ne pourra etre depassee par l'objet sans lever d'exception -@emph{ListIsFullException}. @xref{Classe ListIsFullException}. - -Si ce nombre vaut 0 (zero) alors il n'y a aucune limite superieure au -nombre d'element dans l'objet. - -@item -@b{int getMaxSize() const} - -Cet accesseur renvoie la taille maximale admise par l'objet. - -@item -@b{void setName(const string & name)} - -Cette methode permet de positionner le nom de l'objet. Par defaut ce nom -vaut @samp{undefined} a la construction de l'objet. - -Il est interessant de positionner le nom a une valeur significative -comme par exemple le nom de la variable contenant l'objet car lorsqu'une -exception est levee ce nom apparait en clair et aide au debugging. - -@item -@b{string getName() const} - -Cet accesseur renvoie le nom interne de l'objet. - -@end itemize - -@end itemize - - - -@c ---------------------- -@c ---------------------- -@c ---------------------- - -@node Exceptions, Classe APIInternalFailureException, Classe Versatile, Classes generiques -@comment node-name, next, previous, up -@page -@subsection Exceptions -@cindex exceptions - -La bibliotheque de classes Batch definit un certain nombre d'exceptions -qui sont levees par les classes lors d'evenements qui traduisent un -comportement anormal de la bibliotheque. - -@menu -* Classe APIInternalFailureException:: Erreur d'utilisation de l'API. -* Classe ConnexionFailureException:: Probleme de connexion de l'API. -* Classe GenericException:: Classe-mere de toutes les exceptions. -* Classe InvalidArgumentException:: Parametre errone d'une methode. -* Classe InvalidKeyException:: Clef erronee d'une map. -* Classe ListIsFullException:: Debordement de taille d'une liste. -* Classe NotYetImplementedException:: Methodes non encore implementee. -* Classe RunTimeException:: Erreur d'execution imprevue. -* Classe TypeMismatchException:: Probleme de conversion de type. -@end menu - - -@c ---------------------- -@c ---------------------- -@c ---------------------- - -@node Classe APIInternalFailureException, Classe ConnexionFailureException, Exceptions, Exceptions -@comment node-name, next, previous, up -@page -@subsubsection APIInternalFailureException -@findex APIInternalFailureException - -Cette exception est levee par les classes d'implementation de la -bibliotheque lorsqu'une erreur est detectee au moment de la -communication avec l'API du gestionnaire de batch. En general l'erreur -renvoyee par l'API est incluse dans le message de l'exception. - -Cette exception herite de la classe @emph{GenericException} qui definit -uniquement un constructeur et deux membres publics constants : @emph{type} et -@emph{message}. @xref{Classe GenericException}. - -@itemize @bullet{} -@item Entete - -@example -class APIInternalFailureException : public GenericException -@{ - public: - // Constructeur - APIInternalFailureException(string msg = "undefined"); -@}; -@end example - - -@item Methodes -@itemize @minus{} -@item -@b{APIInternalFailureException(string msg = "undefined")} - -Ce contructeur prend la chaine @emph{msg} comme message d'erreur a -renvoyer au gestionnaire d'exception. Cette valeur est stockee dans le -membre public constant @emph{message}. - -Le membre public constant @emph{type} est initialise avec le nom de la -classe, soit @emph{APIInternalFailureException}. - -@end itemize - -@end itemize - - -@c ---------------------- -@c ---------------------- -@c ---------------------- - -@node Classe ConnexionFailureException, Classe GenericException, Classe APIInternalFailureException, Exceptions -@comment node-name, next, previous, up -@page -@subsubsection ConnexionFailureException -@findex ConnexionFailureException - -Cette exception est levee par les classes d'implementation de la -bibliotheque lorsqu'une erreur est detectee au moment de la -connexion au gestionnaire de batch. En general l'erreur -renvoyee par l'API de connexion est incluse dans le message de l'exception. - -Cette exception herite de la classe @emph{GenericException} qui definit -uniquement un constructeur et deux membres publics constants : @emph{type} et -@emph{message}. @xref{Classe GenericException}. - -@itemize @bullet{} -@item Entete - -@example -class ConnexionFailureException : public GenericException -@{ - public: - // Constructeur - ConnexionFailureException(string msg = "undefined"); -@}; -@end example - - -@item Methodes -@itemize @minus{} -@item -@b{ConnexionFailureException(string msg = "undefined")} - -Ce contructeur prend la chaine @emph{msg} comme message d'erreur a -renvoyer au gestionnaire d'exception. Cette valeur est stockee dans le -membre public constant @emph{message}. - -Le membre public constant @emph{type} est initialise avec le nom de la -classe, soit @emph{ConnexionFailureException}. - -@end itemize - -@end itemize - -@c ---------------------- -@c ---------------------- -@c ---------------------- - -@node Classe GenericException, Classe InvalidArgumentException, Classe ConnexionFailureException, Exceptions -@comment node-name, next, previous, up -@page -@subsubsection GenericException -@findex GenericException - -Cette classe est generique comme son nom l'indique et definit une -interface commune pour toutes les exceptions de la -bibliotheque. - -Cette exception definit uniquement un constructeur et deux membres -publics constants : @emph{type} et @emph{message}. @xref{Classe -GenericException}. - - -@itemize @bullet{} -@item Entete - -@example -class GenericException -@{ - public: - const string type; // la nature de l'exception - const string message; // la raison de l'exception - - // Constructeur - GenericException(const string tp = "GenericException", - const string msg = "undefined"); -@}; -@end example - - -@item Methodes -@itemize @minus{} -@item -@b{GenericException(const string tp = "GenericException", const string msg = "undefined")} - -Ce contructeur prend la chaine @emph{msg} comme message d'erreur a -renvoyer au gestionnaire d'exception. Cette valeur est stockee dans le -membre public constant @emph{message}. - -Le membre public constant @emph{type} est initialise avec le parametre -@emph{tp} qui contient generalement le nom de la classe. - -@end itemize - -@end itemize - - -@c ---------------------- -@c ---------------------- -@c ---------------------- - -@node Classe InvalidArgumentException, Classe InvalidKeyException, Classe GenericException, Exceptions -@comment node-name, next, previous, up -@page -@subsubsection InvalidArgumentException -@findex InvalidArgumentException - -Cette exception est levee par les classes de la bibliotheque lorsqu'un -parametre erronne est passe en argument a une methode. En general -le nom de l'arguement erronne est inclus dans le message de -l'exception. - -Cette exception herite de la classe @emph{GenericException} qui definit -uniquement un constructeur et deux membres publics constants : @emph{type} et -@emph{message}. @xref{Classe GenericException}. - -@itemize @bullet{} -@item Entete - -@example -class InvalidArgumentException : public GenericException -@{ - public: - // Constructeur - InvalidArgumentException(string msg = "undefined"); -@}; -@end example - - -@item Methodes -@itemize @minus{} -@item -@b{InvalidArgumentException(string msg = "undefined")} - -Ce contructeur prend la chaine @emph{msg} comme message d'erreur a -renvoyer au gestionnaire d'exception. Cette valeur est stockee dans le -membre public constant @emph{message}. - -Le membre public constant @emph{type} est initialise avec le nom de la -classe, soit @emph{InvalidArgumentException}. - -@end itemize - -@end itemize - - -@c ---------------------- -@c ---------------------- -@c ---------------------- - -@node Classe InvalidKeyException, Classe ListIsFullException, Classe InvalidArgumentException, Exceptions -@comment node-name, next, previous, up -@page -@subsubsection InvalidKeyException -@findex InvalidKeyException - - -Cette exception est levee par les methodes de la classe @emph{Parametre} -lorsqu'une clef erronnee est utilisee. En general le nom de la clef -erronnee est inclus dans le message de l'exception. - -Cette exception herite de la classe @emph{GenericException} qui definit -uniquement un constructeur et deux membres publics constants : @emph{type} et -@emph{message}. @xref{Classe GenericException}. - -@itemize @bullet{} -@item Entete - -@example -class InvalidKeyException : public GenericException -@{ - public: - // Constructeur - InvalidKeyException(string msg = "undefined"); -@}; -@end example - - -@item Methodes -@itemize @minus{} -@item -@b{InvalidKeyException(string msg = "undefined")} - -Ce contructeur prend la chaine @emph{msg} comme message d'erreur a -renvoyer au gestionnaire d'exception. Cette valeur est stockee dans le -membre public constant @emph{message}. - -Le membre public constant @emph{type} est initialise avec le nom de la -classe, soit @emph{InvalidKeyException}. - -@end itemize - -@end itemize - - -@c ---------------------- -@c ---------------------- -@c ---------------------- - -@node Classe ListIsFullException, Classe NotYetImplementedException, Classe InvalidKeyException, Exceptions -@comment node-name, next, previous, up -@page -@subsubsection ListIsFullException -@findex ListIsFullException - -Cette exception est levee par les methodes de la classe @emph{Versatile} -lorsque la taille maximale de la liste interne est depasse. En general -le nom de l'objet en erreur est inclus dans le message de l'exception. - -Cette exception herite de la classe @emph{GenericException} qui definit -uniquement un constructeur et deux membres publics constants : @emph{type} et -@emph{message}. @xref{Classe GenericException}. - -@itemize @bullet{} -@item Entete - -@example -class ListIsFullException : public GenericException -@{ - public: - // Constructeur - ListIsFullException(string msg = "undefined"); -@}; -@end example - - -@item Methodes -@itemize @minus{} -@item -@b{ListIsFullException(string msg = "undefined")} - -Ce contructeur prend la chaine @emph{msg} comme message d'erreur a -renvoyer au gestionnaire d'exception. Cette valeur est stockee dans le -membre public constant @emph{message}. - -Le membre public constant @emph{type} est initialise avec le nom de la -classe, soit @emph{ListIsFullException}. - -@end itemize - -@end itemize - - - -@c ---------------------- -@c ---------------------- -@c ---------------------- - -@node Classe NotYetImplementedException, Classe RunTimeException, Classe ListIsFullException, Exceptions -@comment node-name, next, previous, up -@page -@subsubsection NotYetImplementedException -@findex NotYetImplementedException - -Cette exception est levee par les classes de la bibliotheque lorsqu'une -methode declaree mais non encore implementee est utilisee. En general -le nom de l'objet en erreur est inclus dans le message de l'exception. - -Cette exception herite de la classe @emph{GenericException} qui definit -uniquement un constructeur et deux membres publics constants : @emph{type} et -@emph{message}. @xref{Classe GenericException}. - -@itemize @bullet{} -@item Entete - -@example -class NotYetImplementedException : public GenericException -@{ - public: - // Constructeur - NotYetImplementedException(string msg = "undefined"); -@}; -@end example - - -@item Methodes -@itemize @minus{} -@item -@b{NotYetImplementedException(string msg = "undefined")} - -Ce contructeur prend la chaine @emph{msg} comme message d'erreur a -renvoyer au gestionnaire d'exception. Cette valeur est stockee dans le -membre public constant @emph{message}. - -Le membre public constant @emph{type} est initialise avec le nom de la -classe, soit @emph{NotYetImplementedException}. - -@end itemize - -@end itemize - - - -@c ---------------------- -@c ---------------------- -@c ---------------------- - -@node Classe RunTimeException, Classe TypeMismatchException, Classe NotYetImplementedException, Exceptions -@comment node-name, next, previous, up -@page -@subsubsection RunTimeException -@findex RunTimeException - -Cette exception est levee par les classes de la bibliotheque lorsqu'une -erreur inconnue et imprevue apparait. Cette exception est le -comportement par defaut que doit gerer le gestionnaire d'exception en ce -qui concerne les classes de la bibliotheque. En general le nom de -l'objet en erreur est inclus dans le message de l'exception. - -Cette exception herite de la classe @emph{GenericException} qui definit -uniquement un constructeur et deux membres publics constants : @emph{type} et -@emph{message}. @xref{Classe GenericException}. - -@itemize @bullet{} -@item Entete - -@example -class RunTimeException : public GenericException -@{ - public: - // Constructeur - RunTimeException(string msg = "undefined"); -@}; -@end example - - -@item Methodes -@itemize @minus{} -@item -@b{RunTimeException(string msg = "undefined")} - -Ce contructeur prend la chaine @emph{msg} comme message d'erreur a -renvoyer au gestionnaire d'exception. Cette valeur est stockee dans le -membre public constant @emph{message}. - -Le membre public constant @emph{type} est initialise avec le nom de la -classe, soit @emph{RunTimeException}. - -@end itemize - -@end itemize - - - -@c ---------------------- -@c ---------------------- -@c ---------------------- - -@node Classe TypeMismatchException, Classes specifiques, Classe RunTimeException, Exceptions -@comment node-name, next, previous, up -@page -@subsubsection TypeMismatchException -@findex TypeMismatchException - -Cette exception est levee par les methodes de la classe @emph{Versatile} -lorsque qu'une erreur de type est rencontree dans un objet. Ce genre -d'erreur survient lorsqu'on essaie d'affecter une valeur d'un type -different du type interne de l'objet @emph{Versatile} a ce meme objet, -ou bien lorsqu'on ajoute une valeur d'un type different a une liste. En -general le nom de l'objet en erreur est inclus dans le message de -l'exception. - -Cette exception herite de la classe @emph{GenericException} qui definit -uniquement un constructeur et deux membres publics constants : @emph{type} et -@emph{message}. @xref{Classe GenericException}. - -@itemize @bullet{} -@item Entete - -@example -class TypeMismatchException : public GenericException -@{ - public: - // Constructeur - TypeMismatchException(string msg = "undefined"); -@}; -@end example - - -@item Methodes -@itemize @minus{} -@item -@b{TypeMismatchException(string msg = "undefined")} - -Ce contructeur prend la chaine @emph{msg} comme message d'erreur a -renvoyer au gestionnaire d'exception. Cette valeur est stockee dans le -membre public constant @emph{message}. - -Le membre public constant @emph{type} est initialise avec le nom de la -classe, soit @emph{TypeMismatchException}. - -@end itemize - -@end itemize - - - - -@c ---------------------- -@c ---------------------- -@c ---------------------- - -@node Classes specifiques, Classes PBS, Classe TypeMismatchException, Classes -@comment node-name, next, previous, up -@page -@section Classes specifiques -@cindex classes specifiques - -Afin de pouvoir se connecter aux gestionnaires de batch reels a travers -leurs API, les classes generiques ont ete derivees pour offrir une -implementation correspondant a l'interface qu'elles definissent. - -Pour traduire a la fois le fait que les nouvelles classes derivent d'une -classe generique et qu'elles sont une implementation d'une API -particuliere, on adopte la convention de nom suivante : la classe se -nomme comme sa classe generique mais est suffixee par le nom de l'API du -gestionnaire de batch, les deux termes etant separes par un caractere -@kbd{_} (souligne). - -Actuellement, seul le gestionnaire de batch OpenPBS, @xref{Prerequis}, est -supporte. Mais ce catalogue devrait s'enrichir par la suite. - -Les classes de la bibliotheque sont egalement accessibles a travers un -interpreteur Python, ce qui a necessite la creation de certaines classes -d'interface avec l'interpreteur. - -@menu -* Classes PBS:: Classes d'implementation pour OpenPBS -* Classes Python:: Classes d'interfacage avec Python. -@end menu - -@c ---------------------- -@c ---------------------- -@c ---------------------- - -@node Classes PBS, Classe FactBatchManager_PBS, Classes specifiques, Classes specifiques -@comment node-name, next, previous, up -@page -@subsection Classes PBS -@cindex classes PBS - -Actuellement seules les classes @emph{BatchManager}, @emph{JobInfo} et -@emph{Job} ont besoin d'etre derivees pour implementer la communication -et l'interfacage avec l'API du gestionnaire de batch OpenPBS. - - -@menu -* Classe FactBatchManager_PBS:: Description de la classe FactBatchManager_PBS. -* Classe BatchManager_PBS:: Description de la classe BatchManager_PBS. -* Classe JobInfo_PBS:: Description de la classe JobInfo_PBS. -* Classe Job_PBS:: Description de la classe Job_PBS. -@end menu - - -@node Classe FactBatchManager_PBS, Classe BatchManager_PBS, Classes PBS, Classes PBS -@comment node-name, next, previous, up -@subsubsection FactBatchManager_PBS -@cindex FactBatchManager_PBS - -Cette classe derive de la classe generique @emph{FactBatchManager}, -@xref{Classe FactBatchManager}. - -Les objets de la classe @emph{BatchManager_PBS} realisent l'interface de -la bibliotheque avec l'API du gestionnaire de batch OpenPBS. - -@itemize @bullet{} -@item Entete - -@example -class FactBatchManager_PBS : public FactBatchManager -@{ -public: - // Constructeur et destructeur - FactBatchManager_PBS(); - virtual ~FactBatchManager_PBS(); - - virtual BatchManager_PBS * operator() (const char * hostname) const; - -protected: - -private: - -@}; -@end example - -@item Exemple - -@example -@dots{} - -// On instancie le catalogue de gestionnaires de batch -Batch::BatchManagerCatalog cata; - -// On cree une fabrique de BatchManager de type PBS -Batch::FactBatchManager & fbm = * cata("PBS"); - -@dots{} -@end example - -@item Methodes -@itemize @minus{} -@item -@b{FactBatchManager_PBS()} - -Ce constructeur instancie un objet de la classe -@emph{FactBatchManager_PBS} et l'enregistre automatiquement aupres du -catalogue de fabrique. @xref{Classe BatchManagerCatalog}. - -Le type est positionne a la valeur PBS. - -@item -@b{~FactBatchManager_PBS()} - -Le destructeur ne fait rien de particulier. - -@item -@b{BatchManager_PBS * operator() (const char * hostname) const} - -Cet operateur renvoie un objet nouvellement cree de type -@emph{BatchManager_PBS} derivant de @emph{BatchManager} et oeuvrant sur -la machine @emph{hostname}. La destruction de l'objet est a la charge de -l'appelant. - -@end itemize - -@end itemize - -@c ---------------------- -@c ---------------------- -@c ---------------------- - -@node Classe BatchManager_PBS, Classe JobInfo_PBS, Classe FactBatchManager_PBS, Classes PBS -@comment node-name, next, previous, up -@page -@subsubsection BatchManager_PBS -@cindex BatchManager_PBS - -Cette classe derive de la classe generique @emph{BatchManager}, -@xref{Classe BatchManager}. - -Les objets de la classe @emph{BatchManager_PBS} realisent l'interface de -la bibliotheque avec l'API du gestionnaire de batch OpenPBS. - -@itemize @bullet{} -@item Entete - -@example -class BatchManager_PBS : public BatchManager -@{ - public: - // Constructeur et destructeur - BatchManager_PBS(FactBatchManager * parent, - const char * host) throw(InvalidArgumentException); - virtual ~BatchManager_PBS(); - - // Recupere le nom du serveur par defaut - static string getDefaultServer(); - - // Recupere le l'identifiant d'un job deja soumis au BatchManager - virtual const JobId getJobIdByReference(const string & ref); - - // Methodes pour le controle des jobs : virtuelles pures - // soumet un job au gestionnaire - virtual const JobId submitJob(const Job & job); - - // retire un job du gestionnaire - virtual void deleteJob(const JobId & jobid); - - // suspend un job en file d'attente - virtual void holdJob(const JobId & jobid); - - // relache un job suspendu - virtual void releaseJob(const JobId & jobid); - - // modifie un job en file d'attente - virtual void alterJob(const JobId & jobid, - const Parametre & param, - const Environnement & env); - virtual void alterJob(const JobId & jobid, - const Parametre & param); - virtual void alterJob(const JobId & jobid, - const Environnement & env); - - // renvoie l'etat du job - virtual JobInfo queryJob(const JobId & jobid); - - // modifie un job en file d'attente - virtual void setParametre(const JobId & jobid, - const Parametre & param); - virtual void setEnvironnement(const JobId & jobid, - const Environnement & env); - - protected: - string _hostname; // serveur ou tourne le BatchManager - - private: - -@}; -@end example - -@item Exemple - -@example -@dots{} - -// On instancie le catalogue de gestionnaires de batch -Batch::BatchManagerCatalog cata; - -// On cree une fabrique de BatchManager de type PBS -Batch::BatchManager & myBM = (* cata("PBS"))("serveur.domaine.fr") - -// Maintenant, on peut utiliser toutes les fonctionnalites du -// gestionnaire de batch a travers le variable myBM - -@dots{} -@end example - -@item Methodes -@itemize @minus{} -@item -@b{BatchManager_PBS(FactBatchManager * parent, -const char * host) throw(InvalidArgumentException)} - -Excepte un pointeur sur la fabrique qui a produit l'objet, le -constructeur accepte zero ou un argument de type @emph{string} decrivant -soit le nom de domaine completement qualifie (FQDN, @i{fully qualified -domain name}) du serveur de batch, soit son adresse IP dans un format -decimal "aaa.bbb.ccc.ddd". - -Si aucun parametre n'est passe au constructeur, celui-ci prend le -serveur par defaut tel que renvoye par la methode @emph{getDefaultServer}. - -Une resolution du nom ou de l'adresse peut etre realisee en fonction des -capacites de la plate-forme pour s'assurer que le serveur est connu et -joignable. En cas d'echec, une exception InvalidArgumentException est -levee. @xref{Classe InvalidArgumentException}. - -Ceci fait, une connexion est etablie avec le gestionnaire de batch qui -est maintenue jusqu'a destruction de l'objet. - -@item -@b{~BatchManager()} - -Le destructeur supprime la connexion precedemment etablie par le -constructeur lorsque celle-ci a reussi. - -@item -@b{const JobId submitJob(const Job & job)} - -Cette methode soumet le job passe en argument au gestionnaire de -batch. Etant donne que le job ne peut pas etre envoye tel quel puisqu'il -a un format generique au sein de la bibliotheque de classes Batch, cette -methode est chargee de le convertir dans un format adapte au -gestionnaire de batch sous-jacent. - -La methode opere ici une conversion du job de la classe @emph{Job} en @emph{Job_PBS}. - -Ce n'est que lorsque cette conversion est realisee que le job est soumis -au gestionnaire a travers son API. L'identifiant propose par le -gestionnaire est alors renvoye a l'appelant. Si la soumission echoue -pour une raison ou une autre, une exception APIInternalFailureException est -levee. @xref{Classe APIInternalFailureException}. - -@item -@b{void deleteJob(const JobId & jobid)} - -Cette methode retire le job dont l'identifiant est passe en argument de -la file d'attente du gestionnaire, ou bien l'arrete en cours -d'execution. Cette methode est inoperante sur des travaux deja termines, -auquel cas une exception APIInternalFailureException est -levee. @xref{Classe APIInternalFailureException}. - - -@item -@b{void holdJob(const JobId & jobid)} - -Cette methode suspend le job dont l'identifiant est passe en argument au -sein de la file d'attente du gestionnaire. Cette methode est inoperante -sur des travaux en cours d'execution ou deja termines, ainsi que sur des -travaux deja suspendus. -En cas de probleme, une exception APIInternalFailureException est -levee. @xref{Classe APIInternalFailureException}. - -@item -@b{void releaseJob(const JobId & jobid)} - -Cette methode relache un job precedemment suspendu en file -d'attente dont l'identifiant est passe en argument. Elle est inoperante -sur des travaux deja reclaches, en cours d'execution ou termines. -En cas de probleme, une exception APIInternalFailureException est -levee. @xref{Classe APIInternalFailureException}. - - -@item -@b{void alterJob(const JobId & jobid, const Parametre & param, const Environnement & env)@* -void alterJob(const JobId & jobid, const Parametre & param)@* -void alterJob(const JobId & jobid, const Environnement & env)} - -Ces methodes permettent de modifier les parametres d'execution et -d'environnement d'un job dont l'identifiant est passe en -argument. @xref{Classe Parametre}. @xref{Classe Environnement}. Il -est important de noter que le job doit etre encore place en file -d'attente sinon la methode est inoperante. -En cas de probleme, une exception APIInternalFailureException est -levee. @xref{Classe APIInternalFailureException}. - -@item -@b{JobInfo queryJob(const JobId & jobid)} - -Cette methode permet de recuperer les informations concernant le job -dont l'identifiant est passe en argument dans un objet de classe -@emph{JobInfo}. @xref{Classe JobInfo}. On y retrouve les parametres -d'execution et d'environnement du job tels qu'ils ont ete passes au -gestionnaire au moment de la soumission, ainsi que des informations -concernant l'execution du job comme par exemple la machine d'execution, -le temps consomme, la memoire consommee, etc. - -Il n'est pas toujours possible d'interroger un job deja termine. -En cas de probleme, une exception APIInternalFailureException est -levee. @xref{Classe APIInternalFailureException}. - - -@item -@b{const JobId getJobIdByReference(const string & ref)} - -Cette methode permet de recuperer au sein de la classe un identifiant de -job a partir d'une chaine de caracteres obtenue par un biais -externe. Cet identifiant pourra etre utilise par la suite au sein de la -biliotheque de classes pour controler le job comme s'il avait ete cree -et soumis depuis la biliotheque-meme. - -@item -@b{void setParametre(const JobId & jobid, const Parametre & param)} - -Cette methode n'est utile que pour l'interfacage avec Python, car Python -ne sait pas gerer la surcharge de methode, et de fait leve des -exceptions lors d'appels a de telles methodes. - -Elle est equivalente a la methode @samp{void alterJob(const JobId & jobid, const Parametre & param)}. - -@item -@b{void setEnvironnement(const JobId & jobid, const Environnement & env)} - -Cette methode n'est utile que pour l'interfacage avec Python, car Python -ne sait pas gerer la surcharge de methode, et de fait leve des -exceptions lors d'appels a de telles methodes. - -Elle est equivalente a la methode @samp{void alterJob(const JobId & jobid, const Environnement & env)}. - -@end itemize - - -@end itemize - -@c ---------------------- -@c ---------------------- -@c ---------------------- - - -@node Classe JobInfo_PBS, Classe Job_PBS, Classe BatchManager_PBS, Classes PBS -@comment node-name, next, previous, up -@page -@subsubsection JobInfo_PBS -@cindex JobInfo_PBS - -Un objet de classe @emph{JobInfo} represente l'ensemble des informations -disponibles sur un travail actif, c'est-a-dire soumis au gestionnaire de -batch, a un instant donne. - -Cet objet reprend des informations issues du job tel qu'il a ete soumis, -@xref{Classe Job}, mais aussi des informations produites par le -gestionnaire de batch a partir de la soumission et du transit du job en -son sein : nom de la queue dans laquelle le job est inscrit, duree -d'execution, date de soumission, etc. - -Ces informations sont disponibles aupres de l'utilisateur de la classe a -travers les objets @emph{Parametre} et @emph{Environnement} que l'objet -@emph{JobInfo} peut fournir. - -@itemize @bullet{} -@item Entete - -@example -class JobInfo_PBS : public JobInfo -@{ - public: - // Constructeur standard et destructeur - JobInfo_PBS(); - JobInfo_PBS(struct batch_status * stat_list, - bool tobedeleted = false); - virtual ~JobInfo_PBS(); - - // Constructeur par recopie - JobInfo_PBS(const JobInfo_PBS & jinfo); - - // Methodes pour l'interfacage avec Python (SWIG) - string __str__() const; // SWIG : affichage en Python - string __repr__() const; // SWIG : affichage en Python - - protected: - Parametre _param; // parametres du job - Environnement _env; // variables d'environnement du job - - private: -@}; -@end example - - -@item Exemple -@example -@dots{} (ici on cree un BatchManager bm et un Job job) - -// On soumet le job et on recupere un identifiant -JobId jobid = bm.submitJob(job); - -// Ce qui permet d'interroger l'etat du job en cours -// Nota : l'objet retourne est un JobInfo_PBS -JobInfo jinfo = jobid.queryJob(); - -@dots{} -@end example - -@item Methodes -@itemize @minus{} -@item -@b{JobInfo_PBS()} - -Ce constructeur cree un objet @emph{JobInfo_PBS} vide. - -@item -@b{~JobInfo_PBS()} - -Le destructeur libere l'espace memoire alloue pour l'objet si la -desollacation n'a pas eu deja lieu dans le constructeur. - -@item -@b{JobInfo_PBS(const JobInfo_PBS & jinfo)} - -Le constructeur par recopie produit un objet identique a celui passe en -argument. Les deux objets sont totalement independants l'un de l'autre. - -@item -@b{JobInfo_PBS(struct batch_status * stat_list, bool tobedeleted = false)} - -Ce constructeur recupere une liste chainee du type interne OpenPBS -@emph{struct batch_status *}, la parcoure et l'analyse pour en extraire -les informations utilisables par la bibliotheque de classes et les -stocker dans deux objets internes @emph{Parametre} et -@emph{Environnement}. - -Si le parametre @emph{tobedeleted} vaut @emph{true} alors la liste -chainee @emph{stat_list} sera desallouee a la fin du constructeur. Sinon -elle sera desalloue dans le destructeur au plus tard. - -@item -@b{string __str__() const} - -Cette methode n'est utile que pour l'interfacage avec Python. Elle -permet d'afficher l'etat de l'objet @emph{JobInfo}. - -@item -@b{string __repr__() const} - -Cette methode n'est utile que pour l'interfacage avec Python. Elle -permet d'afficher l'etat de l'objet @emph{JobInfo}. - -@end itemize - -@end itemize - - -@c ---------------------- -@c ---------------------- -@c ---------------------- - - -@node Classe Job_PBS, Classes Python, Classe JobInfo_PBS, Classes PBS -@comment node-name, next, previous, up -@page -@subsubsection Job_PBS -@cindex Job_PBS - -Un objet de classe @emph{Job} possede une structure generique -potentiellement utilisable par tout gestionnaire de batch mais pas en -l'etat. Une conversion dans un format lisible par le gestionnaire doit -etre realisee. - -Ceci se fait en produisant a partir des donnees generiques de la classe -@emph{Job} des structures de donnees specifiques qui peuvent etre -directement passees a l'API du gestionnaire. - -La classe @emph{Job_PBS} se distingue donc de la classe @emph{Job} par son -constructeur et par des accesseurs specifiques qui produisent des -donnees lisibles par OpenPBS. - -Etant donnee la specificite de cette classe, elle ne devrait concerner -que les developpeurs de la bibliotheque de classes Batch. - -@itemize @bullet{} -@item Entete - -@example -class Job_PBS -@{ - public: - // Constructeurs et destructeur - Job_PBS(const Job & job); - virtual ~Job_PBS(); - - // Accesseurs - struct attropl * getAttributesOP(); - struct attrl * getAttributes(); - char * getScript(); - char * getDestination(); - - protected: - struct attropl * _p_attropl; // liste d'attributs + operateur - struct attrl * _p_attrl; // liste d'attributs - char * _script; // chemin d'acces au script du job - char * _destination; // queue dans laquelle le job est soumis - - private: - -@}; -@end example - - -@item Exemple -@example -@dots{} - -Parametre param; -Environnement env; - -@dots{} (ici on cree les parametres du job) - -Job job(param, env); - -// On fabrique un job specifique a OpenPBS a partir du job generique -// Ceci ne concerne en general pas l'utilisateur de la bibliotheque -Job_PBS jobpbs(job); - -@dots{} -@end example - -@item Methodes -@itemize @minus{} - -@item -@b{Job_PBS(const Job & job)} - -Le constructeur convertit les objets internes @emph{Parametre} et -@emph{Environnement} de l'objet passe en argument en un ensemble de -quatre structures C @emph{AttributesOP}, @emph{Attributes}, -@emph{Script} et @emph{Destination} directement utilisable par l'API de -OpenPBS. - -@item -@b{~Job_PBS()} - -Le destructeur libere simplement les espaces alloues pour les structures -@emph{AttributesOP}, @emph{Attributes}, @emph{Script} et -@emph{Destination}. - -@item -@b{struct attropl * getAttributesOP()} - -Cet accesseur retourne un pointeur sur la structure interne -@emph{AttributesOP} de l'objet. Cette structure n'est pas protogee -contre les modifications accidentelles de l'utilisateur. Par consequent -il est recommande d'eviter d'y apporter toute alteration sous peine de -dysfonctionnement. - -Pour la definition de la structure @emph{AttributesOP}, voir la -documentation OpenPBS. - -@item -@b{struct attrl * getAttributes()} - -Cet accesseur retourne un pointeur sur la structure interne -@emph{Attributes} de l'objet. Cette structure n'est pas protogee -contre les modifications accidentelles de l'utilisateur. Par consequent -il est recommande d'eviter d'y apporter toute alteration sous peine de -dysfonctionnement. - -Pour la definition de la structure @emph{Attributes}, voir la -documentation OpenPBS. - -@item -@b{char * getScript()} - -Cet accesseur retourne un parametre @emph{Script} qui est une chaine de -caracteres C contenant le chemin absolu (sur la machine d'execution) -du script a soumettre au gestionnaire de batch. - -Cette chaine n'est pas protegee contre les modifications accidentelles -de l'utilisateur. Il est donc recommande de ne pas y apporter de modification. - -@item -@b{char * getDestination()} - -Cet accesseur retourne un parametre @emph{Destination} qui est une chaine de -caracteres C contenant le nom de la queue, ou classe ou file selon les terminologies, -du gestionnaire de batch dans laquelle le job doit etre soumis. - -Cette chaine n'est pas protegee contre les modifications accidentelles -de l'utilisateur. Il est donc recommande de ne pas y apporter de modification. - - -@end itemize -@end itemize - - -@c ---------------------- -@c ---------------------- -@c ---------------------- - -@node Classes Python, Classe PyVersatile, Classe Job_PBS, Classes specifiques -@comment node-name, next, previous, up -@page -@subsection Classes Python -@cindex classes Python - -L'integration de la bibliotheque de classes Batch dans l'interpreteur -Python a beaucoup progresse depuis la precedente version et se trouve -etre quasiment iso-fonctionelle avec le C++. - -Actuellement, l'interface avec Python s'appuie a la fois sur les -fonctionnalites de l'utilitaire SWIG, et sur la definition d'une classe -specifique qui permet de voir en Python la classe @emph{Versatile}. - -Certaines classes ont de plus des methodes specifiques pour le wrapping -Python qui simplifient grandement le developpement des classes -d'interface au detriment, il est vrai, d'une bonne independance entre -les langages. Ce choix n'est pas definitif et pourra etre revu si -l'occasion s'en presente. - -Quoi qu'il en soit toutes les classes de haut niveau sont interfacees en -Python sous le meme nom et proposent les memes methodes (sauf celles -surchargees en C++ qui sot parfois renommees pour lever -l'ambiguite). Pour ne pas refaire un expose detaille et fastidieux des -fonctionnalites Python de la bibliotheque de classes, il est propose de -retrouver les noms et la syntaxe de ces classe dans la partie -Utilisation de ce document. @xref{Utilisation}. - -@menu -* Classe PyVersatile:: Description de la classe PyVersatile. -@end menu - -@c ---------------------- -@c ---------------------- -@c ---------------------- - - -@node Classe PyVersatile, Utilisation, Classes Python, Classes Python -@comment node-name, next, previous, up -@page -@subsubsection PyVersatile -@cindex PyVersatile - - -La classe @emph{PyVersatile} derive de la classe @emph{Versatile} et -offre la possibilite de convertir un tel objet en objet Python et -@i{vice versa}. - - -@itemize @bullet{} -@item Entete - -@example -class PyVersatile : public Versatile -@{ - public: - // Constructeur a partir d'un objet Versatile - PyVersatile(const Versatile &); - - // Constructeur a partir d'un PyObject - PyVersatile(const PyObject *) throw(TypeMismatchException, - ListIsFullException, - InvalidArgumentException); - - // Conversion de type vers un PyObject - operator PyObject *() const; - - // Operateur d'affectation a partir d'un objet Versatile - PyVersatile & operator =(const Versatile &); - - protected: - - private: - -@}; -@end example - - -@item Exemple -@example -@dots{} - -// On cree un objet Versatile contenant -// une liste de chaine de caracteres -Versatile V; -V = "a", "b", "c"; - -// On convertit cet objet Versatile en PyVersatile -PyVersatile PyV(V); - -// De la on produit un objet Python -// qui est une liste de chaine de caracteres -PyObject * PyO = PyV; - -@dots{} -@end example - -@item Methodes -@itemize @minus{} - -@item -@b{PyVersatile(const Versatile &)} - -Ce constructeur convertit un objet @emph{Versatile} en objet @emph{PyVersatile}. - -@item -@b{PyVersatile(const PyObject *) throw(TypeMismatchException, ListIsFullException, InvalidArgumentException)} - -Ce constructeur convertit un objet Python passe en argument en un objet -@emph{PyVersatile}. - -Seuls certains objets Python peuvent etre convertis : les @emph{string} -et les @emph{long}, ainsi que les listes homogenes de ces types, ce qui -est coherent avec la nature de l'objet @emph{Versatile}. Si tel n'est -pas le cas, une exception Python est renvoyee a l'interpreteur. - - -@item -@b{operator PyObject *() const} - -Cet operateur convertit l'objet en objet Python. Selon le cas, l'objet -retourne est soit un scalaire soit une liste. L'objet retourne est -alloue dynamiquement et doit donc etre pris en charge par l'interpreteur. - -@item -@b{PyVersatile & operator =(const Versatile &)} - -L'affectation d'un objet @emph{Versatile} passe en argument est -similaire a l'affectation entre objets @emph{Versatile}. Les structures -de donnees internes initiales de l'objet sont effacees et remplacees par -une copie des donnees internes de l'objet passe en argument. Les deux -objets restent independants l'un de l'autre a l'issue de l'affectation. - -@end itemize -@end itemize - - - - -@c ---------------------- -@c ---------------------- -@c ---------------------- - -@node Utilisation, Connexion, Classe PyVersatile, Top -@comment node-name, next, previous, up -@page -@chapter Utilisation -@cindex utilisation - -Ce chapitre presente les differentes actions qu'il est possible de -realiser avec les classes de la bilbiotheque. - -On presente un cas hypothetique ou un utilisateur voudrait soumettre et -controler un job depuis un code C++. Les sections suivantes decrivent -les operations a faire ainsi que leur action sur le travail soumis. - -@menu -* Connexion:: Creation d'un gestionnaire de batch. -* Creation:: Declaration d'un job (travail). -* Soumission:: Demande d'execution du job. -* Interrogation:: Recuperation des informations sur le job. -* Destruction:: Arret du job en cours. -* Suspension:: Suspension du job en file d'attente. -* Reprise:: Liberation du job en file d'attente. -* Modification:: Modification d'un job en file d'attente. -@end menu - - -@c ---------------------- -@c ---------------------- -@c ---------------------- - -@node Connexion, Creation, Utilisation, Utilisation -@comment node-name, next, previous, up -@section Connexion -@cindex connexion -@cindex deconnexion - -La premiere etape avant toute utilisation pratique des classes de la -bibliotheque consiste a se connecter a un gestionnaire de batch. - -Ce concept de connexion est purement interne a la bibliotheque car il -est tout a fait possible d'imaginer le controle de jobs a travers l'API -d'un gestionnaire sans jamais etablir ni maintenir une quelconque -connexion avec celui-ci. D'autres par contre reclament l'etablissement -d'une connexion. - -Quoiqu'il en soit ceci n'est pas genant et l'etablissement et le -maintien de la connexion avec le gestionnaire de batch se fait par la -creation d'un objet de classe @emph{BatchManager} ou d'une classe -derivee. - -En pratique, la classe @emph{BatchManager} se comporte comme une -interface et seules les classes d'implementation derivee doivent etre -instanciees. - -Si l'on prend le cas d'un serveur @samp{serveur.domaine.fr} supportant -un gestionnaire de batch OpenPBS, on peut s'y connecter de la maniere -suivante : - -@itemize @bullet{} -@item Exemple C++ : - -@example -BatchManagerCatalog cata; -BatchManager_PBS & bm = * (* cata('PBS'))("serveur.domaine.fr"); -@end example - -@item Exemple Python: - -@example -cata = BatchManagerCatalog() -bm = cata('PBS')('serveur.domaine.fr') -@end example - -@end itemize - -Tant que l'objet @emph{bm} sera present --- tant que son destructeur -n'aura pas ete appele --- la connexion sera maintenue. La deconnexion -aura lieu a la destruction de l'objet. - -@xref{Classe BatchManager}. -@xref{Classe BatchManager_PBS}. - - -@c ---------------------- -@c ---------------------- -@c ---------------------- - -@node Creation, Soumission, Connexion, Utilisation -@comment node-name, next, previous, up -@section Creation -@cindex creation - -La creation du job est l'etape qui precede toute soumission. Elle -necessite de decrire d'un maniere ou d'un autre ce que l'on va demander -a la machine d'executer. - -Pour cela on passe par deux objets intermediaires qui sont l'objet -@emph{Parametre} et l'objet @emph{Environnement}. - -Le minimum a preciser est en general le chemin absolu d'acces a -l'executable, quoique ceci depende fortement de la configuration du -gestionnaire auquel on se connecte. Celui-ci peut reclamer des -parametres supplementaires. - -Pour connaitre l'ensemble des parametres disponibles : @xref{Classe -Parametre}. - -On supposera dans cet exemple que l'application en question sait -reconnaitre une variable d'environnement @var{myapp_loglevel} qui prend -une valeur numerique correspondant au niveau d'information affiche en -sortie. - -Cette application imaginaire utilise egalement trois fichiers : - -@itemize @bullet{} -@item -un fichier d'entree nomme @file{Cas1.data} sur la machine locale qu'il -faudra renommer @file{fort.9} pour que l'application puisse le lire -(notre application imaginaire est ecrite en FORTRAN et attend un fichier -d'entree sur son descripteur 9); - -@item -un fichier de sortie standard que l'on voudra recuperer sous le nom -@file{Cas1.out}; - -@item -un fichier d'erreur standard que l'on voudra recuperer sous le nom -@file{Cas1.err}. - -@end itemize - -Le job est ensuite cree simplement a l'aide des deux objets precedents. - -@itemize @bullet{} -@item Exemple C++ : - -@example -Parametre param; -param[EXECUTABLE] = "/home/user/my_app/bin/exec_app.sh"; -param[INFILE] = Couple("/home/user/my_app/data/Cas1.data","fort.9"); -param[OUTFILE] = Couple("/home/user/my_app/data/Cas1.out", "stdout"), - Couple("/home/user/my_app/data/Cas1.err", "stderr"); - -Environnement env; -env["MYAPP_LOGLEVEL"] = "3"; - -Job job(param, env); -@end example - -@item Exemple Python: - -@example -param = @{@} -param["EXECUTABLE"] = "/home/user/my_app/bin/exec_app.sh" -param["INFILE"] = [ ("/home/user/my_app/data/Cas1.data","fort.9") ] -param["OUTFILE"] = [ ("/home/user/my_app/data/Cas1.out", "stdout"), - ("/home/user/my_app/data/Cas1.err", "stderr") ] - -env = @{@} -env["MYAPP_LOGLEVEL"] = "3" - -job = Job() -job.setParametre(param) -job.setEnvironnement(env) -@end example - -@end itemize - - -@xref{Classe Parametre}. -@xref{Classe Environnement}. -@xref{Classe Job}. - - -@c ---------------------- -@c ---------------------- -@c ---------------------- - -@node Soumission, Interrogation, Creation, Utilisation -@comment node-name, next, previous, up -@section Soumission -@cindex soumission -@findex submitJob - -Une fois le job cree, il est alors tres simple de le soumettre au -gestionnaire de batch en passant par l'intermediaire de l'objet -@emph{BatchManager} cree precedemment. - -Cette soumission produira un objet @emph{JobId} qui servira a controler -le job par la suite. - -Cependant des exceptions peuvent etre levees au moment de la soumission -et il convient de fournir un gestionnaire d'exception pour gerer -proprement ces incidents. - -@itemize @bullet{} -@item Exemple C++ : - -@example -try @{ - const JobId jobid = bm.submitJob(job); - -@} catch (GenericException & ex) @{ - @dots{} -@} -@end example - -@item Exemple Python: - -@example -try : - jobid = bm.submitJob(job) -except : - @dots{} -@end example - -@end itemize - - -@xref{Classe Job}. -@xref{Classe JobId}. -@xref{Exceptions}. - - -@c ---------------------- -@c ---------------------- -@c ---------------------- - -@node Interrogation, Destruction, Soumission, Utilisation -@comment node-name, next, previous, up -@section Interrogation -@cindex interrogation -@findex queryJob - -La fourniture d'un objet @emph{JobId} permet d'avoir tout controle sur -le job en cours. En particulier il est possible de l'interroger : -ceci generera un objet @emph{JobInfo} qui donnera l'ensemble des -informations disponibles sur l'etat du job aupres du gestionnaire de -batch. - -Ces informations sont disponibles a travers deux objets internes de -classes @emph{Parametre} et @emph{Environnement}, les memes que pour la -classe @emph{Job}, mais modifies et completes avec les donnees les plus -a jour du gestionnaire de batch. - -@itemize @bullet{} -@item Exemple C++ : - -@example -try @{ - const JobInfo jinfo = jobid.queryJob(); - - Parametre newparam = jinfo.getParametre(); - Environnement newenv = jinfo.getEnvironnement(); - -@} catch (GenericException & ex) @{ - @dots{} -@} -@end example - -@item Exemple Python: - -@example -try : - jobinfo = jobid.queryJob() - - newparam = jinfo.getParametre() - newenv = jinfo.getEnvironnement() -except : - @dots{} -@end example - -@end itemize - - -@xref{Classe JobId}. -@xref{Classe JobInfo}. -@xref{Exceptions}. - - - -@c ---------------------- -@c ---------------------- -@c ---------------------- - -@node Destruction, Suspension, Interrogation, Utilisation -@comment node-name, next, previous, up -@section Destruction -@cindex destruction -@cindex suppression -@findex deleteJob - - -Il est possible de detruire un job que celui-ci soit encore en file -d'attente ou bien que son execution ait deja commence, auquel cas elle -serait immediatement interrompue. - - -@itemize @bullet{} -@item Exemple C++ : - -@example -try @{ - jobid.deleteJob(); - -@} catch (GenericException & ex) @{ - @dots{} -@} -@end example - -@item Exemple Python: - -@example -try : - jobid.deleteJob() - -except : - @dots{} -@end example - -@end itemize - - -@xref{Classe JobId}. -@xref{Exceptions}. - - - -@c ---------------------- -@c ---------------------- -@c ---------------------- - -@node Suspension, Reprise, Destruction, Utilisation -@comment node-name, next, previous, up -@section Suspension -@cindex suspension -@findex holdJob - -La suspension consiste a figer en file d'attente un job qui n'aurait pas -encore commence son execution. Il n'est pas possible de suspendre un job -qui s'execute. - -Il y a deux manieres de suspendre un job en file d'attente : -@itemize @bullet{} -@item en utilisant la methode @samp{holdJob}; -@item en modifiant les parametres du job a l'aide de la methode @samp{alterJob}. -@end itemize - -Exemple 1 : - -@itemize @bullet{} -@item Exemple C++ : - -@example -try @{ - jobid.holdJob(); - -@} catch (GenericException & ex) @{ - @dots{} -@} -@end example - -@item Exemple Python: - -@example -try : - jobid.holdJob() - -except : - @dots{} -@end example - -@end itemize - -Exemple 2 : - -@itemize @bullet{} -@item Exemple C++ : - -@example -try @{ - Parametre altparam; - altparam[HOLD] = 1; - jobid.alterJob(altparam); - -@} catch (GenericException & ex) @{ - @dots{} -@} -@end example - -@item Exemple Python: - -@example -// Compte tenu de la surcharge d'operateur, cet exemple peut ne pas -// fonctionner encore -try : - altparam = @{@} - altparam["HOLD"] = 1 - jobid.alterJob(altparam) - -except : - @dots{} -@end example - -@end itemize - - - -@xref{Classe JobId}. -@xref{Exceptions}. -@xref{Reprise}. - -@c ---------------------- -@c ---------------------- -@c ---------------------- - -@node Reprise, Modification, Suspension, Utilisation -@comment node-name, next, previous, up -@section Reprise -@cindex reprise -@findex releaseJob - -La reprise est l'operation inverse de la suspension en ceci qu'elle -libere un job precedemment suspendu en file d'attente. Le job continuera -alors son cheminement normal au sein du gestionnaire de batch. - -Il y a deux manieres de suspendre un job en file d'attente : -@itemize @bullet{} -@item en utilisant la methode @samp{releaseJob}; -@item en modifiant les parametres du job a l'aide de la methode @samp{alterJob}. -@end itemize - -Exemple 1 : - -@itemize @bullet{} -@item Exemple C++ : - -@example -try @{ - jobid.releaseJob(); - -@} catch (GenericException & ex) @{ - @dots{} -@} -@end example - -@item Exemple Python: - -@example -try : - jobid.releaseJob() - -except : - @dots{} -@end example - -@end itemize - -Exemple 2 : - -@itemize @bullet{} -@item Exemple C++ : - -@example -try @{ - Parametre altparam; - altparam[HOLD] = 0; - jobid.alterJob(altparam); - -@} catch (GenericException & ex) @{ - @dots{} -@} -@end example - -@item Exemple Python: - -@example -// Compte tenu de la surcharge d'operateur, cet exemple peut ne pas -// fonctionner encore -try : - altparam = @{@} - altparam["HOLD"] = 0 - jobid.alterJob(altparam) - -except : - @dots{} -@end example - -@end itemize - - -@xref{Classe JobId}. -@xref{Exceptions}. -@xref{Suspension}. - -@c ---------------------- -@c ---------------------- -@c ---------------------- - -@node Modification, Installation de la bibliotheque, Reprise, Utilisation -@comment node-name, next, previous, up -@section Modification -@cindex modification -@findex alterJob - -Il est possible de modifier tout ou partie des parametres et des -variables d'un job a condition que celui-ci soit encore en file -d'attente. Un job dont l'execution a deja debute devient inalterable, -sauf a l'arreter definitvement. - -La modification se fait en declarant un objet @emph{Parametre} et/ou un -objet @emph{Environnement} contenant l'ensemble des alterations a -apporter a la description du job. Ces alterations peuvent porter sur des -parametres ou des variables deja definies ou non. - -En reprenant le cas du job imaginaire utilise jusqu'ici, on peut -souhaiter changer le script qui tient lieu d'executable car le precedent -etait incomplet, modifier le niveau d'affichage de la log et ajouter une -variable nommee @var{myapp_debug} qui indique au code de passer en mode -debug. Ceci pourrait se faire de la maniere suivante : - -@itemize @bullet{} -@item Exemple C++ : - -@example -try @{ - Parametre altparam; - altparam[EXECUTABLE] = "/home/user/my_app/bin/exec_app.sh"; - - Environnement altenv; - altenv["MYAPP_LOGLEVEL"] = "4"; - altenv["MYAPP_DEBUG"] = "1"; - jobid.alterJob(altparam, altenv); - -@} catch (GenericException & ex) @{ - @dots{} -@} -@end example - -@item Exemple Python: - -@example -// Compte tenu de la surcharge d'operateur, cet exemple peut ne pas -// fonctionner encore -try : - altparam = @{@} - altparam["EXECUTABLE"] = "/home/user/my_app/bin/exec_app.sh" - - altenv = @{@} - altenv["MYAPP_LOGLEVEL"] = "4"; - altenv["MYAPP_DEBUG"] = "1"; - - jobid.alterJob(altparam, altenv) - -except : - @dots{} -@end example - -@end itemize - - -@xref{Classe JobId}. -@xref{Exceptions}. - -@c ---------------------- -@c ---------------------- -@c ---------------------- - -@node Installation de la bibliotheque, Prerequis, Modification, Top -@comment node-name, next, previous, up -@chapter Installation -@cindex installation - -Cette section montre comment installer l'ensemble de la bibliotheque de -classes Batch sur une machine Unix. - -@menu -* Prerequis:: -* Installation rapide:: -* Configuration:: -* Compilation:: -* Compilation de la documentation:: -* Tests:: -* Installation:: -@end menu - - - -@c ---------------------- -@c ---------------------- -@c ---------------------- - -@node Prerequis, Installation rapide, Installation de la bibliotheque, Installation de la bibliotheque -@comment node-name, next, previous, up -@section Prerequis -@cindex prerequis - -@unnumberedsubsec GCC/G++ - -A l'heure actuelle, la bibliotheque de classes Batch est developpee en -C++ et necessite de fait un compilateur pour ce langage. GCC/G++ -version 2.95.3 (@inforef{Top, ,gcc} pour plus de detail) ou une version -ulterieure est un choix judicieux. - -@unnumberedsubsec Gestionnaires de batch - -Comme la bibliotheque utilise les fonctionnalites de certains -gestionnaires de batch, il est indispensable de pouvoir acceder aux -bibliotheques et aux fichiers d'entete de ces produits, ou du moins des -produits dont on se servira par la suite, ceci pour pouvoir communiquer -a travers l'API qu'ils ont developpe. - -Le cas le plus simple est d'avoir le produit directement installe sur la -machine sur laquelle sera compilee la bibliotheque de classes Batch. - -@unnumberedsubsubsec OpenPBS -@cindex OpenPBS -@cindex PBS - -A ce jour, seul le gestionnaire de batch PBS (OpenPBS et PBS Pro) est -supporte (voir le site officiel @uref{http://www.openpbs.org}). Il doit -avoir une version au moins egale a 2.3.16. - -@unnumberedsubsubsec LSF -@cindex LSF - -Il est prevu d'avoir un support de LSF dans les mois qui viennent. - -@unnumberedsubsubsec LoadLeveler -@cindex LoadLeveler - -Il est prevu d'avoir un support de LoadLeveler mais dans un futur plus -lointain en fonction de la disponibilite du produit mais surtout d'une -machine sur lequel il serait installe. - -@unnumberedsubsubsec Sun Grid Engine - -Ce choix-la est beaucoup plus hypothetique, et risque bien de ne jamais -etre mene a bien. - -@unnumberedsubsubsec Rsh/Ssh - -Il est prevu de simuler le fonctionnement d'un gestionnaire de batch a -l'aide de commandes Unix Rsh et Ssh dans la mesure de leurs capacites -lorsque qu'il n'est pas possible d'avoir un gestionnaire de batch sur -certaines machines ou de s'y connecter (par exemple lorsqu'on traverse -un coupe-feu). - -@unnumberedsubsec Python -@cindex Python - -Les classes de haut-niveau de la bibliotheque de classes Batch disposent -d'une interface en Python qui leur permet d'etre utilisables dans ce -langage. L'usage de cette fonctionnalite necessite d'avoir a disposition -une version de Python (voir le site officiel -@uref{http://www.python.org}) au moins egale a 2.2. - -@unnumberedsubsec SWIG -@cindex SWIG - -De plus l'interfacage avec Python est automatise a l'aide de -l'utilitaire SWIG (voir le site officiel @uref{http://www.swig.org}) qui -transcrit les definitions des classes C++ en classes Python. Il faut -pour cela disposer de la version 1.3.17 ou ulterieure. - - - - -@c ---------------------- -@c ---------------------- -@c ---------------------- - -@node Installation rapide, Configuration, Prerequis, Installation de la bibliotheque -@comment node-name, next, previous, up -@section Installation rapide -@cindex installation rapide - -Il faut commencer par decompresser le fichier @file{.tar.gz} ou -@file{.tgz} et descendre dans le repertoire qu'il a cree : - -@example -$ tar -xzvf Batch-@value{VERSION}.tar.gz -$ cd Batch-@value{VERSION} -@end example - -Pour ceux qui sont vraiment presses, le minimum requis est : - -@example -$ ./configure -$ make -$ make install -@end example - -Pour ceux qui ont le temps de lire la suite, les sections suivantes -decrivent plus en detail ces etapes et les differents tests que l'on -peut mener. - -@c ---------------------- -@c ---------------------- -@c ---------------------- - -@node Configuration, Compilation, Installation rapide, Installation de la bibliotheque -@comment node-name, next, previous, up -@section Configuration -@cindex configuration - -La phase de configuration, tres classique dans le domaine des logiciels -libres, est basee sur les produits autoconf (voir @inforef{Top, -,autoconf}), automake (voir @inforef{Top, ,automake}) et libtool (voir -@inforef{Top, ,libtool}). - -La configuration est faite a l'aide du programme @file{configure} -present dans le repertoire racine de la bibliotheque de classes -Batch. Ce programme analyse l'ensemble des elements du systeme sur -lequel se deroulera la compilation pour determiner les parametres -optimaux et la presence de tous les produits necessaires a la -compilation. - -On n'oubliera pas de se referer a la documentation de @file{configure} -notamment pour determiner l'emplacement definitif de l'installation : - -@example -$ ./configure --help -@end example - -C'est aussi au cours de cette phase de configuration qu'il est -indispensable de preciser avec quelles options la bibliotheque doit etre -generee. En particulier il est necessaire d'indiquer avec quel(s) -gestionnaire(s) de batch doit se faire la compilation de maniere a avoir -acces a l'API. - -Par exemple dans le cas de OpenPBS, il est necessaire de preciser : - -@example -$ ./configure --with-openpbs=/path/to/PBS/root/dir -@end example - -Le chemin @file{/path/to/PBS/root/dir} est optionnel si la variable -d'environnement @var{openpbs} est definie avec cette meme valeur. - -De meme pour Python que l'on indique de la maniere suivante : - -@example -$ ./configure --with-python=/path/to/Python/root/dir -@end example - -ou bien a l'aide de la variable d'environnement @var{pythonhome}. - -@c ---------------------- -@c ---------------------- -@c ---------------------- - -@node Compilation, Compilation de la documentation, Configuration, Installation de la bibliotheque -@comment node-name, next, previous, up -@section Compilation -@cindex compilation - -La compilation proprement dite n'appelle pas de remarque particuliere : - -@example -$ make -@end example - -On n'oubliera pas d'utiliser les focntionnalites de chaque @file{make}, -comme par exemple la compilation parallele pour reduire les temps de -compilation (voir @inforef{Top, ,make}). - -@c ---------------------- -@c ---------------------- -@c ---------------------- - -@node Compilation de la documentation, Tests, Compilation, Installation de la bibliotheque -@comment node-name, next, previous, up -@section Compilation de la documentation -@cindex compilation de la documentation - -Normalement la documentation est automatiquement compilee lors de la -compilation de la bibliotheque, mais uniquement sous la forme d'un -fichier @file{.info}. Il est egalement possible d'obtenir un fichier -@file{.dvi} qui permettra de generer d'autres formats comme le -PostScript (fichier @file{.ps}) ou le PDF (fichier @file{.pdf}), ou bien -une documentation sous forme HTML (fichier @file{.html}). - -Pour fabriquer le fichier @file{.dvi} il faut executer la commande -suivante : - -@example -$ make dvi -@end example - -Il est alors possible de produire une documentation sous forme -PostScript : - -@example -$ cd doc -$ dvips Batch.dvi -o Batch.ps -@end example - -ou PDF : - -@example -$ cd doc -$ dvipdf Batch.dvi Batch.pdf -@end example - -Pour la documentation HTML, on l'obtient a l'aide de le commande -suivante : - -@example -$ cd doc -$ texi2html -split_node Batch.texi -@end example - -@c ---------------------- -@c ---------------------- -@c ---------------------- - -@node Tests, Installation, Compilation de la documentation, Installation de la bibliotheque -@comment node-name, next, previous, up -@section Tests -@cindex tests - -@unnumberedsubsec Tests de pre-installation - -La bibliotheque de classes Batch dispose d'un ensemble de tests -unitaires pour verifier le fonctionnement de chaque classe -individuellement. Ces tests ne sont pas compiles lors de la compilation -de la bibliotheque; ils ne le sont qu'au moment du test. - -Les tests sont executes de la maniere suivante : - -@example -$ make check -@end example - -A la fin des tests, un compte rendu est fait qui avertit l'utilisateur -des tests reussis et des echecs rencontres. Chaque test peut etre rejoue -individuellement en se placant dans le repertoire @file{test} et en -executant les tests manuellement comme par exemple : - -@example -$ cd test -$ ./t_Versatile.sh -@end example - -@unnumberedsubsec Tests de post-installation - -Certains tests ne sont pas executes lorsque la commande @file{make -check} est lancee car ceux-ci necessitent l'installation prealable de -certains fichiers qui ne l'ont pas encore ete, l'installation definitive -n'ayant pas eu lieu encore. C'est pour cela que ces tests ne doivent et -ne peuvent etre lances qu'une fois l'installation terminee. @xref{Installation}. - -Il faut pour cela executer : - -@example -$ make installcheck -@end example - -De la meme maniere que pour les tests de pre-installation, une compte -rendu est fait et les tests defaillants peuvent etre rejoues -manuellement pour determiner le probleme. - -@c ---------------------- -@c ---------------------- -@c ---------------------- - -@node Installation, Divers, Tests, Installation de la bibliotheque -@comment node-name, next, previous, up -@section Installation -@cindex installation - -L'installation est la mise a disposition definitive dans le systeme de -la bibliotheque de classes Batch. C'est la derniere etape de la -procedure apres la configuration et la compilation. - -On l'execute de la maniere suivante : - -@example -$ make install -@end example - -Tous les fichiers compiles, la bibliotheque et les fichiers d'entete -sont installes dans le repertoire definitif. Les fichiers de test de -post-installation sont egalement copies (@xref{Tests}.) ainsi que la -documentation. - - - - - - - - - -@c ---------------------- -@c ---------------------- -@c ---------------------- - -@node Divers, Index, Installation, Top -@comment node-name, next, previous, up -@chapter Divers -@cindex divers - - - - - -@c ---------------------- -@c ---------------------- -@c ---------------------- - -@node Index, Top , Divers, Top -@comment node-name, next, previous, up -@unnumbered Index - -@heading Index des concepts -@printindex cp - -@heading Index des fonctions et des methodes -@printindex fn - -@bye - diff --git a/doc/salome/batch.dox b/doc/salome/batch.dox deleted file mode 100644 index 7e0e4e29b..000000000 --- a/doc/salome/batch.dox +++ /dev/null @@ -1,10 +0,0 @@ -/*! - -\page batch_page Batch - - Batch documentation - -*/ - - - diff --git a/doc/salome/gui/Makefile.am b/doc/salome/gui/Makefile.am index aad10ecc2..4b12d80d3 100644 --- a/doc/salome/gui/Makefile.am +++ b/doc/salome/gui/Makefile.am @@ -1,14 +1,11 @@ include $(top_srcdir)/salome_adm/unix/make_common_starter.am -usr_docs: doxyfile ../Batch.html +usr_docs: doxyfile echo "Running doxygen in directory: "`pwd`; \ - $(DOXYGEN) $< ; \ - cp -rf ../Batch.html KERNEL + $(DOXYGEN) $< ; docs: usr_docs -info_TEXINFOS = ../Batch.texi - install-data-local: usr_docs $(INSTALL) -d $(DESTDIR)$(docdir)/gui cp -rp KERNEL $(DESTDIR)$(docdir)/gui diff --git a/doc/salome/gui/doxyfile.in b/doc/salome/gui/doxyfile.in index b81ddc6ed..a0f94189b 100644 --- a/doc/salome/gui/doxyfile.in +++ b/doc/salome/gui/doxyfile.in @@ -91,7 +91,7 @@ INPUT = \ FILE_PATTERNS = *.dox *.idl *.hxx *.cxx *.py RECURSIVE = YES -EXCLUDE = @top_srcdir@/doc/salome/batch.dox +EXCLUDE = EXCLUDE_SYMLINKS = NO EXCLUDE_PATTERNS = EXAMPLE_PATH = @top_srcdir@/doc/salome/examples diff --git a/doc/salome/main.dox b/doc/salome/main.dox index 7861f0e77..34311ed4f 100644 --- a/doc/salome/main.dox +++ b/doc/salome/main.dox @@ -55,7 +55,6 @@ - \subpage kernel_salome - \subpage dsc_page : DSC documentation page. - \subpage salome_file_page : Salome_file documentation page. - - Batch documentation */ diff --git a/salome_adm/unix/SALOMEconfig.ref.in b/salome_adm/unix/SALOMEconfig.ref.in index 9849e32b4..68fa375a2 100644 --- a/salome_adm/unix/SALOMEconfig.ref.in +++ b/salome_adm/unix/SALOMEconfig.ref.in @@ -37,41 +37,6 @@ #define @MACHINE@ #endif -/* A path to a rcp-like command */ -#ifndef RCP -# define RCP "@RCP@" -#endif - -/* A path to a rm-like command */ -#ifndef RM -# define RM "@RM@" -#endif - -/* A path to a cp-like command */ -#ifndef CP -#define CP "@CP@" -#endif - -/* A path to a rsh-like command */ -#ifndef RSH -#define RSH "@RSH@" -#endif - -/* A path to a scp-like command */ -#ifndef SCP -#define SCP "@SCP@" -#endif - -/* A path to a sh-like command */ -#ifndef SH -#define SH "@SH@" -#endif - -/* A path to a ssh-like command */ -#ifndef SSH -#define SSH "@SSH@" -#endif - // This is only to suppress warning messages with defines redefined (cause of omniORB that exports these names) #ifdef PACKAGE #undef PACKAGE diff --git a/salome_adm/unix/config_files/Makefile.am b/salome_adm/unix/config_files/Makefile.am index 705501002..e66ea7cab 100644 --- a/salome_adm/unix/config_files/Makefile.am +++ b/salome_adm/unix/config_files/Makefile.am @@ -64,12 +64,11 @@ check_calcium.m4 \ check_hdf5.m4 \ check_htmlgen.m4 \ check_lam.m4 \ -check_lsf.m4 \ +check_libbatch.m4 \ check_mpi.m4 \ check_openmpi.m4 \ check_mpich.m4 \ check_omniorb.m4 \ -check_openpbs.m4 \ check_sockets.m4 \ check_swig.m4 \ check_withihm.m4 \ @@ -78,7 +77,6 @@ production.m4 \ pyembed.m4 \ python.m4 \ check_libxml.m4 \ -check_local.m4 \ check_paco++.m4 \ local_install.m4 diff --git a/salome_adm/unix/config_files/check_libbatch.m4 b/salome_adm/unix/config_files/check_libbatch.m4 new file mode 100644 index 000000000..52a95f39a --- /dev/null +++ b/salome_adm/unix/config_files/check_libbatch.m4 @@ -0,0 +1,115 @@ +dnl Copyright (C) 2007-2009 CEA/DEN, EDF R&D, OPEN CASCADE +dnl +dnl Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +dnl CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +dnl +dnl This library is free software; you can redistribute it and/or +dnl modify it under the terms of the GNU Lesser General Public +dnl License as published by the Free Software Foundation; either +dnl version 2.1 of the License. +dnl +dnl This library is distributed in the hope that it will be useful, +dnl but WITHOUT ANY WARRANTY; without even the implied warranty of +dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +dnl Lesser General Public License for more details. +dnl +dnl You should have received a copy of the GNU Lesser General Public +dnl License along with this library; if not, write to the Free Software +dnl Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +dnl +dnl See http://www.salome-platform.org/ or +dnl email : webmaster.salome@opencascade.com +dnl + +# CHECK_LIBBATCH +# This macro can be used to find libBatch and set the associated variables in +# a project based on autoconf. You can copy this file in your own project and +# eventually modify it according to your own needs. +# ---------------------------------------------------------------------------- + +AC_DEFUN([CHECK_LIBBATCH],[ + +AC_MSG_NOTICE(Checking for libBatch library) + +AC_SUBST(LIBBATCH_INCLUDES) +AC_SUBST(LIBBATCH_LIBS) + +LIBBATCH_INCLUDES="" +LIBBATCH_LIBS="" + +libbatch_ok=no + +AC_ARG_WITH([libbatch], + [AS_HELP_STRING([--with-libbatch=DIR], + [root directory path of libBatch installation])], + [LIBBATCH_DIR="$withval"], + [LIBBATCH_DIR=""]) + +if test "x$LIBBATCH_DIR" = "x" ; then + # no --with-libbatch option used + if test "x$LIBBATCH_ROOT_DIR" != "x" ; then + # LIBBATCH_ROOT_DIR environment variable defined + LIBBATCH_DIR=$LIBBATCH_ROOT_DIR + fi +fi + +LOCAL_INCLUDES="" +LOCAL_LIBS="" + +if test "x$LIBBATCH_DIR" != "x" ; then + LOCAL_INCLUDES="-I$LIBBATCH_DIR/include" + if test "x$LIBBATCH_DIR" = "x/usr" ; then + LOCAL_LIBS="-lBatch" + else + LOCAL_LIBS="-L$LIBBATCH_DIR/lib -lBatch" + fi +else + LOCAL_INCLUDES="-I/usr/include" + LOCAL_LIBS="-lBatch" +fi + +# libBatch headers + +CPPFLAGS_old="$CPPFLAGS" +CPPFLAGS="$CPPFLAGS $LOCAL_INCLUDES" +AC_CHECK_HEADER(Batch/Batch_BatchManager.hxx, + libbatch_ok="yes", + libbatch_ok="no") +CPPFLAGS="$CPPFLAGS_old" + + +if test "x$libbatch_ok" = "xyes" ; then + # libBatch library + + LIBS_old=$LIBS + LIBS="$LIBS $LOCAL_LIBS" + # Can't use AC_SEARCH_LIBS or AC_CHECK_LIB here because + # they don't work with C++ namespaces + # AC_SEARCH_LIBS(Batch::BatchManagerCatalog::getInstance,Batch, + # libbatch_ok="yes",libbatch_ok="no") + AC_MSG_CHECKING( + [for library containing Batch::BatchManagerCatalog::getInstance]) + AC_LINK_IFELSE([AC_LANG_PROGRAM([[ + namespace Batch { + class BatchManagerCatalog { + public: static void getInstance(); + }; + } + ]], + [using namespace Batch; + BatchManagerCatalog::getInstance();])], + [libbatch_ok="yes"], + [libbatch_ok="no"]) + AC_MSG_RESULT($libbatch_ok) + + LIBS=$LIBS_old +fi + +if test "x$libbatch_ok" = "xyes" ; then + LIBBATCH_INCLUDES="$LOCAL_INCLUDES" + LIBBATCH_LIBS="$LOCAL_LIBS" +fi + +AC_MSG_RESULT(for libBatch: $libbatch_ok) + +]) diff --git a/salome_adm/unix/config_files/check_local.m4 b/salome_adm/unix/config_files/check_local.m4 deleted file mode 100755 index df683e86f..000000000 --- a/salome_adm/unix/config_files/check_local.m4 +++ /dev/null @@ -1,90 +0,0 @@ -dnl Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE -dnl -dnl Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -dnl CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -dnl -dnl This library is free software; you can redistribute it and/or -dnl modify it under the terms of the GNU Lesser General Public -dnl License as published by the Free Software Foundation; either -dnl version 2.1 of the License. -dnl -dnl This library is distributed in the hope that it will be useful, -dnl but WITHOUT ANY WARRANTY; without even the implied warranty of -dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -dnl Lesser General Public License for more details. -dnl -dnl You should have received a copy of the GNU Lesser General Public -dnl License along with this library; if not, write to the Free Software -dnl Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -dnl -dnl See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -dnl -# Check for Local -AC_DEFUN([CHECK_LOCAL], -[ - dnl AC_ARG_VAR([LOCAL], []) - AC_ARG_WITH([local], - AC_HELP_STRING([--with-local], - [tell configure script to use local submission. Default is --with-local.]), - [], - [withval=yes]) - - AC_MSG_CHECKING([for Local]) - - if test "x$withval" = "xyes" - then - WITH_LOCAL=yes - - AC_MSG_RESULT([$withval]) - - AC_ARG_VAR([RM], [A path to a rm-like command]) - AC_PATH_PROG([RM], [rm], [/bin/false]) - AC_DEFINE_UNQUOTED(RM, "$RM", [A path to a rm-like command]) - - AC_ARG_VAR([SH], [A path to a sh-like command]) - AC_PATH_PROG([SH], [sh], [/bin/false]) - AC_DEFINE_UNQUOTED(SH, "$SH", [A path to a sh-like command]) - AC_ARG_VAR([CP], [A path to a cp-like command]) - AC_PATH_PROG([CP], [cp], [/bin/false]) - AC_DEFINE_UNQUOTED(CP, "$CP", [A path to a cp-like command]) - - AC_ARG_VAR([RSH], [A path to a rsh-like command]) - AC_PATH_PROG([RSH], [rsh], [/bin/false]) - AC_DEFINE_UNQUOTED(RSH, "$RSH", [A path to a rsh-like command]) - AC_ARG_VAR([RCP], [A path to a rcp-like command]) - AC_PATH_PROG([RCP], [rcp], [/bin/false]) - AC_DEFINE_UNQUOTED(RCP, "$RCP", [A path to a rcp-like command]) - - AC_ARG_VAR([SSH], [A path to a ssh-like command]) - AC_PATH_PROG([SSH], [ssh], [/bin/false]) - AC_DEFINE_UNQUOTED(SSH, "$SSH", [A path to a ssh-like command]) - AC_ARG_VAR([SCP], [A path to a scp-like command]) - AC_PATH_PROG([SCP], [scp], [/bin/false]) - AC_DEFINE_UNQUOTED(SCP, "$SCP", [A path to a scp-like command]) - - - else - WITH_LOCAL=no - - AC_MSG_RESULT([no]) - - fi - - AM_CONDITIONAL(WITH_LOCAL, test $WITH_LOCAL = yes) - - localbatch_ok=$WITH_LOCAL - AC_SUBST(WITH_LOCAL) - AC_SUBST(RM) - AC_SUBST(SH) - AC_SUBST(CP) - AC_SUBST(RSH) - AC_SUBST(RCP) - AC_SUBST(SSH) - AC_SUBST(SCP) - - dnl _CS_gbo Pour forcer l'utilisation du config.h, inclu - dnl par les fichiers Batch_BatchManager_Local_*.cxx - dnl OWN_CONFIG_H=yes - dnl AC_SUBST(OWN_CONFIG_H) -]) - diff --git a/salome_adm/unix/config_files/check_lsf.m4 b/salome_adm/unix/config_files/check_lsf.m4 deleted file mode 100755 index 59e6694ba..000000000 --- a/salome_adm/unix/config_files/check_lsf.m4 +++ /dev/null @@ -1,105 +0,0 @@ -dnl Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE -dnl -dnl Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -dnl CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -dnl -dnl This library is free software; you can redistribute it and/or -dnl modify it under the terms of the GNU Lesser General Public -dnl License as published by the Free Software Foundation; either -dnl version 2.1 of the License. -dnl -dnl This library is distributed in the hope that it will be useful, -dnl but WITHOUT ANY WARRANTY; without even the implied warranty of -dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -dnl Lesser General Public License for more details. -dnl -dnl You should have received a copy of the GNU Lesser General Public -dnl License along with this library; if not, write to the Free Software -dnl Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -dnl -dnl See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -dnl -# Check for LSF -AC_DEFUN([CHECK_LSF], -[ - AC_ARG_WITH([lsf], - AC_HELP_STRING([--with-lsf[[[[[=path] ]]]]], - [tell configure script to use LSF that is located at . Default is no. If path is not given, it is automaticaly determined from LSF_ENVDIR variable.]), - [], - [withval=no]) - - AC_MSG_CHECKING([for LSF]) - - if test ! "x$withval" = "xno" - then - if test "x$withval" = "xyes" - then - if test ! "x$LSF_ENVDIR" = "x" - then - test -f "$LSF_ENVDIR/lsf.conf" && . "$LSF_ENVDIR/lsf.conf" - LSF=$LSF_TOP - else - dnl some default values ... - LSF=/usr - LSF_INCLUDEDIR=$LSF/include - LSF_LIBDIR=$LSF/lib - fi - else - LSF=$withval - LSF_INCLUDEDIR=$LSF/include - LSF_LIBDIR=$LSF/lib - fi - - AC_MSG_RESULT([$LSF]) - - dnl INCLUDE directory - - LSF_INCLUDES="-I${LSF_INCLUDEDIR}" - saved_CPPFLAGS=${CPPFLAGS} - CPPFLAGS="${CPPFLAGS} ${LSF_INCLUDES}" - AC_CHECK_HEADER([lsf/lsbatch.h], [lsf_header_found=yes], [lsf_header_found=no], []) - test x${lsf_header_found} = xno && AC_MSG_WARN([LSF include file not found]) - CPPFLAGS=${saved_CPPFLAGS} - AC_SUBST(LSF_INCLUDES) - - dnl LIB directory - - if test "x${LSF_LIBDIR}" = "x/usr/lib" - then - LSF_LDFLAGS="" - else - LSF_LDFLAGS="-L${LSF_LIBDIR}" - fi - LSF_LIBS="-lbat -llsf" - saved_LDFLAGS=${LDFLAGS} - saved_LIBS=${LIBS} - LDFLAGS="${LDFLAGS} ${LSF_LDFLAGS}" - lsf_lib_found=yes - AC_CHECK_LIB([lsf], [ls_load], [lsf_libs="-llsf ${lsf_libs}"], [lsf_lib_found=no], []) - AC_CHECK_LIB([bat], [lsb_init], [lsf_libs="-lbat ${lsf_libs}"], [lsf_lib_found=no], [-llsf]) - test x${lsf_lib_found} = xno && AC_MSG_WARN([LSF library not found]) - LIBS="${LSF_LIBS} ${LIBS}" - LDFLAGS=${saved_LDFLAGS} - LIBS=${saved_LIBS} - AC_SUBST(LSF_LDFLAGS) - AC_SUBST(LSF_LIBS) - - test x${lsf_lib_found} = xyes && test x${lsf_header_found} = xyes && WITH_LSF=yes - - else - WITH_LSF=no - - AC_MSG_RESULT([no]) - - fi - - AM_CONDITIONAL(WITH_LSF, test $WITH_LSF = yes) - - lsf_ok=$WITH_LSF - if test $lsf_ok = no ; then - lsf_ok= - fi - AC_SUBST(WITH_LSF) - -]) - diff --git a/salome_adm/unix/config_files/check_openpbs.m4 b/salome_adm/unix/config_files/check_openpbs.m4 deleted file mode 100644 index a0247bd9f..000000000 --- a/salome_adm/unix/config_files/check_openpbs.m4 +++ /dev/null @@ -1,88 +0,0 @@ -dnl Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE -dnl -dnl Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -dnl CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -dnl -dnl This library is free software; you can redistribute it and/or -dnl modify it under the terms of the GNU Lesser General Public -dnl License as published by the Free Software Foundation; either -dnl version 2.1 of the License. -dnl -dnl This library is distributed in the hope that it will be useful, -dnl but WITHOUT ANY WARRANTY; without even the implied warranty of -dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -dnl Lesser General Public License for more details. -dnl -dnl You should have received a copy of the GNU Lesser General Public -dnl License along with this library; if not, write to the Free Software -dnl Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -dnl -dnl See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -dnl -# Check for OpenPBS -AC_DEFUN([CHECK_OPENPBS], -[ - AC_ARG_VAR([OPENPBS], [OpenPBS home directory]) - AC_ARG_WITH([openpbs], - AC_HELP_STRING([--with-openpbs=], - [tell configure script to use OpenPBS that is located at ]), - [test ! x"${withval}" = xyes && OPENPBS=${withval}], - []) - - dnl AC_ARG_VAR([OPENPBSSERVERNAME], [OpenPBS server_name file]) - dnl AC_ARG_WITH([openpbs-server-name], - dnl AC_HELP_STRING([--with-openpbs-server-name=], - dnl [tell configure script to use OpenPBS server_name file that is located at ]), - dnl [test ! x"${withval}" = xyes && OPENPBSSERVERNAME=${withval}], - dnl [with_openpbs_server_name=""]) - - - if test -z "${OPENPBS}" - then - AC_MSG_WARN([Environment variable OPENPBS not set. Skipping OpenPBS configuration.]) - - else - - OPENPBS_INCLUDES="-I${OPENPBS}/include" - saved_CPPFLAGS=${CPPFLAGS} - CPPFLAGS="${CPPFLAGS} ${OPENPBS_INCLUDES}" - AC_CHECK_HEADER([pbs_ifl.h], [openpbs_header_found=yes], [openpbs_header_found=no], []) - test x${openpbs_header_found} = xno && AC_MSG_WARN([OpenPBS include file not found]) - CPPFLAGS=${saved_CPPFLAGS} - AC_SUBST(OPENPBS_INCLUDES) - - if test "x${OPENPBS}" = "x/usr" - then - OPENPBS_LIBDIR="" - else - OPENPBS_LIBDIR="-L${OPENPBS}/lib" - fi - OPENPBS_LIBS="-lpbs" - saved_LDFLAGS=${LDFLAGS} - saved_LIBS=${LIBS} - LDFLAGS="${LDFLAGS} ${OPENPBS_LIBDIR}" - AC_CHECK_LIB([pbs], [pbs_connect], [openpbs_lib_found=yes], [openpbs_lib_found=no], []) - test x${openpbs_lib_found} = xno && AC_MSG_WARN([OpenPBS library not found]) - LIBS="${LIBS} ${OPENPBS_LIBS}" - LDFLAGS=${saved_LDFLAGS} - LIBS=${saved_LIBS} - AC_SUBST(OPENPBS_LIBDIR) - AC_SUBST(OPENPBS_LIBS) - - dnl test -z "${OPENPBSSERVERNAME}" && OPENPBSSERVERNAME="/usr/spool/PBS/server_name" - dnl AC_CHECK_FILE([${OPENPBSSERVERNAME}], [openpbs_server_name_found=yes], [openpbs_server_name_found=no]) - - test x${openpbs_header_found} = xyes && test x${openpbs_lib_found} = xyes && openpbs_ok="yes" - - fi - - WITHOPENPBS=$openpbs_ok - if test x$WITHOPENPBS = x ; then - WITHOPENPBS=no - fi - AC_SUBST(WITHOPENPBS) - - AM_CONDITIONAL(WITH_OPENPBS, test $WITHOPENPBS = yes) - -]) - diff --git a/src/Batch/Batch_APIInternalFailureException.cxx b/src/Batch/Batch_APIInternalFailureException.cxx deleted file mode 100644 index b75e3bd60..000000000 --- a/src/Batch/Batch_APIInternalFailureException.cxx +++ /dev/null @@ -1,37 +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 -// -/* - * APIInternalFailureException.cxx : - * - * Auteur : Ivan DUTKA-MALEN - EDF R&D - * Mail : mailto:ivan.dutka-malen@der.edf.fr - * Date : Thu Nov 20 15:15:42 2003 - * Projet : Salome 2 - * - */ - -#include "Batch_APIInternalFailureException.hxx" -using namespace std; - -namespace Batch { - -} diff --git a/src/Batch/Batch_APIInternalFailureException.hxx b/src/Batch/Batch_APIInternalFailureException.hxx deleted file mode 100644 index a270a6a9f..000000000 --- a/src/Batch/Batch_APIInternalFailureException.hxx +++ /dev/null @@ -1,51 +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 -// -/* - * APIInternalFailureException.hxx : - * - * Auteur : Ivan DUTKA-MALEN - EDF R&D - * Mail : mailto:ivan.dutka-malen@der.edf.fr - * Date : Thu Nov 20 15:15:41 2003 - * Projet : Salome 2 - * - */ - -#ifndef _APIINTERNALFAILUREEXCEPTION_H_ -#define _APIINTERNALFAILUREEXCEPTION_H_ - -#include "Batch_Defines.hxx" - -#include "Batch_GenericException.hxx" -#include "Batch_GenericException.hxx" - -namespace Batch { - - class BATCH_EXPORT APIInternalFailureException : public GenericException - { - public: - // Constructeur - APIInternalFailureException(std::string ch = "undefined") : GenericException("APIInternalFailureException", ch) {} - }; - -} - -#endif diff --git a/src/Batch/Batch_BatchManager.cxx b/src/Batch/Batch_BatchManager.cxx deleted file mode 100644 index d4744af18..000000000 --- a/src/Batch/Batch_BatchManager.cxx +++ /dev/null @@ -1,149 +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 -// -/* - * BatchManager.cxx : - * - * Auteur : Ivan DUTKA-MALEN - EDF R&D - * Date : Septembre 2003 - * Projet : SALOME 2 - * - */ - -#include -#include -#include -#ifdef WIN32 -# include -#else -# include -#endif - -//#include "MEDMEM_STRING.hxx" -#include "Batch_Job.hxx" -#include "Batch_JobId.hxx" -#include "Batch_JobInfo.hxx" -#include "Batch_InvalidArgumentException.hxx" -#include "Batch_FactBatchManager.hxx" -#include "Batch_BatchManager.hxx" -using namespace std; - -namespace Batch { - - // Constructeur -// BatchManager::BatchManager(string host) throw(InvalidArgumentException) : _hostname(host), jobid_map() -// { -// // On verifie que le hostname est correct -// if (!gethostbyname(_hostname.c_str())) { // hostname unknown from network -// string msg = "hostname \""; -// msg += _hostname; -// msg += "\" unknown from the network"; -// throw InvalidArgumentException(msg.c_str()); -// } -// } - BatchManager::BatchManager(const FactBatchManager * parent, const char * host) throw(InvalidArgumentException) : _hostname(host), jobid_map(), _parent(parent) - { - // On verifie que le hostname est correct - if (!gethostbyname(_hostname.c_str())) { // hostname unknown from network - string msg = "hostname \""; - msg += _hostname; - msg += "\" unknown from the network"; - throw InvalidArgumentException(msg.c_str()); - } - } - - // Destructeur - BatchManager::~BatchManager() - { - // Nothing to do - } - - string BatchManager::__repr__() const - { - ostringstream oss; - oss << "getType() : "unknown (no factory)") << "' connected to server '" << _hostname << "'>"; - return oss.str(); - } - - // Recupere le l'identifiant d'un job deja soumis au BatchManager -// const JobId BatchManager::getJobIdByReference(const string & ref) -// { -// return JobId(this, ref); -// } - const JobId BatchManager::getJobIdByReference(const char * ref) - { - return JobId(this, ref); - } - -// // Methode pour le controle des jobs : soumet un job au gestionnaire -// const JobId BatchManager::submitJob(const Job & job) -// { -// static int idx = 0; -// //MEDMEM::STRING sst; -// ostringstream sst; -// sst << "Jobid_" << idx++; -// JobId id(this, sst.str()); -// return id; -// } - -// // Methode pour le controle des jobs : retire un job du gestionnaire -// void BatchManager::deleteJob(const JobId & jobid) -// { -// // Nothing to do -// } - -// // Methode pour le controle des jobs : suspend un job en file d'attente -// void BatchManager::holdJob(const JobId & jobid) -// { -// // Nothing to do -// } - -// // Methode pour le controle des jobs : relache un job suspendu -// void BatchManager::releaseJob(const JobId & jobid) -// { -// // Nothing to do -// } - -// // Methode pour le controle des jobs : modifie un job en file d'attente -// void BatchManager::alterJob(const JobId & jobid, const Parametre & param, const Environnement & env) -// { -// // Nothing to do -// } - -// // Methode pour le controle des jobs : modifie un job en file d'attente -// void BatchManager::alterJob(const JobId & jobid, const Parametre & param) -// { -// // Nothing to do -// } - -// // Methode pour le controle des jobs : modifie un job en file d'attente -// void BatchManager::alterJob(const JobId & jobid, const Environnement & env) -// { -// // Nothing to do -// } - -// // Methode pour le controle des jobs : renvoie l'etat du job -// JobInfo BatchManager::queryJob(const JobId & jobid) -// { -// return JobInfo(); -// } - -} diff --git a/src/Batch/Batch_BatchManager.hxx b/src/Batch/Batch_BatchManager.hxx deleted file mode 100644 index bda29616c..000000000 --- a/src/Batch/Batch_BatchManager.hxx +++ /dev/null @@ -1,85 +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 -// -/* - * BatchManager.hxx : - * - * Auteur : Ivan DUTKA-MALEN - EDF R&D - * Date : Septembre 2003 - * Projet : SALOME 2 - * - */ - -#ifndef _BATCHMANAGER_H_ -#define _BATCHMANAGER_H_ - -#include "Batch_Defines.hxx" - -#include -#include -#include "Batch_Job.hxx" -#include "Batch_JobId.hxx" -#include "Batch_JobInfo.hxx" -#include "Batch_InvalidArgumentException.hxx" - -namespace Batch { - - class Job; - class JobId; - class JobInfo; - class FactBatchManager; - - class BATCH_EXPORT BatchManager - { - public: - // Constructeur et destructeur - //BatchManager(std::string host="localhost") throw(InvalidArgumentException); // connexion a la machine host - BatchManager(const Batch::FactBatchManager * parent, const char * host="localhost") throw(InvalidArgumentException); // connexion a la machine host - virtual ~BatchManager(); - virtual std::string __repr__() const; - - // Recupere le l'identifiant d'un job deja soumis au BatchManager - //virtual const JobId getJobIdByReference(const std::string & ref); - virtual const Batch::JobId getJobIdByReference(const char * ref); - - // Methodes pour le controle des jobs : virtuelles pures - virtual const Batch::JobId submitJob(const Batch::Job & job) = 0; // soumet un job au gestionnaire - virtual void deleteJob(const Batch::JobId & jobid) = 0; // retire un job du gestionnaire - virtual void holdJob(const Batch::JobId & jobid) = 0; // suspend un job en file d'attente - virtual void releaseJob(const Batch::JobId & jobid) = 0; // relache un job suspendu - virtual void alterJob(const Batch::JobId & jobid, const Batch::Parametre & param, const Batch::Environnement & env) = 0; // modifie un job en file d'attente - virtual void alterJob(const Batch::JobId & jobid, const Batch::Parametre & param) = 0; // modifie un job en file d'attente - virtual void alterJob(const Batch::JobId & jobid, const Batch::Environnement & env) = 0; // modifie un job en file d'attente - virtual Batch::JobInfo queryJob(const Batch::JobId & jobid) = 0; // renvoie l'etat du job - - 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< std::string, const Batch::JobId * > jobid_map; // table des jobs deja soumis - const Batch::FactBatchManager * _parent; - - private: - - }; - -} - -#endif diff --git a/src/Batch/Batch_BatchManagerCatalog.cxx b/src/Batch/Batch_BatchManagerCatalog.cxx deleted file mode 100644 index c9e5ea7ed..000000000 --- a/src/Batch/Batch_BatchManagerCatalog.cxx +++ /dev/null @@ -1,101 +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 -// -/* - * BatchManagerCatalog.cxx : - * - * Auteur : Ivan DUTKA-MALEN - EDF R&D - * Date : Septembre 2004 - * Projet : SALOME 2 - * - */ - -#include -#include -#include -#include "Batch_BatchManagerCatalog.hxx" -#include "Batch_FactBatchManager.hxx" -using namespace std; - -namespace Batch { - - pthread_mutex_t BatchManagerCatalog::_mutex = PTHREAD_MUTEX_INITIALIZER; - std::map * BatchManagerCatalog::_p_catalog = 0; -// BatchManagerCatalog BatchManagerCatalog::theCatalog; - - // Constructeur - BatchManagerCatalog::BatchManagerCatalog() - { - // Nothing to do - } - - // Destructeur - BatchManagerCatalog::~BatchManagerCatalog() - { - // Note (RB, 6mar09) : this deletion can cause big memory problems as the pointer - // may have been destroyed before this call to delete, and delete can be called - // several times. So it's better to remove it for now, even if there is a (small) - // memory leak. - // TODO: Replace that by a clean singleton implementation -// delete BatchManagerCatalog::_p_catalog; - } - - // Functor - FactBatchManager * BatchManagerCatalog::getFactBatchManager(const char * type) - { - return (* BatchManagerCatalog::_p_catalog)[type]; - } - - void BatchManagerCatalog::addFactBatchManager(const char * type, FactBatchManager * pFBM) - { - if (pFBM) { // *** section critique *** - pthread_mutex_lock(&_mutex); - - if (! BatchManagerCatalog::_p_catalog) BatchManagerCatalog::_p_catalog = new std::map; - (*BatchManagerCatalog::_p_catalog)[type] = pFBM; - - pthread_mutex_unlock(&_mutex); - } - } - - FactBatchManager * BatchManagerCatalog::operator() (const char * type) const - { - return BatchManagerCatalog::getFactBatchManager(type); - } - - std::map * BatchManagerCatalog::dict() const - { - return _p_catalog; - } - - string BatchManagerCatalog::__repr__() const - { - ostringstream oss; - oss << "::const_iterator it = (*_p_catalog).begin(); it != (*_p_catalog).end(); it++, sep=", ") { - oss << sep << "'" << (*it).first << "' : '" << (*it).second->__repr__() << "'"; - } - oss << "}>"; - return oss.str(); - } - -} diff --git a/src/Batch/Batch_BatchManagerCatalog.hxx b/src/Batch/Batch_BatchManagerCatalog.hxx deleted file mode 100644 index 0e95cc622..000000000 --- a/src/Batch/Batch_BatchManagerCatalog.hxx +++ /dev/null @@ -1,70 +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 -// -/* - * BatchManagerCatalog.hxx : - * - * Auteur : Ivan DUTKA-MALEN - EDF R&D - * Date : Septembre 2004 - * Projet : SALOME 2 - * - */ - -#ifndef _CATALOG_H_ -#define _CATALOG_H_ - -#include "Batch_Defines.hxx" - -#include -#include -#include - -namespace Batch { - - class FactBatchManager; - - class BATCH_EXPORT BatchManagerCatalog - { - public: - // Constructeur - BatchManagerCatalog(); - // Destructeur - virtual ~BatchManagerCatalog(); - - static Batch::FactBatchManager * getFactBatchManager(const char * type); - static void addFactBatchManager(const char * type, Batch::FactBatchManager * pFBM); - virtual Batch::FactBatchManager * operator() (const char * type) const; - - virtual std::map * dict() const; - virtual std::string __repr__() const; - - protected: - static BatchManagerCatalog theCatalog; - static std::map * _p_catalog; - static pthread_mutex_t _mutex; - - private: - - }; - -} - -#endif diff --git a/src/Batch/Batch_BatchManager_LSF.cxx b/src/Batch/Batch_BatchManager_LSF.cxx deleted file mode 100644 index ae8afada9..000000000 --- a/src/Batch/Batch_BatchManager_LSF.cxx +++ /dev/null @@ -1,194 +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 -// -/* - * BatchManager_LSF.cxx : - * - * Auteur : Ivan DUTKA-MALEN - EDF R&D - * Mail : mailto:ivan.dutka-malen@der.edf.fr - * Date : Thu Nov 6 10:17:22 2003 - * Projet : Salome 2 - * - */ - -extern "C" { -#include -#include -} -#include -#include -#include -#include -#include "Batch_BatchManager_LSF.hxx" - -using namespace std; - -namespace Batch { - - BatchManager_LSF::BatchManager_LSF(const FactBatchManager * parent, const char * host) throw(InvalidArgumentException,ConnexionFailureException) : BatchManager(parent, host) - { - // On se connecte au serveur LSF - _connect = lsb_init("Salome2 Batch library"); - if (_connect < 0) { // si erreur - char * errmsg = lsb_sysmsg(); - string msg = "LSF Server on host \""; - msg += _hostname; - msg += "\" : "; - msg += errmsg ? errmsg : "Reason unknown"; - throw ConnexionFailureException(msg.c_str()); - } - } - - // Destructeur - BatchManager_LSF::~BatchManager_LSF() - { - // Nothing to do - } - - // Methode pour le controle des jobs : soumet un job au gestionnaire - const JobId BatchManager_LSF::submitJob(const Job & job) - { - Job_LSF joblsf = job; - struct submitReply reply; - int ref = lsb_submit(joblsf.getSubmitStruct(), - &reply); - if (ref < 0) { // si erreur - char * msg = lsb_sysmsg(); - if (!msg) msg = "unknown"; - throw APIInternalFailureException(string("LSF submit error. Reason : ") + msg); - } - - ostringstream oss; - oss << ref; - JobId id(this, oss.str()); - return id; - } - - // Methode pour le controle des jobs : retire un job du gestionnaire - void BatchManager_LSF::deleteJob(const JobId & jobid) - { - int ref; - istringstream iss(jobid.getReference()); - iss >> ref; - int rc = lsb_deletejob(ref, 0, 0); - if (rc < 0) { // si erreur - char * msg = lsb_sysmsg(); - if (!msg) msg = "unknown"; - throw APIInternalFailureException(string("LSF deljob error. Reason : ") + msg); - } - } - - // Methode pour le controle des jobs : suspend un job en file d'attente - void BatchManager_LSF::holdJob(const JobId & jobid) - { - int ref; - istringstream iss(jobid.getReference()); - iss >> ref; - int rc = lsb_signaljob(ref, SIGSTOP); - if (rc < 0) { // si erreur - char * msg = lsb_sysmsg(); - if (!msg) msg = "unknown"; - throw APIInternalFailureException(string("LSF signaljob error. Reason : ") + msg); - } - } - - // Methode pour le controle des jobs : relache un job suspendu - void BatchManager_LSF::releaseJob(const JobId & jobid) - { - int ref; - istringstream iss(jobid.getReference()); - iss >> ref; - int rc = lsb_signaljob(ref, SIGCONT); - if (rc < 0) { // si erreur - char * msg = lsb_sysmsg(); - if (!msg) msg = "unknown"; - throw APIInternalFailureException(string("LSF signaljob error. Reason : ") + msg); - } - } - - - // Methode pour le controle des jobs : modifie un job en file d'attente - void BatchManager_LSF::alterJob(const JobId & jobid, const Parametre & param, const Environnement & env) - { - int ref; - istringstream iss(jobid.getReference()); - iss >> ref; - - Job_LSF joblsf = Job(param, env); - struct submitReply reply; - ref = lsb_modify(joblsf.getSubmitStruct(), - &reply, - ref); - if (ref < 0) { // si erreur - ostringstream msg_sst; - char * msg = lsb_sysmsg(); - if (!msg) msg = "unknown"; - msg_sst << msg << endl; -// msg_sst << "BadJobId = " << (long) reply.badJobId << endl -// << "BadJobName = " << reply.badJobName << endl -// << "BadReqIndx = " << reply.badReqIndx << endl; - throw APIInternalFailureException(string("LSF modify error. Reason : ") + msg_sst.str()); - } - } - - // Methode pour le controle des jobs : modifie un job en file d'attente - void BatchManager_LSF::alterJob(const JobId & jobid, const Parametre & param) - { - alterJob(jobid, param, Environnement()); - } - - // Methode pour le controle des jobs : modifie un job en file d'attente - void BatchManager_LSF::alterJob(const JobId & jobid, const Environnement & env) - { - alterJob(jobid, Parametre(), env); - } - - - - // Methode pour le controle des jobs : renvoie l'etat du job - JobInfo BatchManager_LSF::queryJob(const JobId & jobid) - { - int id; - istringstream iss(jobid.getReference()); - iss >> id; - - JobInfo_LSF ji = JobInfo_LSF(id); - - return ji; - } - - - - // Methode pour le controle des jobs : teste si un job est present en machine - bool BatchManager_LSF::isRunning(const JobId & jobid) - { - int id; - istringstream iss(jobid.getReference()); - iss >> id; - - JobInfo_LSF ji = JobInfo_LSF(id); - - return ji.isRunning(); - } - - - -} diff --git a/src/Batch/Batch_BatchManager_LSF.hxx b/src/Batch/Batch_BatchManager_LSF.hxx deleted file mode 100644 index 283be2f8d..000000000 --- a/src/Batch/Batch_BatchManager_LSF.hxx +++ /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 -// -/* - * BatchManager_LSF.hxx : - * - * Auteur : Ivan DUTKA-MALEN - EDF R&D - * Mail : mailto:ivan.dutka-malen@der.edf.fr - * Date : Thu Nov 6 10:17:22 2003 - * Projet : Salome 2 - * - */ - -#ifndef _BATCHMANAGER_LSF_H_ -#define _BATCHMANAGER_LSF_H_ - -#include "Batch_Defines.hxx" - -#include "Batch_Job.hxx" -#include "Batch_Job.hxx" -#include "Batch_JobId.hxx" -#include "Batch_JobInfo.hxx" -#include "Batch_JobInfo_LSF.hxx" -#include "Batch_Job_LSF.hxx" -#include "Batch_InvalidArgumentException.hxx" -#include "Batch_ConnexionFailureException.hxx" -#include "Batch_APIInternalFailureException.hxx" -#include "Batch_NotYetImplementedException.hxx" -#include "Batch_BatchManager.hxx" - -namespace Batch { - - class Job; - class JobId; - class JobInfo; - class FactBatchManager; - - class BATCH_EXPORT BatchManager_LSF : public BatchManager - { - public: - // Constructeur et destructeur - BatchManager_LSF(const FactBatchManager * parent, const char * host="localhost") throw(InvalidArgumentException,ConnexionFailureException); // connexion a la machine host - virtual ~BatchManager_LSF(); - - // Recupere le nom du serveur par defaut - // static string BatchManager_LSF::getDefaultServer(); - - // Methodes pour le controle des jobs - virtual const JobId submitJob(const Job & job); // soumet un job au gestionnaire - virtual void deleteJob(const JobId & jobid); // retire un job du gestionnaire - virtual void holdJob(const JobId & jobid); // suspend un job en file d'attente - virtual void releaseJob(const JobId & jobid); // relache un job suspendu - virtual void alterJob(const JobId & jobid, const Parametre & param, const Environnement & env); // modifie un job en file d'attente - virtual void alterJob(const JobId & jobid, const Parametre & param); // modifie un job en file d'attente - virtual void alterJob(const JobId & jobid, const Environnement & env); // modifie un job en file d'attente - virtual JobInfo queryJob(const JobId & jobid); // renvoie l'etat du job - virtual bool isRunning(const JobId & jobid); // teste si un job est present en machine - - virtual void setParametre(const JobId & jobid, const Parametre & param) { return alterJob(jobid, param); } // modifie un job en file d'attente - virtual void setEnvironnement(const JobId & jobid, const Environnement & env) { return alterJob(jobid, env); } // modifie un job en file d'attente - - - protected: - int _connect; // LSF connect id - - private: - -#ifdef SWIG - public: - // Recupere le l'identifiant d'un job deja soumis au BatchManager - //virtual const JobId getJobIdByReference(const string & ref) { return BatchManager::getJobIdByReference(ref); } - virtual const JobId getJobIdByReference(const char * ref) { return BatchManager::getJobIdByReference(ref); } -#endif - - }; - -} - -#endif diff --git a/src/Batch/Batch_BatchManager_Local.cxx b/src/Batch/Batch_BatchManager_Local.cxx deleted file mode 100644 index 373547060..000000000 --- a/src/Batch/Batch_BatchManager_Local.cxx +++ /dev/null @@ -1,828 +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 -// -/* -* BatchManager_Local.cxx : -* -* Auteur : Ivan DUTKA-MALEN - EDF R&D -* Mail : mailto:ivan.dutka-malen@der.edf.fr -* Date : Thu Nov 6 10:17:22 2003 -* Projet : Salome 2 -* -*/ - -#include -#include -#include -#include -#include - -#include -#ifdef WIN32 -# include -#else -# include -# include -#endif -#include -#include -#include -#include -#include -#include "Batch_IOMutex.hxx" -#include "Batch_BatchManager_Local.hxx" - -using namespace std; - -namespace Batch { - - - // Constructeur - BatchManager_Local::BatchManager_Local(const FactBatchManager * parent, const char * host) throw(InvalidArgumentException,ConnexionFailureException) : BatchManager(parent, host), _connect(0), _threads_mutex(), _threads(), _thread_id_id_association_mutex(), _thread_id_id_association_cond() -#ifndef WIN32 //TODO: porting of following functionality - ,_thread_id_id_association() -#endif - { - pthread_mutex_init(&_threads_mutex, NULL); - pthread_mutex_init(&_thread_id_id_association_mutex, NULL); - pthread_cond_init(&_thread_id_id_association_cond, NULL); - } - - // Destructeur - BatchManager_Local::~BatchManager_Local() - { - pthread_mutex_destroy(&_threads_mutex); - pthread_mutex_destroy(&_thread_id_id_association_mutex); - pthread_cond_destroy(&_thread_id_id_association_cond); - } - - // Methode pour le controle des jobs : soumet un job au gestionnaire - const JobId BatchManager_Local::submitJob(const Job & job) - { - Job_Local jobLocal = job; - - pthread_t thread_id = submit(jobLocal); - - ostringstream oss; - oss << getIdByThread_id(thread_id); - - JobId id(this, oss.str()); - - return id; - } - - // Methode pour le controle des jobs : retire un job du gestionnaire - void BatchManager_Local::deleteJob(const JobId & jobid) - { - Id id; - - istringstream iss(jobid.getReference()); - iss >> id; - - // On retrouve le thread_id du thread - pthread_t thread_id; - - // @@@ --------> SECTION CRITIQUE <-------- @@@ - pthread_mutex_lock(&_threads_mutex); - if (_threads.find(id) != _threads.end()) - thread_id = _threads[id].thread_id; - pthread_mutex_unlock(&_threads_mutex); - // @@@ --------> SECTION CRITIQUE <-------- @@@ - - cancel(thread_id); - } - - // Methode pour le controle des jobs : suspend un job en file d'attente - void BatchManager_Local::holdJob(const JobId & jobid) - { - Id id; - istringstream iss(jobid.getReference()); - iss >> id; - - UNDER_LOCK( cout << "BatchManager is sending HOLD command to the thread " << id << endl ); - - // On introduit une commande dans la queue du thread - // @@@ --------> SECTION CRITIQUE <-------- @@@ - pthread_mutex_lock(&_threads_mutex); - if (_threads.find(id) != _threads.end()) - _threads[id].command_queue.push(HOLD); - pthread_mutex_unlock(&_threads_mutex); - // @@@ --------> SECTION CRITIQUE <-------- @@@ - } - - // Methode pour le controle des jobs : relache un job suspendu - void BatchManager_Local::releaseJob(const JobId & jobid) - { - Id id; - istringstream iss(jobid.getReference()); - iss >> id; - - UNDER_LOCK( cout << "BatchManager is sending RELEASE command to the thread " << id << endl ); - - // On introduit une commande dans la queue du thread - // @@@ --------> SECTION CRITIQUE <-------- @@@ - pthread_mutex_lock(&_threads_mutex); - if (_threads.find(id) != _threads.end()) - _threads[id].command_queue.push(RELEASE); - pthread_mutex_unlock(&_threads_mutex); - // @@@ --------> SECTION CRITIQUE <-------- @@@ - } - - - // Methode pour le controle des jobs : modifie un job en file d'attente - void BatchManager_Local::alterJob(const JobId & jobid, const Parametre & param, const Environnement & env) - { - } - - // Methode pour le controle des jobs : modifie un job en file d'attente - void BatchManager_Local::alterJob(const JobId & jobid, const Parametre & param) - { - alterJob(jobid, param, Environnement()); - } - - // Methode pour le controle des jobs : modifie un job en file d'attente - void BatchManager_Local::alterJob(const JobId & jobid, const Environnement & env) - { - alterJob(jobid, Parametre(), env); - } - - - - // Methode pour le controle des jobs : renvoie l'etat du job - JobInfo BatchManager_Local::queryJob(const JobId & jobid) - { - Id id; - istringstream iss(jobid.getReference()); - iss >> id; - - Parametre param; - Environnement env; - - //UNDER_LOCK( cout << "JobInfo BatchManager_Local::queryJob(const JobId & jobid) : AVANT section critique" << endl ); - // @@@ --------> SECTION CRITIQUE <-------- @@@ - pthread_mutex_lock(&_threads_mutex); - param = _threads[id].param; - env = _threads[id].env; - pthread_mutex_unlock(&_threads_mutex); - // @@@ --------> SECTION CRITIQUE <-------- @@@ - //UNDER_LOCK( cout << "JobInfo BatchManager_Local::queryJob(const JobId & jobid) : APRES section critique" << endl ); - - JobInfo_Local ji(param, env); - return ji; - } - - - - // Methode pour le controle des jobs : teste si un job est present en machine - bool BatchManager_Local::isRunning(const JobId & jobid) - { - Id id; - istringstream iss(jobid.getReference()); - iss >> id; - - Status status; - - //UNDER_LOCK( cout << "JobInfo BatchManager_Local::queryJob(const JobId & jobid) : AVANT section critique" << endl ); - // @@@ --------> SECTION CRITIQUE <-------- @@@ - pthread_mutex_lock(&_threads_mutex); - status = _threads[id].status; - pthread_mutex_unlock(&_threads_mutex); - // @@@ --------> SECTION CRITIQUE <-------- @@@ - //UNDER_LOCK( cout << "JobInfo BatchManager_Local::queryJob(const JobId & jobid) : APRES section critique" << endl ); - - return (status == RUNNING); - } - - - // Methode d'execution d'un job - pthread_t BatchManager_Local::submit(const Job_Local & job) - { - // L'id du thread a creer - pthread_t thread_id = -#ifdef WIN32 - {0,0}; -#else - 0; -#endif - - // Les attributs du thread a sa creation - pthread_attr_t thread_attr; - pthread_attr_init(&thread_attr); - pthread_attr_setdetachstate(&thread_attr, PTHREAD_CREATE_DETACHED); - - ThreadAdapter * p_ta = new ThreadAdapter(*this, job); - - // Creation du thread qui va executer la commande systeme qu'on lui passe - int rc = pthread_create(&thread_id, - &thread_attr, - &ThreadAdapter::run, - static_cast(p_ta)); - if (rc) { - } - - // Liberation des zones memoire maintenant inutiles occupees par les attributs du thread - pthread_attr_destroy(&thread_attr); - - return thread_id; - } - - - // Methode de destruction d'un job - void BatchManager_Local::cancel(pthread_t thread_id) - { - pthread_cancel(thread_id); - } - - - // Fabrique un identifiant unique pour les threads puisque le thread_id n'est pas unique - // au cours du temps (il peut etre reutilise lorsqu'un thread se termine) - // ATTENTION : cette methode est uniquement protegee par la section critique de l'association - // Thread_id / Id (_thread_id_id_association_mutex) - BatchManager_Local::Id BatchManager_Local::nextId() - { - static Id id = 0; - Id nextId = id++; - //UNDER_LOCK( cout << "BatchManager_Local::Id BatchManager_Local::nextId() : Id = " << nextId << endl ); - return nextId; - } - - - // Retourne l'Id enregistre dans l'association Thread_id / Id et le detruit immediatement - BatchManager_Local::Id BatchManager_Local::getIdByThread_id(pthread_t thread_id) - { - Id id = -1; - - // @@@ --------> SECTION CRITIQUE <-------- @@@ - pthread_mutex_lock(&_thread_id_id_association_mutex); -#ifndef WIN32 //TODO: porting of following functionality - while (_thread_id_id_association.find(thread_id) == _thread_id_id_association.end()) - pthread_cond_wait(&_thread_id_id_association_cond, &_thread_id_id_association_mutex); - - id = _thread_id_id_association[thread_id]; - _thread_id_id_association.erase(thread_id); -#endif - - pthread_mutex_unlock(&_thread_id_id_association_mutex); - // @@@ --------> SECTION CRITIQUE <-------- @@@ - - //UNDER_LOCK( cout << "BatchManager_Local::Id BatchManager_Local::getIdByThread_id(pthread_t thread_id) : Id = " << id << " - thread_id = " << thread_id << endl ); - return id; - } - - - // Associe un Thread_id a un Id nouvellement cree - BatchManager_Local::Id BatchManager_Local::registerThread_id(pthread_t thread_id) - { - Id id = -1; - - // @@@ --------> SECTION CRITIQUE <-------- @@@ - pthread_mutex_lock(&_thread_id_id_association_mutex); -#ifndef WIN32 //TODO: porting of following functionality - if (_thread_id_id_association.find(thread_id) == _thread_id_id_association.end()) { - id = _thread_id_id_association[thread_id] = nextId(); - pthread_cond_signal(&_thread_id_id_association_cond); - - } else { - UNDER_LOCK( cerr << "ERROR : Pthread Inconstency. Two threads own the same thread_id." << endl ); - } -#endif - pthread_mutex_unlock(&_thread_id_id_association_mutex); - // @@@ --------> SECTION CRITIQUE <-------- @@@ - - //UNDER_LOCK( cout << "BatchManager_Local::Id BatchManager_Local::registerThread_id(pthread_t thread_id) : Id = " << id << " - thread_id = " << thread_id << endl ); - return id; - } - - - // Constructeur de la classe ThreadAdapter - BatchManager_Local::ThreadAdapter::ThreadAdapter(BatchManager_Local & bm, const Job_Local & job) : - _bm(bm), _job(job) - { - // Nothing to do - } - - - - // Methode d'execution du thread - void * BatchManager_Local::ThreadAdapter::run(void * arg) - { -#ifndef WIN32 //TODO: porting of following functionality - // On bloque tous les signaux pour ce thread - sigset_t setmask; - sigfillset(&setmask); - pthread_sigmask(SIG_BLOCK, &setmask, NULL); - - // On autorise la terminaison differee du thread - // (ces valeurs sont les valeurs par defaut mais on les force par precaution) - pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL); - pthread_setcanceltype(PTHREAD_CANCEL_DEFERRED, NULL); - - // On enregistre la fonction de suppression du fils en cas d'arret du thread - // Cette fontion sera automatiquement appelee lorsqu'une demande d'annulation - // sera prise en compte par pthread_testcancel() - pid_t child; - pthread_cleanup_push(BatchManager_Local::kill_child_on_exit, static_cast (&child)); - pthread_cleanup_push(BatchManager_Local::delete_on_exit, arg); - - ThreadAdapter * p_ta = static_cast(arg); - - - - - // Le code retour cumule (ORed) de tous les appels - // Nul en cas de reussite de l'ensemble des operations - int rc = 0; - - // Cette table contient la liste des fichiers a detruire a la fin du processus - std::vector files_to_delete; - - - - // On copie les fichiers d'entree pour le fils - const Parametre param = p_ta->_job.getParametre(); - Parametre::const_iterator it; - - // On initialise la variable workdir a la valeur du Current Working Directory - char * cwd = -#ifdef WIN32 - _getcwd(NULL, 0); -#else - new char [PATH_MAX]; - getcwd(cwd, PATH_MAX); -#endif - string workdir = cwd; - delete [] cwd; - - if ( (it = param.find(WORKDIR)) != param.end() ) { - workdir = static_cast( (*it).second ); - } - - string executionhost = string(param[EXECUTIONHOST]); - - if ( (it = param.find(INFILE)) != param.end() ) { - Versatile V = (*it).second; - Versatile::iterator Vit; - - for(Vit=V.begin(); Vit!=V.end(); Vit++) { - CoupleType cpt = *static_cast< CoupleType * >(*Vit); - Couple cp = cpt; - string local = cp.getLocal(); - string remote = cp.getRemote(); - - string copy_cmd = p_ta->getBatchManager().copy_command("", local, executionhost, workdir + "/" + remote); - UNDER_LOCK( cout << "Copying : " << copy_cmd << endl ); - - if (system(copy_cmd.c_str()) ) { - // Echec de la copie - rc |= 1; - } else { - // On enregistre le fichier comme etant a detruire - files_to_delete.push_back(workdir + "/" + remote); - } - - } - } - - - - -#ifdef WIN32 - //TODO - //Using CreateThread instead fork() POSIX function -#else - // On forke/exec un nouveau process pour pouvoir controler le fils - // (plus finement qu'avec un appel system) - // int rc = system(commande.c_str()); - child = fork(); - if (child < 0) { // erreur - UNDER_LOCK( cerr << "Fork impossible (rc=" << child << ")" << endl ); - - } else if (child > 0) { // pere - p_ta->pere(child); - - } else { // fils - p_ta->fils(); - } -#endif - - - - // On copie les fichiers de sortie du fils - if ( (it = param.find(OUTFILE)) != param.end() ) { - Versatile V = (*it).second; - Versatile::iterator Vit; - - for(Vit=V.begin(); Vit!=V.end(); Vit++) { - CoupleType cpt = *static_cast< CoupleType * >(*Vit); - Couple cp = cpt; - string local = cp.getLocal(); - string remote = cp.getRemote(); - - string copy_cmd = p_ta->getBatchManager().copy_command(executionhost, workdir + "/" + remote, "", local); - UNDER_LOCK( cout << "Copying : " << copy_cmd << endl ); - - if (system(copy_cmd.c_str()) ) { - // Echec de la copie - rc |= 1; - } else { - // On enregistre le fichier comme etant a detruire - files_to_delete.push_back(workdir + "/" + remote); - } - - } - } - - - - - // On efface les fichiers d'entree et de sortie du fils si les copies precedentes ont reussi - // ou si la creation du fils n'a pu avoir lieu - if ( (rc == 0) || (child < 0) ) { - std::vector::const_iterator it; - for(it=files_to_delete.begin(); it!=files_to_delete.end(); it++) { - string remove_cmd = p_ta->getBatchManager().remove_command(executionhost, *it); - UNDER_LOCK( cout << "Removing : " << remove_cmd << endl ); - system(remove_cmd.c_str()); - } - } - - - - // On retire la fonction de nettoyage de la memoire - pthread_cleanup_pop(0); - - // On retire la fonction de suppression du fils - pthread_cleanup_pop(0); - - - - // On invoque la fonction de nettoyage de la memoire - delete_on_exit(arg); - - UNDER_LOCK( cout << "Father is leaving" << endl ); - pthread_exit(NULL); -#endif - return NULL; - } - - - - - void BatchManager_Local::ThreadAdapter::pere(pid_t child) - { -#ifndef WIN32 //TODO: porting of following functionality - time_t child_starttime = time(NULL); - - // On enregistre le fils dans la table des threads - pthread_t thread_id = pthread_self(); - Id id = _bm.registerThread_id(thread_id); - - Parametre param = _job.getParametre(); - Environnement env = _job.getEnvironnement(); - - ostringstream thread_id_sst; - thread_id_sst << id; - param[ID] = thread_id_sst.str(); - param[STATE] = "Running"; - param[PID] = child; - - // @@@ --------> SECTION CRITIQUE <-------- @@@ - pthread_mutex_lock(&_bm._threads_mutex); - _bm._threads[id].thread_id = thread_id; - _bm._threads[id].pid = child; - _bm._threads[id].status = RUNNING; - _bm._threads[id].param = param; - _bm._threads[id].env = env; - _bm._threads[id].command_queue.push(NOP); - pthread_mutex_unlock(&_bm._threads_mutex); - // @@@ --------> SECTION CRITIQUE <-------- @@@ - - - - - - // on boucle en attendant que le fils ait termine - while (1) { - int child_rc = 0; - pid_t child_wait_rc = waitpid(child, &child_rc, WNOHANG /* | WUNTRACED */); - if (child_wait_rc > 0) { - if (WIFSTOPPED(child_rc)) { - // NOTA : pour rentrer dans cette section, il faut que le flag WUNTRACED - // soit positionne dans l'appel a waitpid ci-dessus. Ce flag est couramment - // desactive car s'il est possible de detecter l'arret d'un process, il est - // plus difficile de detecter sa reprise. - - // Le fils est simplement stoppe - // @@@ --------> SECTION CRITIQUE <-------- @@@ - pthread_mutex_lock(&_bm._threads_mutex); - _bm._threads[id].status = STOPPED; - _bm._threads[id].param[STATE] = "Stopped"; - pthread_mutex_unlock(&_bm._threads_mutex); - // @@@ --------> SECTION CRITIQUE <-------- @@@ - UNDER_LOCK( cout << "Father sees his child is STOPPED : " << child_wait_rc << endl ); - - } - else { - // Le fils est termine, on sort de la boucle et du if englobant - // @@@ --------> SECTION CRITIQUE <-------- @@@ - pthread_mutex_lock(&_bm._threads_mutex); - _bm._threads[id].status = DONE; - _bm._threads[id].param[STATE] = "Done"; - pthread_mutex_unlock(&_bm._threads_mutex); - // @@@ --------> SECTION CRITIQUE <-------- @@@ - UNDER_LOCK( cout << "Father sees his child is DONE : " << child_wait_rc << " (child_rc=" << (WIFEXITED(child_rc) ? WEXITSTATUS(child_rc) : -1) << ")" << endl ); - break; - } - } - else if (child_wait_rc == -1) { - // Le fils a disparu ... - // @@@ --------> SECTION CRITIQUE <-------- @@@ - pthread_mutex_lock(&_bm._threads_mutex); - _bm._threads[id].status = DEAD; - _bm._threads[id].param[STATE] = "Dead"; - pthread_mutex_unlock(&_bm._threads_mutex); - // @@@ --------> SECTION CRITIQUE <-------- @@@ - UNDER_LOCK( cout << "Father sees his child is DEAD : " << child_wait_rc << " (Reason : " << strerror(errno) << ")" << endl ); - break; - } - - - - // On teste si le thread doit etre detruit - pthread_testcancel(); - - - - // On regarde si le fils n'a pas depasse son temps (wallclock time) - time_t child_currenttime = time(NULL); - time_t child_elapsedtime = child_currenttime - child_starttime; - if (param.find(MAXWALLTIME) != param.end()) { - int maxwalltime = param[MAXWALLTIME]; - // cout << "child_starttime = " << child_starttime << endl - // << "child_currenttime = " << child_currenttime << endl - // << "child_elapsedtime = " << child_elapsedtime << endl - // << "maxwalltime = " << maxwalltime << endl - // << "int(maxwalltime * 1.1) = " << int(maxwalltime * 1.1) << endl; - if (child_elapsedtime > int(maxwalltime * 1.1) ) { // On se donne 10% de marge avant le KILL - UNDER_LOCK( cout << "Father is sending KILL command to the thread " << id << endl ); - // On introduit une commande dans la queue du thread - // @@@ --------> SECTION CRITIQUE <-------- @@@ - pthread_mutex_lock(&_bm._threads_mutex); - if (_bm._threads.find(id) != _bm._threads.end()) - _bm._threads[id].command_queue.push(KILL); - pthread_mutex_unlock(&_bm._threads_mutex); - // @@@ --------> SECTION CRITIQUE <-------- @@@ - - - } else if (child_elapsedtime > maxwalltime ) { - UNDER_LOCK( cout << "Father is sending TERM command to the thread " << id << endl ); - // On introduit une commande dans la queue du thread - // @@@ --------> SECTION CRITIQUE <-------- @@@ - pthread_mutex_lock(&_bm._threads_mutex); - if (_bm._threads.find(id) != _bm._threads.end()) - _bm._threads[id].command_queue.push(TERM); - pthread_mutex_unlock(&_bm._threads_mutex); - // @@@ --------> SECTION CRITIQUE <-------- @@@ - } - } - - - - // On regarde s'il y a quelque chose a faire dans la queue de commande - // @@@ --------> SECTION CRITIQUE <-------- @@@ - pthread_mutex_lock(&_bm._threads_mutex); - if (_bm._threads.find(id) != _bm._threads.end()) { - while (_bm._threads[id].command_queue.size() > 0) { - Commande cmd = _bm._threads[id].command_queue.front(); - _bm._threads[id].command_queue.pop(); - - switch (cmd) { - case NOP: - UNDER_LOCK( cout << "Father does nothing to his child" << endl ); - break; - - case HOLD: - UNDER_LOCK( cout << "Father is sending SIGSTOP signal to his child" << endl ); - kill(child, SIGSTOP); - break; - - case RELEASE: - UNDER_LOCK( cout << "Father is sending SIGCONT signal to his child" << endl ); - kill(child, SIGCONT); - break; - - case TERM: - UNDER_LOCK( cout << "Father is sending SIGTERM signal to his child" << endl ); - kill(child, SIGTERM); - break; - - case KILL: - UNDER_LOCK( cout << "Father is sending SIGKILL signal to his child" << endl ); - kill(child, SIGKILL); - break; - - case ALTER: - break; - - default: - break; - } - } - - } - pthread_mutex_unlock(&_bm._threads_mutex); - // @@@ --------> SECTION CRITIQUE <-------- @@@ - - // On fait une petite pause pour ne pas surcharger inutilement le processeur - sleep(1); - - } -#endif - - - } - - - - - void BatchManager_Local::ThreadAdapter::fils() - { -#ifndef WIN32 //TODO: porting of following functionality - Parametre param = _job.getParametre(); - Parametre::iterator it; - - try { - - // On se place dans le repertoire de travail - if ( (it = param.find(WORKDIR)) != param.end() ) { - string workdir = static_cast( (*it).second ); - chdir(workdir.c_str()); - } - - - - - // EXECUTABLE is MANDATORY, if missing, we exit with failure notification - char * execpath = NULL; - if (param.find(EXECUTABLE) != param.end()) { - string executable = _bm.exec_command(param); - execpath = new char [executable.size() + 1]; - strncpy(execpath, executable.c_str(), executable.size() + 1); - } else exit(1); - - string debug_command = execpath; - - string name = (param.find(NAME) != param.end()) ? param[NAME] : param[EXECUTABLE]; - - char ** argv = NULL; - if (param.find(ARGUMENTS) != param.end()) { - Versatile V = param[ARGUMENTS]; - - argv = new char * [V.size() + 2]; // 1 pour name et 1 pour le NULL terminal - - argv[0] = new char [name.size() + 1]; - strncpy(argv[0], name.c_str(), name.size() + 1); - - debug_command += string(" # ") + argv[0]; - - int i = 1; - for(Versatile::const_iterator it=V.begin(); it!=V.end(); it++, i++) { - StringType argt = * static_cast(*it); - string arg = argt; - argv[i] = new char [arg.size() + 1]; - strncpy(argv[i], arg.c_str(), arg.size() + 1); - debug_command += string(" # ") + argv[i]; - } - - // assert (i == V.size() + 1) - argv[i] = NULL; - } - - - UNDER_LOCK( cout << "*** debug_command = " << debug_command << endl ); - - - - Environnement env = _job.getEnvironnement(); - - - char ** envp = NULL; - if(env.size() > 0) { - envp = new char * [env.size() + 1]; // 1 pour le NULL terminal - int i = 0; - for(Environnement::const_iterator it=env.begin(); it!=env.end(); it++, i++) { - const string & key = (*it).first; - const string & value = (*it).second; - ostringstream oss; - oss << key << "=" << value; - envp[i] = new char [oss.str().size() + 1]; - strncpy(envp[i], oss.str().c_str(), oss.str().size() + 1); - } - - // assert (i == env.size()) - envp[i] = NULL; - } - - - - - // On positionne les limites systeme imposees au fils - if (param.find(MAXCPUTIME) != param.end()) { - int maxcputime = param[MAXCPUTIME]; - struct rlimit limit; - limit.rlim_cur = maxcputime; - limit.rlim_max = int(maxcputime * 1.1); - setrlimit(RLIMIT_CPU, &limit); - } - - if (param.find(MAXDISKSIZE) != param.end()) { - int maxdisksize = param[MAXDISKSIZE]; - struct rlimit limit; - limit.rlim_cur = maxdisksize * 1024; - limit.rlim_max = int(maxdisksize * 1.1) * 1024; - setrlimit(RLIMIT_FSIZE, &limit); - } - - if (param.find(MAXRAMSIZE) != param.end()) { - int maxramsize = param[MAXRAMSIZE]; - struct rlimit limit; - limit.rlim_cur = maxramsize * 1024; - limit.rlim_max = int(maxramsize * 1.1) * 1024; - setrlimit(RLIMIT_AS, &limit); - } - - - - // On cree une session pour le fils de facon a ce qu'il ne soit pas - // detruit lorsque le shell se termine (le shell ouvre une session et - // tue tous les process appartenant a la session en quittant) - setsid(); - - - // On ferme les descripteurs de fichiers standards - //close(STDIN_FILENO); - //close(STDOUT_FILENO); - //close(STDERR_FILENO); - - - // On execute la commande du fils - execve(execpath, argv, envp); - - // No need to deallocate since nothing happens after a successful exec - - // Normalement on ne devrait jamais arriver ici - ofstream file_err("error.log"); - UNDER_LOCK( file_err << "Echec de l'appel a execve" << endl ); - - } catch (GenericException & e) { - - std::cerr << "Caught exception : " << e.type << " : " << e.message << std::endl; - } - - exit(99); -#endif - } - - - - - void BatchManager_Local::kill_child_on_exit(void * p_pid) - { -#ifndef WIN32 - //TODO: porting of following functionality - pid_t child = * static_cast(p_pid); - - // On tue le fils - kill(child, SIGTERM); - - // Nota : on pourrait aussi faire a la suite un kill(child, SIGKILL) - // mais cette option n'est pas implementee pour le moment, car il est - // preferable de laisser le process fils se terminer normalement et seul. -#endif - } - - void BatchManager_Local::delete_on_exit(void * arg) - { - ThreadAdapter * p_ta = static_cast(arg); - delete p_ta; - } - -} diff --git a/src/Batch/Batch_BatchManager_Local.hxx b/src/Batch/Batch_BatchManager_Local.hxx deleted file mode 100644 index 894c75a21..000000000 --- a/src/Batch/Batch_BatchManager_Local.hxx +++ /dev/null @@ -1,174 +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 -// -/* - * BatchManager_Local.hxx : - * - * Auteur : Ivan DUTKA-MALEN - EDF R&D - * Mail : mailto:ivan.dutka-malen@der.edf.fr - * Date : Thu Nov 6 10:17:22 2003 - * Projet : Salome 2 - * - */ - -#ifndef _BATCHMANAGER_LOCAL_H_ -#define _BATCHMANAGER_LOCAL_H_ - -#include "Batch_Defines.hxx" - -#include -#include -#include -#include -#include "Batch_Job.hxx" -#include "Batch_JobId.hxx" -#include "Batch_JobInfo.hxx" -#include "Batch_JobInfo_Local.hxx" -#include "Batch_Job_Local.hxx" -#include "Batch_InvalidArgumentException.hxx" -#include "Batch_ConnexionFailureException.hxx" -#include "Batch_APIInternalFailureException.hxx" -#include "Batch_NotYetImplementedException.hxx" -#include "Batch_BatchManager.hxx" - -namespace Batch { - - class FactBatchManager; - - class BATCH_EXPORT BatchManager_Local : public BatchManager - { - private: - friend class ThreadAdapter; - class ThreadAdapter{ - public: - ThreadAdapter(BatchManager_Local & bm, const Job_Local & job); - static void * run(void * arg); - BatchManager_Local & getBatchManager() const { return _bm; }; - - protected: - BatchManager_Local & _bm; - const Job_Local _job; - - private: - void pere(pid_t child); - void fils(); - - }; - - typedef int Id; - - enum Commande { - NOP = 0, - HOLD, - RELEASE, - TERM, - KILL, - ALTER, - }; - - enum Status { - UNKNOWN = 0, - RUNNING, - STOPPED, - DONE, - DEAD, - }; - - struct Child { - pthread_t thread_id; - std::queue > command_queue; - pid_t pid; - int exit_code; - Status status; - Parametre param; - Environnement env; - }; - - - - public: - // Constructeur et destructeur - BatchManager_Local(const FactBatchManager * parent, const char * host="localhost") throw(InvalidArgumentException,ConnexionFailureException); // connexion a la machine host - virtual ~BatchManager_Local(); - - // Recupere le nom du serveur par defaut - // static string BatchManager_Local::getDefaultServer(); - - // Methodes pour le controle des jobs - virtual const JobId submitJob(const Job & job); // soumet un job au gestionnaire - virtual void deleteJob(const JobId & jobid); // retire un job du gestionnaire - virtual void holdJob(const JobId & jobid); // suspend un job en file d'attente - virtual void releaseJob(const JobId & jobid); // relache un job suspendu - virtual void alterJob(const JobId & jobid, const Parametre & param, const Environnement & env); // modifie un job en file d'attente - virtual void alterJob(const JobId & jobid, const Parametre & param); // modifie un job en file d'attente - virtual void alterJob(const JobId & jobid, const Environnement & env); // modifie un job en file d'attente - virtual JobInfo queryJob(const JobId & jobid); // renvoie l'etat du job - virtual bool isRunning(const JobId & jobid); // teste si un job est present en machine - - virtual void setParametre(const JobId & jobid, const Parametre & param) { return alterJob(jobid, param); } // modifie un job en file d'attente - virtual void setEnvironnement(const JobId & jobid, const Environnement & env) { return alterJob(jobid, env); } // modifie un job en file d'attente - - - protected: - int _connect; // Local connect id - pthread_mutex_t _threads_mutex; - std::map _threads; - - // Methode abstraite qui renvoie la commande de copie du fichier source en destination - virtual std::string copy_command( const std::string & host_source, - const std::string & source, - const std::string & host_destination, - const std::string & destination) const = 0; - - // Methode abstraite qui renvoie la commande a executer - virtual std::string exec_command(Parametre & param) const = 0; - - // Methode abstraite qui renvoie la commande d'effacement du fichier - virtual std::string remove_command( const std::string & host_destination, - const std::string & destination) const = 0; - - private: - virtual pthread_t submit(const Job_Local & job); - virtual void cancel(pthread_t thread_id); - static void kill_child_on_exit(void * p_pid); - static void delete_on_exit(void * arg); - Id nextId(); // Retourne un identifiant unique pour un thread (clef de la map) - Id getIdByThread_id(pthread_t thread_id); - Id registerThread_id(pthread_t thread_id); - pthread_mutex_t _thread_id_id_association_mutex; - pthread_cond_t _thread_id_id_association_cond; -#ifndef WIN32 //TODO: porting of following functionality - //reason: pthread_t on win32 is a struct of pointer and int members - std::map _thread_id_id_association; -#endif - -#ifdef SWIG - public: - // Recupere le l'identifiant d'un job deja soumis au BatchManager - //virtual const JobId getJobIdByReference(const string & ref) { return BatchManager::getJobIdByReference(ref); } - virtual const JobId getJobIdByReference(const char * ref) { return BatchManager::getJobIdByReference(ref); } -#endif - - }; - -} - -#endif diff --git a/src/Batch/Batch_BatchManager_Local_RSH.cxx b/src/Batch/Batch_BatchManager_Local_RSH.cxx deleted file mode 100644 index 9392f8d63..000000000 --- a/src/Batch/Batch_BatchManager_Local_RSH.cxx +++ /dev/null @@ -1,151 +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 -// -/* - * BatchManager_Local_RSH.cxx : - * - * Auteur : Ivan DUTKA-MALEN - EDF R&D - * Mail : mailto:ivan.dutka-malen@der.edf.fr - * Date : Thu Nov 6 10:17:22 2003 - * Projet : Salome 2 - * - */ - -#ifdef HAVE_SALOME_CONFIG -# include -#endif - -#include -#include -#include -#include -#include -#ifndef WIN32 -#include -#include -#endif -#include -#include -#include -#include -#include -#include "Batch_IOMutex.hxx" -#include "Batch_BatchManager_Local_RSH.hxx" - -#ifndef RM -#error "RM undefined. You must set RM to a valid path to a rm-like command." -#endif - -#ifndef RCP -#error "RCP undefined. You must set RCP to a valid path to a rcp-like command." -#endif - -#ifndef RSH -#error "RSH undefined. You must set RSH to a valid path to a rsh-like command." -#endif - -using namespace std; - -namespace Batch { - - - // Constructeur - BatchManager_Local_RSH::BatchManager_Local_RSH(const FactBatchManager * parent, const char * host) throw(InvalidArgumentException,ConnexionFailureException) : BatchManager_Local(parent, host) - { - } - - // Destructeur - BatchManager_Local_RSH::~BatchManager_Local_RSH() - { - } - - - // Methode abstraite qui renvoie la commande de copie du fichier source en destination - string BatchManager_Local_RSH::copy_command(const string & host_source, const string & source, const string & host_destination, const string & destination) const - { - ostringstream fullsource; - if (host_source.size() == 0) { - fullsource << "localhost:"; - } else { - fullsource << host_source << ":"; - } - fullsource << source; - - ostringstream fulldestination; - if (host_destination.size() == 0) { - fulldestination << "localhost:"; - } else { - fulldestination << host_destination << ":"; - } - fulldestination << destination; - - ostringstream copy_cmd; - copy_cmd << RCP << " " << fullsource.str() << " " << fulldestination.str(); - return copy_cmd.str(); - } - - // Methode abstraite qui renvoie la commande a executer - string BatchManager_Local_RSH::exec_command(Parametre & param) const - { - ostringstream exec_sub_cmd; - exec_sub_cmd << param[EXECUTABLE]; - - if (param.find(ARGUMENTS) != param.end()) { - Versatile V = param[ARGUMENTS]; - for(Versatile::const_iterator it=V.begin(); it!=V.end(); it++) { - StringType argt = * static_cast(*it); - string arg = argt; - exec_sub_cmd << " " << arg; - } - } - - - Versatile new_arguments; - new_arguments.setMaxSize(0); - new_arguments = string(param[EXECUTIONHOST]); - - - if (param.find(USER) != param.end()) { - new_arguments += "-l"; - new_arguments += string(param[USER]); - } - - new_arguments += exec_sub_cmd.str(); - - param[ARGUMENTS] = new_arguments; - - // Sous Linux on est oblige de modifier ces deux parametres pour faire fonctionner la commande rsh - param[EXECUTABLE] = RSH; - param.erase(NAME); - - return RSH; - } - - // Methode qui renvoie la commande d'effacement du fichier - string BatchManager_Local_RSH::remove_command(const string & host_destination, const string & destination) const - { - string host = (host_destination.size()) ? host_destination : "localhost:"; - - ostringstream remove_cmd; - remove_cmd << RSH << " " << host << " \"" << RM << " " << destination << "\""; - return remove_cmd.str(); - } -} diff --git a/src/Batch/Batch_BatchManager_Local_RSH.hxx b/src/Batch/Batch_BatchManager_Local_RSH.hxx deleted file mode 100644 index c5c660425..000000000 --- a/src/Batch/Batch_BatchManager_Local_RSH.hxx +++ /dev/null @@ -1,82 +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 -// -/* - * BatchManager_Local_RSH.hxx : - * - * Auteur : Ivan DUTKA-MALEN - EDF R&D - * Mail : mailto:ivan.dutka-malen@der.edf.fr - * Date : Thu Nov 6 10:17:22 2003 - * Projet : Salome 2 - * - */ - -#ifndef _BATCHMANAGER_LOCAL_RSH_H_ -#define _BATCHMANAGER_LOCAL_RSH_H_ - -#include "Batch_Defines.hxx" - -#include -#include -#include -#include -#include -#include "Batch_Job.hxx" -#include "Batch_JobId.hxx" -#include "Batch_JobInfo.hxx" -#include "Batch_JobInfo_Local.hxx" -#include "Batch_Job_Local.hxx" -#include "Batch_InvalidArgumentException.hxx" -#include "Batch_ConnexionFailureException.hxx" -#include "Batch_APIInternalFailureException.hxx" -#include "Batch_NotYetImplementedException.hxx" -#include "Batch_BatchManager_Local.hxx" - -namespace Batch { - - class FactBatchManager; - - class BATCH_EXPORT BatchManager_Local_RSH : public BatchManager_Local - { - public: - // Constructeur et destructeur - BatchManager_Local_RSH(const FactBatchManager * parent, const char * host="localhost") throw(InvalidArgumentException,ConnexionFailureException); // connexion a la machine host - virtual ~BatchManager_Local_RSH(); - - protected: - // Methode abstraite qui renvoie la commande de copie du fichier source en destination - virtual std::string copy_command( const std::string & host_source, - const std::string & source, - const std::string & host_destination, - const std::string & destination) const; - - // Methode abstraite qui renvoie la commande a executer - virtual std::string exec_command(Parametre & param) const; - - // Methode qui renvoie la commande d'effacement du fichier - virtual std::string remove_command( const std::string & host_destination, - const std::string & destination) const; - - }; - -} - -#endif diff --git a/src/Batch/Batch_BatchManager_Local_SH.cxx b/src/Batch/Batch_BatchManager_Local_SH.cxx deleted file mode 100644 index 6eb790933..000000000 --- a/src/Batch/Batch_BatchManager_Local_SH.cxx +++ /dev/null @@ -1,118 +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 -// -/* - * BatchManager_Local_SH.cxx : - * - * Auteur : Ivan DUTKA-MALEN - EDF R&D - * Mail : mailto:ivan.dutka-malen@der.edf.fr - * Date : Thu Nov 6 10:17:22 2003 - * Projet : Salome 2 - * - */ - -#ifdef HAVE_SALOME_CONFIG -# include -#endif - -#include -#include -#include -#include -#include -#ifndef WIN32 -#include -#include -#endif -#include -#include -#include -#include -#include -#include "Batch_IOMutex.hxx" -#include "Batch_BatchManager_Local_SH.hxx" - -#ifndef RM -#error "RM undefined. You must set RM to a valid path to a rm-like command." -#endif - -#ifndef CP -#error "CP undefined. You must set CP to a valid path to a cp-like command." -#endif - -#ifndef SH -#error "SH undefined. You must set SH to a valid path to a sh-like command." -#endif - -using namespace std; - -namespace Batch { - - - // Constructeur - BatchManager_Local_SH::BatchManager_Local_SH(const FactBatchManager * parent, const char * host) throw(InvalidArgumentException,ConnexionFailureException) : BatchManager_Local(parent, host) - { - } - - // Destructeur - BatchManager_Local_SH::~BatchManager_Local_SH() - { - } - - - // Methode qui renvoie la commande de copie du fichier source en destination - string BatchManager_Local_SH::copy_command(const string & host_source, const string & source, const string & host_destination, const string & destination) const - { - ostringstream copy_cmd; - copy_cmd << CP << " " << source << " " << destination; - return copy_cmd.str(); - } - - // Methode qui renvoie la commande a executer - string BatchManager_Local_SH::exec_command(Parametre & param) const - { - ostringstream exec_sub_cmd; - exec_sub_cmd << param[EXECUTABLE]; - - if (param.find(ARGUMENTS) != param.end()) { - Versatile V = param[ARGUMENTS]; - for(Versatile::const_iterator it=V.begin(); it!=V.end(); it++) { - StringType argt = * static_cast(*it); - string arg = argt; - exec_sub_cmd << " " << arg; - } - } - - param[ARGUMENTS] = "-c"; - param[ARGUMENTS] += exec_sub_cmd.str(); - - return SH; - } - - // Methode qui renvoie la commande d'effacement du fichier - string BatchManager_Local_SH::remove_command(const string & host_destination, const string & destination) const - { - ostringstream remove_cmd; - remove_cmd << RM << " " << destination; - return remove_cmd.str(); - } - -} diff --git a/src/Batch/Batch_BatchManager_Local_SH.hxx b/src/Batch/Batch_BatchManager_Local_SH.hxx deleted file mode 100644 index 23b59097a..000000000 --- a/src/Batch/Batch_BatchManager_Local_SH.hxx +++ /dev/null @@ -1,82 +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 -// -/* - * BatchManager_Local_SH.hxx : - * - * Auteur : Ivan DUTKA-MALEN - EDF R&D - * Mail : mailto:ivan.dutka-malen@der.edf.fr - * Date : Thu Nov 6 10:17:22 2003 - * Projet : Salome 2 - * - */ - -#ifndef _BATCHMANAGER_LOCAL_SH_H_ -#define _BATCHMANAGER_LOCAL_SH_H_ - -#include "Batch_Defines.hxx" - -#include -#include -#include -#include -#include -#include "Batch_Job.hxx" -#include "Batch_JobId.hxx" -#include "Batch_JobInfo.hxx" -#include "Batch_JobInfo_Local.hxx" -#include "Batch_Job_Local.hxx" -#include "Batch_InvalidArgumentException.hxx" -#include "Batch_ConnexionFailureException.hxx" -#include "Batch_APIInternalFailureException.hxx" -#include "Batch_NotYetImplementedException.hxx" -#include "Batch_BatchManager_Local.hxx" - -namespace Batch { - - class FactBatchManager; - - class BATCH_EXPORT BatchManager_Local_SH : public BatchManager_Local - { - public: - // Constructeur et destructeur - BatchManager_Local_SH(const FactBatchManager * parent, const char * host="localhost") throw(InvalidArgumentException,ConnexionFailureException); // connexion a la machine host - virtual ~BatchManager_Local_SH(); - - protected: - // Methode qui renvoie la commande de copie du fichier source en destination - virtual std::string copy_command( const std::string & host_source, - const std::string & source, - const std::string & host_destination, - const std::string & destination) const; - - // Methode qui renvoie la commande a executer - virtual std::string exec_command(Parametre & param) const; - - // Methode qui renvoie la commande d'effacement du fichier - virtual std::string remove_command( const std::string & host_destination, - const std::string & destination) const; - - }; - -} - -#endif diff --git a/src/Batch/Batch_BatchManager_Local_SSH.cxx b/src/Batch/Batch_BatchManager_Local_SSH.cxx deleted file mode 100644 index 59c77fccc..000000000 --- a/src/Batch/Batch_BatchManager_Local_SSH.cxx +++ /dev/null @@ -1,152 +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 -// -/* - * BatchManager_Local_SSH.cxx : - * - * Auteur : Ivan DUTKA-MALEN - EDF R&D - * Mail : mailto:ivan.dutka-malen@der.edf.fr - * Date : Thu Nov 6 10:17:22 2003 - * Projet : Salome 2 - * - */ - -#ifdef HAVE_SALOME_CONFIG -# include -#endif - -#include -#include -#include -#include -#include -#ifndef WIN32 -#include -#include -#endif -#include - -#include -#include -#include -#include -#include "Batch_IOMutex.hxx" -#include "Batch_BatchManager_Local_SSH.hxx" - -#ifndef RM -#error "RM undefined. You must set RM to a valid path to a rm-like command." -#endif - -#ifndef RCP -#error "RCP undefined. You must set RCP to a valid path to a scp-like command." -#endif - -#ifndef SSH -#error "SSH undefined. You must set SSH to a valid path to a ssh-like command." -#endif - -using namespace std; - -namespace Batch { - - - // Constructeur - BatchManager_Local_SSH::BatchManager_Local_SSH(const FactBatchManager * parent, const char * host) throw(InvalidArgumentException,ConnexionFailureException) : BatchManager_Local(parent, host) - { - } - - // Destructeur - BatchManager_Local_SSH::~BatchManager_Local_SSH() - { - } - - - // Methode abstraite qui renvoie la commande de copie du fichier source en destination - string BatchManager_Local_SSH::copy_command(const string & host_source, const string & source, const string & host_destination, const string & destination) const - { - ostringstream fullsource; - if (host_source.size() == 0) { - fullsource << "localhost:"; - } else { - fullsource << host_source << ":"; - } - fullsource << source; - - ostringstream fulldestination; - if (host_destination.size() == 0) { - fulldestination << "localhost:"; - } else { - fulldestination << host_destination << ":"; - } - fulldestination << destination; - - ostringstream copy_cmd; - copy_cmd << RCP << " " << fullsource.str() << " " << fulldestination.str(); - return copy_cmd.str(); - } - - // Methode abstraite qui renvoie la commande a executer - string BatchManager_Local_SSH::exec_command(Parametre & param) const - { - ostringstream exec_sub_cmd; - exec_sub_cmd << param[EXECUTABLE]; - - if (param.find(ARGUMENTS) != param.end()) { - Versatile V = param[ARGUMENTS]; - for(Versatile::const_iterator it=V.begin(); it!=V.end(); it++) { - StringType argt = * static_cast(*it); - string arg = argt; - exec_sub_cmd << " " << arg; - } - } - - - Versatile new_arguments; - new_arguments.setMaxSize(0); - new_arguments = string(param[EXECUTIONHOST]); - - - if (param.find(USER) != param.end()) { - new_arguments += "-l"; - new_arguments += string(param[USER]); - } - - new_arguments += exec_sub_cmd.str(); - - param[ARGUMENTS] = new_arguments; - - // Sous Linux on est oblige de modifier ces deux parametres pour faire fonctionner la commande rsh - param[EXECUTABLE] = SSH; - param.erase(NAME); - - return SSH; - } - - // Methode qui renvoie la commande d'effacement du fichier - string BatchManager_Local_SSH::remove_command(const string & host_destination, const string & destination) const - { - string host = (host_destination.size()) ? host_destination : "localhost:"; - - ostringstream remove_cmd; - remove_cmd << SSH << " " << host << " \"" << RM << " " << destination << "\""; - return remove_cmd.str(); - } -} diff --git a/src/Batch/Batch_BatchManager_Local_SSH.hxx b/src/Batch/Batch_BatchManager_Local_SSH.hxx deleted file mode 100644 index 12772fb46..000000000 --- a/src/Batch/Batch_BatchManager_Local_SSH.hxx +++ /dev/null @@ -1,82 +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 -// -/* - * BatchManager_Local_SSH.hxx : - * - * Auteur : Ivan DUTKA-MALEN - EDF R&D - * Mail : mailto:ivan.dutka-malen@der.edf.fr - * Date : Thu Nov 6 10:17:22 2003 - * Projet : Salome 2 - * - */ - -#ifndef _BATCHMANAGER_LOCAL_SSH_H_ -#define _BATCHMANAGER_LOCAL_SSH_H_ - -#include "Batch_Defines.hxx" - -#include -#include -#include -#include -#include -#include "Batch_Job.hxx" -#include "Batch_JobId.hxx" -#include "Batch_JobInfo.hxx" -#include "Batch_JobInfo_Local.hxx" -#include "Batch_Job_Local.hxx" -#include "Batch_InvalidArgumentException.hxx" -#include "Batch_ConnexionFailureException.hxx" -#include "Batch_APIInternalFailureException.hxx" -#include "Batch_NotYetImplementedException.hxx" -#include "Batch_BatchManager_Local.hxx" - -namespace Batch { - - class FactBatchManager; - - class BATCH_EXPORT BatchManager_Local_SSH : public BatchManager_Local - { - public: - // Constructeur et destructeur - BatchManager_Local_SSH(const FactBatchManager * parent, const char * host="localhost") throw(InvalidArgumentException,ConnexionFailureException); // connexion a la machine host - virtual ~BatchManager_Local_SSH(); - - protected: - // Methode abstraite qui renvoie la commande de copie du fichier source en destination - virtual std::string copy_command( const std::string & host_source, - const std::string & source, - const std::string & host_destination, - const std::string & destination) const; - - // Methode abstraite qui renvoie la commande a executer - virtual std::string exec_command(Parametre & param) const; - - // Methode qui renvoie la commande d'effacement du fichier - virtual std::string remove_command( const std::string & host_destination, - const std::string & destination) const; - - }; - -} - -#endif diff --git a/src/Batch/Batch_BatchManager_PBS.cxx b/src/Batch/Batch_BatchManager_PBS.cxx deleted file mode 100644 index dd2b1b812..000000000 --- a/src/Batch/Batch_BatchManager_PBS.cxx +++ /dev/null @@ -1,216 +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 -// -/* - * BatchManager_PBS.cxx : - * - * Auteur : Ivan DUTKA-MALEN - EDF R&D - * Mail : mailto:ivan.dutka-malen@der.edf.fr - * Date : Thu Nov 6 10:17:22 2003 - * Projet : Salome 2 - * - */ - -extern "C" { -#include -#include -} -#include -#include -#include -//#include "MEDMEM_STRING.hxx" -#include "Batch_BatchManager_PBS.hxx" -using namespace std; - -namespace Batch { - - // Recupere le nom du serveur par defaut -// string BatchManager_PBS::getDefaultServer() { -// string server_name = "localhost"; - -// const char * server_name_path = "@openpbsspooldir@/server_name"; -// ifstream server_name_file(server_name_path); -// if (server_name_file) { -// server_name_file >> server_name; -// server_name_file.close(); -// } - -// return server_name; -// } - - // Constructeur -// BatchManager_PBS::BatchManager_PBS() throw(InvalidArgumentException,ConnexionFailureException) : BatchManager(BatchManager_PBS::getDefaultServer()) -// { -// // On se connecte au serveur PBS -// _connect = pbs_connect(const_cast< char * >(_hostname.c_str())); -// if (_connect < 0) { // si erreur -// char * errmsg = pbs_geterrmsg(_connect); -// string msg = "PBS Server on host \""; -// msg += _hostname; -// msg += "\" : "; -// msg += errmsg ? errmsg : "Reason unknown"; -// throw ConnexionFailureException(msg.c_str()); -// } -// } - - // Constructeur -// BatchManager_PBS::BatchManager_PBS(string host) throw(InvalidArgumentException,ConnexionFailureException) : BatchManager(host) -// { -// // On se connecte au serveur PBS -// _connect = pbs_connect(const_cast< char * >(_hostname.c_str())); -// if (_connect < 0) { // si erreur -// char * errmsg = pbs_geterrmsg(_connect); -// string msg = "PBS Server on host \""; -// msg += _hostname; -// msg += "\" : "; -// msg += errmsg ? errmsg : "Reason unknown"; -// throw ConnexionFailureException(msg.c_str()); -// } -// } - BatchManager_PBS::BatchManager_PBS(const FactBatchManager * parent, const char * host) throw(InvalidArgumentException,ConnexionFailureException) : BatchManager(parent, host) - { - // On se connecte au serveur PBS - _connect = pbs_connect(const_cast< char * >(_hostname.c_str())); - if (_connect < 0) { // si erreur - char * errmsg = pbs_geterrmsg(_connect); - string msg = "PBS Server on host \""; - msg += _hostname; - msg += "\" : "; - msg += errmsg ? errmsg : "Reason unknown"; - throw ConnexionFailureException(msg.c_str()); - } - } - - // Destructeur - BatchManager_PBS::~BatchManager_PBS() - { - // On se deconnecte du serveur PBS - int rc = pbs_disconnect(_connect); - if (rc < 0) { // si erreur - string msg = "PBS Server on host \""; - msg += _hostname; - msg += "\" : "; - msg += pbs_geterrmsg(_connect); - throw ConnexionFailureException(msg.c_str()); - } - } - - // Methode pour le controle des jobs : soumet un job au gestionnaire - const JobId BatchManager_PBS::submitJob(const Job & job) - { - Job_PBS jobpbs = job; - char * ref = pbs_submit(_connect, - jobpbs.getAttributesOP(), - jobpbs.getScript(), - jobpbs.getDestination(), - NULL); - if (!ref) { // si erreur - char * msg = pbs_geterrmsg(_connect); - if (!msg) msg = "unknown"; - throw APIInternalFailureException(string("PBS submit error. Reason : ") + msg); - } - - JobId id(this, string(ref)); - free(ref); - return id; - } - - // Methode pour le controle des jobs : retire un job du gestionnaire - void BatchManager_PBS::deleteJob(const JobId & jobid) - { - char * ref = const_cast< char * >(jobid.getReference().c_str()); - int rc = pbs_deljob(_connect, ref, 0); - if (rc) { // si erreur - char * msg = pbs_geterrmsg(_connect); - if (!msg) msg = "unknown"; - throw APIInternalFailureException(string("PBS deljob error. Reason : ") + msg); - } - } - - // Methode pour le controle des jobs : suspend un job en file d'attente - void BatchManager_PBS::holdJob(const JobId & jobid) - { - char * ref = const_cast< char * >(jobid.getReference().c_str()); - int rc = pbs_holdjob(_connect, ref, USER_HOLD, 0); - if (rc) { // si erreur - char * msg = pbs_geterrmsg(_connect); - if (!msg) msg = "unknown"; - throw APIInternalFailureException(string("PBS holdjob error. Reason : ") + msg); - } - } - - // Methode pour le controle des jobs : relache un job suspendu - void BatchManager_PBS::releaseJob(const JobId & jobid) - { - char * ref = const_cast< char * >(jobid.getReference().c_str()); - int rc = pbs_rlsjob(_connect, ref, USER_HOLD, 0); - if (rc) { // si erreur - char * msg = pbs_geterrmsg(_connect); - if (!msg) msg = "unknown"; - throw APIInternalFailureException(string("PBS rlsjob error. Reason : ") + msg); - } - } - - - // Methode pour le controle des jobs : modifie un job en file d'attente - void BatchManager_PBS::alterJob(const JobId & jobid, const Parametre & param, const Environnement & env) - { - Job job(param, env); - Job_PBS jobpbs(job); - - char * ref = const_cast< char * >(jobid.getReference().c_str()); - int rc = pbs_alterjob(_connect, - ref, - jobpbs.getAttributes(), - NULL); - if (rc) { // si erreur - char * msg = pbs_geterrmsg(_connect); - if (!msg) msg = "unknown"; - throw APIInternalFailureException(string("PBS alterjob error. Reason : ") + msg); - } - - } - - // Methode pour le controle des jobs : modifie un job en file d'attente - void BatchManager_PBS::alterJob(const JobId & jobid, const Parametre & param) - { - alterJob(jobid, param, Environnement()); - } - - // Methode pour le controle des jobs : modifie un job en file d'attente - void BatchManager_PBS::alterJob(const JobId & jobid, const Environnement & env) - { - alterJob(jobid, Parametre(), env); - } - - - - // Methode pour le controle des jobs : renvoie l'etat du job - JobInfo BatchManager_PBS::queryJob(const JobId & jobid) - { - char * id = const_cast< char * >(jobid.getReference().c_str()); - JobInfo_PBS ji = JobInfo_PBS(pbs_statjob(_connect, id, 0, 0), true); - return ji; - } - - - -} diff --git a/src/Batch/Batch_BatchManager_PBS.hxx b/src/Batch/Batch_BatchManager_PBS.hxx deleted file mode 100644 index ee6ac8218..000000000 --- a/src/Batch/Batch_BatchManager_PBS.hxx +++ /dev/null @@ -1,98 +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 -// -/* - * BatchManager_PBS.hxx : - * - * Auteur : Ivan DUTKA-MALEN - EDF R&D - * Mail : mailto:ivan.dutka-malen@der.edf.fr - * Date : Thu Nov 6 10:17:22 2003 - * Projet : Salome 2 - * - */ - -#ifndef _BATCHMANAGER_PBS_H_ -#define _BATCHMANAGER_PBS_H_ - -#include "Batch_Defines.hxx" - -#include "Batch_Job.hxx" -#include "Batch_Job.hxx" -#include "Batch_JobId.hxx" -#include "Batch_JobInfo.hxx" -#include "Batch_JobInfo_PBS.hxx" -#include "Batch_Job_PBS.hxx" -#include "Batch_InvalidArgumentException.hxx" -#include "Batch_ConnexionFailureException.hxx" -#include "Batch_APIInternalFailureException.hxx" -#include "Batch_NotYetImplementedException.hxx" -#include "Batch_BatchManager.hxx" - -namespace Batch { - - class Job; - class JobId; - class JobInfo; - class FactBatchManager; - - class BATCH_EXPORT BatchManager_PBS : public BatchManager - { - public: - // Constructeur et destructeur - //BatchManager_PBS() throw(InvalidArgumentException,ConnexionFailureException); // connexion au serveur par defaut - //BatchManager_PBS(std::string host) throw(InvalidArgumentException,ConnexionFailureException); // connexion a la machine host - BatchManager_PBS(const FactBatchManager * parent, const char * host="localhost") throw(InvalidArgumentException,ConnexionFailureException); // connexion a la machine host - virtual ~BatchManager_PBS(); - - // Recupere le nom du serveur par defaut - // static std::string BatchManager_PBS::getDefaultServer(); - - // Methodes pour le controle des jobs - virtual const JobId submitJob(const Job & job); // soumet un job au gestionnaire - virtual void deleteJob(const JobId & jobid); // retire un job du gestionnaire - virtual void holdJob(const JobId & jobid); // suspend un job en file d'attente - virtual void releaseJob(const JobId & jobid); // relache un job suspendu - virtual void alterJob(const JobId & jobid, const Parametre & param, const Environnement & env); // modifie un job en file d'attente - virtual void alterJob(const JobId & jobid, const Parametre & param); // modifie un job en file d'attente - virtual void alterJob(const JobId & jobid, const Environnement & env); // modifie un job en file d'attente - virtual JobInfo queryJob(const JobId & jobid); // renvoie l'etat du job - - virtual void setParametre(const JobId & jobid, const Parametre & param) { return alterJob(jobid, param); } // modifie un job en file d'attente - virtual void setEnvironnement(const JobId & jobid, const Environnement & env) { return alterJob(jobid, env); } // modifie un job en file d'attente - - - protected: - int _connect; // PBS connect id - - private: - -#ifdef SWIG - public: - // Recupere le l'identifiant d'un job deja soumis au BatchManager - //virtual const JobId getJobIdByReference(const std::string & ref) { return BatchManager::getJobIdByReference(ref); } - virtual const JobId getJobIdByReference(const char * ref) { return BatchManager::getJobIdByReference(ref); } -#endif - - }; - -} - -#endif diff --git a/src/Batch/Batch_BatchManager_eClient.cxx b/src/Batch/Batch_BatchManager_eClient.cxx deleted file mode 100644 index 5ff48dd1f..000000000 --- a/src/Batch/Batch_BatchManager_eClient.cxx +++ /dev/null @@ -1,252 +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 -// -/* -* BatchManager_eLSF.cxx : emulation of LSF client -* -* Auteur : Bernard SECHER - CEA DEN -* Mail : mailto:bernard.secher@cea.fr -* Date : Thu Apr 24 10:17:22 2008 -* Projet : PAL Salome -* -*/ - -#include "Batch_BatchManager_eClient.hxx" -#include "Batch_RunTimeException.hxx" -#include "Batch_NotYetImplementedException.hxx" - -#include -#include -#include -#include -#include -#include - -using namespace std; - - -namespace Batch { - - BatchManager_eClient::BatchManager_eClient(const Batch::FactBatchManager * parent, const char* host, const char* protocol, const char* mpiImpl) : BatchManager(parent, host), _protocol(protocol), _username("") - { - // instanciation of mpi implementation needed to launch executable in batch script - _mpiImpl = FactoryMpiImpl(mpiImpl); - } - - // Destructeur - BatchManager_eClient::~BatchManager_eClient() - { - // Nothing to do - delete _mpiImpl; - } - - void BatchManager_eClient::exportInputFiles(const Job& job) throw(EmulationException) - { - int status; - Parametre params = job.getParametre(); - Versatile V = params[INFILE]; - Versatile::iterator Vit; - string command; - string copy_command; - _username = string(params[USER]); - - // Test protocol - if( _protocol == "rsh" ) - copy_command = "rcp "; - else if( _protocol == "ssh" ) - copy_command = "scp "; - else - throw EmulationException("Unknown protocol : only rsh and ssh are known !"); - - // First step : creating batch tmp files directory - command = _protocol; - command += " "; - if(_username != ""){ - command += _username; - command += "@"; - } - command += _hostname; - command += " \"mkdir -p "; - command += string(params[TMPDIR]); - command += "\"" ; - cerr << command.c_str() << endl; - status = system(command.c_str()); - if(status) { - std::ostringstream oss; - oss << status; - std::string ex_mess("Error of connection on remote host ! status = "); - ex_mess += oss.str(); - throw EmulationException(ex_mess.c_str()); - } - - // Second step : copy fileToExecute into - // batch tmp files directory - string executeFile = params[EXECUTABLE]; - if( executeFile.size() > 0 ){ - command = copy_command; - command += string(params[EXECUTABLE]); - command += " "; - if(_username != ""){ - command += _username; - command += "@"; - } - command += _hostname; - command += ":"; - command += string(params[TMPDIR]); - cerr << command.c_str() << endl; - status = system(command.c_str()); - if(status) { - std::ostringstream oss; - oss << status; - std::string ex_mess("Error of connection on remote host ! status = "); - ex_mess += oss.str(); - throw EmulationException(ex_mess.c_str()); - } - } - - // Third step : copy filesToExportList into - // batch tmp files directory - for(Vit=V.begin(); Vit!=V.end(); Vit++) { - CoupleType cpt = *static_cast< CoupleType * >(*Vit); - Couple inputFile = cpt; - command = copy_command; - command += inputFile.getLocal(); - command += " "; - if(_username != ""){ - command += _username; - command += "@"; - } - command += _hostname; - command += ":"; - command += inputFile.getRemote(); - cerr << command.c_str() << endl; - status = system(command.c_str()); - if(status) { - std::ostringstream oss; - oss << status; - std::string ex_mess("Error of connection on remote host ! status = "); - ex_mess += oss.str(); - throw EmulationException(ex_mess.c_str()); - } - } - - } - - void BatchManager_eClient::importOutputFiles( const Job & job, const string directory ) throw(EmulationException) - { - string command; - int status; - - Parametre params = job.getParametre(); - Versatile V = params[OUTFILE]; - Versatile::iterator Vit; - - for(Vit=V.begin(); Vit!=V.end(); Vit++) { - CoupleType cpt = *static_cast< CoupleType * >(*Vit); - Couple outputFile = cpt; - if( _protocol == "rsh" ) - command = "rcp "; - else if( _protocol == "ssh" ) - command = "scp "; - else - throw EmulationException("Unknown protocol"); - - if (_username != ""){ - command += _username; - command += "@"; - } - command += _hostname; - command += ":"; - command += outputFile.getRemote(); - command += " "; - command += directory; - cerr << command.c_str() << endl; - status = system(command.c_str()); - if(status) - { - // Try to get what we can (logs files) - // throw BatchException("Error of connection on remote host"); - std::string mess("Copy command failed ! status is :"); - ostringstream status_str; - status_str << status; - mess += status_str.str(); - cerr << mess << endl; - } - } - - } - - MpiImpl *BatchManager_eClient::FactoryMpiImpl(string mpiImpl) throw(EmulationException) - { - if(mpiImpl == "lam") - return new MpiImpl_LAM(); - else if(mpiImpl == "mpich1") - return new MpiImpl_MPICH1(); - else if(mpiImpl == "mpich2") - return new MpiImpl_MPICH2(); - else if(mpiImpl == "openmpi") - return new MpiImpl_OPENMPI(); - else if(mpiImpl == "slurm") - return new MpiImpl_SLURM(); - else if(mpiImpl == "prun") - return new MpiImpl_PRUN(); - else if(mpiImpl == "nompi") - throw EmulationException("you must specified an mpi implementation for batch manager"); - else{ - ostringstream oss; - oss << mpiImpl << " : not yet implemented"; - throw EmulationException(oss.str().c_str()); - } - } - - /** - * This method creates a temporary file and opens an output stream to write into this file. - * The file is created with the pattern "/tmp/batch_XXXXXX" where the X's are replaced by random - * characters. The caller is responsible for closing and deleting the file when it is no more used. - * \param outputStream an output stream that will be opened for writing in the temporary file. If - * the stream is already open, it will be closed first. - * \return the name of the created file. - */ - string BatchManager_eClient::createAndOpenTemporaryFile(ofstream & outputStream) const - { - string fileName; -#ifdef WIN32 - throw NotYetImplementedException("Temporary file creation in Batch library has not been ported to Windows yet"); -#else - char * tmpFileName = strdup("/tmp/batch_XXXXXX"); - int fd = mkstemp(tmpFileName); - if (fd == -1) - { - throw RunTimeException("Can't create temporary file"); - } - - if (outputStream.is_open()) - outputStream.close(); - outputStream.open(tmpFileName); - close(fd); // Close the file descriptor so that the file is not opened twice - - fileName = tmpFileName; - delete[] tmpFileName; -#endif - return fileName; - } - -} diff --git a/src/Batch/Batch_BatchManager_eClient.hxx b/src/Batch/Batch_BatchManager_eClient.hxx deleted file mode 100644 index c8f401386..000000000 --- a/src/Batch/Batch_BatchManager_eClient.hxx +++ /dev/null @@ -1,77 +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 -// -/* - * BatchManager_eLSF.hxx : emulation of client - * - * Auteur : Bernard SECHER - CEA DEN - * Mail : mailto:bernard.secher@cea.fr - * Date : Thu Apr 24 10:17:22 2008 - * Projet : PAL Salome - * - */ - -#ifndef _BATCHMANAGER_eClient_H_ -#define _BATCHMANAGER_eClient_H_ - -#include "Batch_Defines.hxx" - -#include "MpiImpl.hxx" -#include "Batch_BatchManager.hxx" - -#include - -namespace Batch { - - class Job; - - class BATCH_EXPORT EmulationException - { - public: - const std::string msg; - - EmulationException(const std::string m) : msg(m) {} - }; - - class BATCH_EXPORT BatchManager_eClient : public BatchManager - { - public: - // Constructeur et destructeur - BatchManager_eClient(const Batch::FactBatchManager * parent, const char* host="localhost", const char* protocol="ssh", const char* mpiImpl="mpich1"); - virtual ~BatchManager_eClient(); - void importOutputFiles( const Job & job, const std::string directory ) throw(EmulationException); - - protected: - std::string _protocol; // protocol to access _hostname - std::string _username; // username to access _hostname - MpiImpl *_mpiImpl; // Mpi implementation to launch executable in batch script - - std::string createAndOpenTemporaryFile(std::ofstream & outputStream) const; - MpiImpl* FactoryMpiImpl(std::string mpiImpl) throw(EmulationException); - void exportInputFiles(const Job & job) throw(EmulationException); - - private: - - }; - -} - -#endif diff --git a/src/Batch/Batch_BatchManager_eLSF.cxx b/src/Batch/Batch_BatchManager_eLSF.cxx deleted file mode 100644 index e48690c47..000000000 --- a/src/Batch/Batch_BatchManager_eLSF.cxx +++ /dev/null @@ -1,362 +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 -// -/* - * BatchManager_eLSF.cxx : emulation of LSF client - * - * Auteur : Bernard SECHER - CEA DEN - * Mail : mailto:bernard.secher@cea.fr - * Date : Thu Apr 24 10:17:22 2008 - * Projet : PAL Salome - * - */ - -#include -#include -#include -#include -#include -#include - -#include "Batch_BatchManager_eLSF.hxx" -#ifdef WIN32 -# include -# include -#else -# include -#endif - -using namespace std; - -namespace Batch { - - BatchManager_eLSF::BatchManager_eLSF(const FactBatchManager * parent, const char * host, const char * protocol, const char * mpiImpl) throw(InvalidArgumentException,ConnexionFailureException) : BatchManager_eClient(parent,host,protocol,mpiImpl) - { - // Nothing to do - } - - // Destructeur - BatchManager_eLSF::~BatchManager_eLSF() - { - // Nothing to do - } - - // Methode pour le controle des jobs : soumet un job au gestionnaire - const JobId BatchManager_eLSF::submitJob(const Job & job) - { - int status; - Parametre params = job.getParametre(); - const std::string dirForTmpFiles = params[TMPDIR]; - const string fileToExecute = params[EXECUTABLE]; - std::string fileNameToExecute; - if( fileToExecute.size() > 0 ){ - string::size_type p1 = fileToExecute.find_last_of("/"); - string::size_type p2 = fileToExecute.find_last_of("."); - fileNameToExecute = fileToExecute.substr(p1+1,p2-p1-1); - } - else - fileNameToExecute = "command"; - - // export input files on cluster - exportInputFiles(job); - - // build batch script for job - buildBatchScript(job); - - // define name of log file - string logFile="/tmp/logs/"; - logFile += getenv("USER"); - logFile += "/batchSalome_"; - srand ( time(NULL) ); - int ir = rand(); - ostringstream oss; - oss << ir; - logFile += oss.str(); - logFile += ".log"; - - string command; - - // define command to submit batch - command = _protocol; - command += " "; - - if(_username != ""){ - command += _username; - command += "@"; - } - - command += _hostname; - command += " \"cd " ; - command += dirForTmpFiles ; - command += "; bsub < " ; - command += fileNameToExecute ; - command += "_Batch.sh\" > "; - command += logFile; - cerr << command.c_str() << endl; - status = system(command.c_str()); - if(status) - throw EmulationException("Error of connection on remote host"); - - // read id of submitted job in log file - char line[128]; - FILE *fp = fopen(logFile.c_str(),"r"); - fgets( line, 128, fp); - fclose(fp); - - string sline(line); - int p10 = sline.find("<"); - int p20 = sline.find(">"); - string strjob = sline.substr(p10+1,p20-p10-1); - - JobId id(this, strjob); - return id; - } - - // Methode pour le controle des jobs : retire un job du gestionnaire - void BatchManager_eLSF::deleteJob(const JobId & jobid) - { - int status; - int ref; - istringstream iss(jobid.getReference()); - iss >> ref; - - // define command to submit batch - string command; - command = _protocol; - command += " "; - - if (_username != ""){ - command += _username; - command += "@"; - } - - command += _hostname; - command += " \"bkill " ; - command += iss.str(); - command += "\""; - cerr << command.c_str() << endl; - status = system(command.c_str()); - if(status) - throw EmulationException("Error of connection on remote host"); - - cerr << "jobId = " << ref << "killed" << endl; - } - - // Methode pour le controle des jobs : suspend un job en file d'attente - void BatchManager_eLSF::holdJob(const JobId & jobid) - { - throw EmulationException("Not yet implemented"); - } - - // Methode pour le controle des jobs : relache un job suspendu - void BatchManager_eLSF::releaseJob(const JobId & jobid) - { - throw EmulationException("Not yet implemented"); - } - - - // Methode pour le controle des jobs : modifie un job en file d'attente - void BatchManager_eLSF::alterJob(const JobId & jobid, const Parametre & param, const Environnement & env) - { - throw EmulationException("Not yet implemented"); - } - - // Methode pour le controle des jobs : modifie un job en file d'attente - void BatchManager_eLSF::alterJob(const JobId & jobid, const Parametre & param) - { - alterJob(jobid, param, Environnement()); - } - - // Methode pour le controle des jobs : modifie un job en file d'attente - void BatchManager_eLSF::alterJob(const JobId & jobid, const Environnement & env) - { - alterJob(jobid, Parametre(), env); - } - - // Methode pour le controle des jobs : renvoie l'etat du job - JobInfo BatchManager_eLSF::queryJob(const JobId & jobid) - { - int id; - istringstream iss(jobid.getReference()); - iss >> id; - - // define name of log file - string logFile="/tmp/logs/"; - logFile += getenv("USER"); - logFile += "/batchSalome_"; - - srand ( time(NULL) ); - int ir = rand(); - ostringstream oss; - oss << ir; - logFile += oss.str(); - logFile += ".log"; - - string command; - int status; - - // define command to submit batch - command = _protocol; - command += " "; - - if (_username != ""){ - command += _username; - command += "@"; - } - - command += _hostname; - command += " \"bjobs " ; - command += iss.str(); - command += "\" > "; - command += logFile; - cerr << command.c_str() << endl; - status = system(command.c_str()); - if(status) - throw EmulationException("Error of connection on remote host"); - - JobInfo_eLSF ji = JobInfo_eLSF(id,logFile); - return ji; - } - - - - // Methode pour le controle des jobs : teste si un job est present en machine - bool BatchManager_eLSF::isRunning(const JobId & jobid) - { - throw EmulationException("Not yet implemented"); - } - - void BatchManager_eLSF::buildBatchScript(const Job & job) - { -#ifndef WIN32 //TODO: need for porting on Windows - int status; - Parametre params = job.getParametre(); - Environnement env = job.getEnvironnement(); - const int nbproc = params[NBPROC]; - const long edt = params[MAXWALLTIME]; - const long mem = params[MAXRAMSIZE]; - const string workDir = params[WORKDIR]; - const std::string dirForTmpFiles = params[TMPDIR]; - const string fileToExecute = params[EXECUTABLE]; - const string home = params[HOMEDIR]; - const std::string queue = params[QUEUE]; - std::string rootNameToExecute; - std::string fileNameToExecute; - std::string filelogtemp; - if( fileToExecute.size() > 0 ){ - string::size_type p1 = fileToExecute.find_last_of("/"); - string::size_type p2 = fileToExecute.find_last_of("."); - rootNameToExecute = fileToExecute.substr(p1+1,p2-p1-1); - char* basec=strdup(fileToExecute.c_str()); - fileNameToExecute = "~/" + dirForTmpFiles + "/" + string(basename(basec)); - free(basec); - - int idx = dirForTmpFiles.find("Batch/"); - filelogtemp = dirForTmpFiles.substr(idx+6, dirForTmpFiles.length()); - } - else{ - rootNameToExecute = "command"; - } - - ofstream tempOutputFile; - std::string TmpFileName = createAndOpenTemporaryFile(tempOutputFile); - - tempOutputFile << "#! /bin/sh -f" << endl ; - if (queue != "") - tempOutputFile << "#BSUB -q " << queue << endl; - if( edt > 0 ) - tempOutputFile << "#BSUB -W " << getWallTime(edt) << endl ; - if( mem > 0 ) - tempOutputFile << "#BSUB -M " << mem*1024 << endl ; - tempOutputFile << "#BSUB -n " << nbproc << endl ; - if( fileToExecute.size() > 0 ){ - tempOutputFile << "#BSUB -o " << home << "/" << dirForTmpFiles << "/output.log." << filelogtemp << endl ; - tempOutputFile << "#BSUB -e " << home << "/" << dirForTmpFiles << "/error.log." << filelogtemp << endl ; - } - else{ - tempOutputFile << "#BSUB -o " << dirForTmpFiles << "/" << env["LOGFILE"] << ".output.log" << endl ; - tempOutputFile << "#BSUB -e " << dirForTmpFiles << "/" << env["LOGFILE"] << ".error.log" << endl ; - } - if( workDir.size() > 0 ) - tempOutputFile << "cd " << workDir << endl ; - if( fileToExecute.size() > 0 ){ - tempOutputFile << _mpiImpl->boot("",nbproc); - tempOutputFile << _mpiImpl->run("",nbproc,fileNameToExecute); - tempOutputFile << _mpiImpl->halt(); - } - else{ - tempOutputFile << "source " << env["SOURCEFILE"] << endl ; - tempOutputFile << env["COMMAND"]; - } - - tempOutputFile.flush(); - tempOutputFile.close(); -#ifdef WIN32 - _chmod( -#else - chmod( -#endif - TmpFileName.c_str(), 0x1ED); - cerr << TmpFileName.c_str() << endl; - - string command; - if( _protocol == "rsh" ) - command = "rcp "; - else if( _protocol == "ssh" ) - command = "scp "; - else - throw EmulationException("Unknown protocol"); - command += TmpFileName; - command += " "; - if(_username != ""){ - command += _username; - command += "@"; - } - command += _hostname; - command += ":"; - command += dirForTmpFiles ; - command += "/" ; - command += rootNameToExecute ; - command += "_Batch.sh" ; - cerr << command.c_str() << endl; - status = system(command.c_str()); - if(status) - throw EmulationException("Error of connection on remote host"); - - remove(TmpFileName.c_str()); -#endif - - } - - std::string BatchManager_eLSF::getWallTime(const long edt) - { - long h, m; - h = edt / 60; - m = edt - h*60; - ostringstream oss; - if( m >= 10 ) - oss << h << ":" << m; - else - oss << h << ":0" << m; - return oss.str(); - } - -} diff --git a/src/Batch/Batch_BatchManager_eLSF.hxx b/src/Batch/Batch_BatchManager_eLSF.hxx deleted file mode 100644 index d09db3d9b..000000000 --- a/src/Batch/Batch_BatchManager_eLSF.hxx +++ /dev/null @@ -1,96 +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 -// -/* - * BatchManager_eLSF.hxx : emulation of LSF client - * - * Auteur : Bernard SECHER - CEA DEN - * Mail : mailto:bernard.secher@cea.fr - * Date : Thu Apr 24 10:17:22 2008 - * Projet : PAL Salome - * - */ - -#ifndef _BATCHMANAGER_eLSF_H_ -#define _BATCHMANAGER_eLSF_H_ - -#include "Batch_Defines.hxx" - -#include "Batch_JobId.hxx" -#include "Batch_JobInfo.hxx" -#include "Batch_JobInfo_eLSF.hxx" -#include "Batch_InvalidArgumentException.hxx" -#include "Batch_ConnexionFailureException.hxx" -#include "Batch_APIInternalFailureException.hxx" -#include "Batch_NotYetImplementedException.hxx" -#include "Batch_BatchManager.hxx" -#include "Batch_BatchManager_eClient.hxx" - -namespace Batch { - - class Job; - class JobId; - class JobInfo; - class FactBatchManager; - - class BATCH_EXPORT BatchManager_eLSF : public BatchManager_eClient - { - public: - // Constructeur et destructeur - BatchManager_eLSF(const FactBatchManager * parent, const char * host="localhost", const char * protocol="ssh", const char * mpiImpl="nompi") throw(InvalidArgumentException,ConnexionFailureException); // connexion a la machine host - virtual ~BatchManager_eLSF(); - - // Recupere le nom du serveur par defaut - // static string BatchManager_LSF::getDefaultServer(); - - // Methodes pour le controle des jobs - virtual const JobId submitJob(const Job & job); // soumet un job au gestionnaire - virtual void deleteJob(const JobId & jobid); // retire un job du gestionnaire - virtual void holdJob(const JobId & jobid); // suspend un job en file d'attente - virtual void releaseJob(const JobId & jobid); // relache un job suspendu - virtual void alterJob(const JobId & jobid, const Parametre & param, const Environnement & env); // modifie un job en file d'attente - virtual void alterJob(const JobId & jobid, const Parametre & param); // modifie un job en file d'attente - virtual void alterJob(const JobId & jobid, const Environnement & env); // modifie un job en file d'attente - virtual JobInfo queryJob(const JobId & jobid); // renvoie l'etat du job - virtual bool isRunning(const JobId & jobid); // teste si un job est present en machine - - virtual void setParametre(const JobId & jobid, const Parametre & param) { return alterJob(jobid, param); } // modifie un job en file d'attente - virtual void setEnvironnement(const JobId & jobid, const Environnement & env) { return alterJob(jobid, env); } // modifie un job en file d'attente - - - protected: - void buildBatchScript(const Job & job); - std::string getWallTime(const long edt); - - private: - -#ifdef SWIG - public: - // Recupere le l'identifiant d'un job deja soumis au BatchManager - //virtual const JobId getJobIdByReference(const string & ref) { return BatchManager::getJobIdByReference(ref); } - virtual const JobId getJobIdByReference(const char * ref) { return BatchManager::getJobIdByReference(ref); } -#endif - - }; - -} - -#endif diff --git a/src/Batch/Batch_BatchManager_ePBS.cxx b/src/Batch/Batch_BatchManager_ePBS.cxx deleted file mode 100644 index 68d1cab07..000000000 --- a/src/Batch/Batch_BatchManager_ePBS.cxx +++ /dev/null @@ -1,341 +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 -// -/* - * BatchManager_ePBS.cxx : emulation of PBS client - * - * Auteur : Bernard SECHER - CEA DEN - * Mail : mailto:bernard.secher@cea.fr - * Date : Thu Apr 24 10:17:22 2008 - * Projet : PAL Salome - * - */ - -#include -#include -#include -#include -#include -#include - -#include "Batch_BatchManager_ePBS.hxx" -#ifdef WIN32 -# include -# include -#else -# include -#endif - -using namespace std; - -namespace Batch { - - BatchManager_ePBS::BatchManager_ePBS(const FactBatchManager * parent, const char * host, const char * protocol, const char * mpiImpl) throw(InvalidArgumentException,ConnexionFailureException) : BatchManager_eClient(parent,host,protocol,mpiImpl) - { - // Nothing to do - } - - // Destructeur - BatchManager_ePBS::~BatchManager_ePBS() - { - // Nothing to do - } - - // Methode pour le controle des jobs : soumet un job au gestionnaire - const JobId BatchManager_ePBS::submitJob(const Job & job) - { - int status; - Parametre params = job.getParametre(); - const std::string dirForTmpFiles = params[TMPDIR]; - const string fileToExecute = params[EXECUTABLE]; - string::size_type p1 = fileToExecute.find_last_of("/"); - string::size_type p2 = fileToExecute.find_last_of("."); - std::string fileNameToExecute = fileToExecute.substr(p1+1,p2-p1-1); - - // export input files on cluster - exportInputFiles(job); - - // build batch script for job - buildBatchScript(job); - - // define name of log file - string logFile="/tmp/logs/"; - logFile += getenv("USER"); - logFile += "/batchSalome_"; - srand ( time(NULL) ); - int ir = rand(); - ostringstream oss; - oss << ir; - logFile += oss.str(); - logFile += ".log"; - - string command; - - // define command to submit batch - command = _protocol; - command += " "; - - if(_username != ""){ - command += _username; - command += "@"; - } - - command += _hostname; - command += " \"cd " ; - command += dirForTmpFiles ; - command += "; qsub " ; - command += fileNameToExecute ; - command += "_Batch.sh\" > "; - command += logFile; - cerr << command.c_str() << endl; - status = system(command.c_str()); - if(status) - throw EmulationException("Error of connection on remote host"); - - // read id of submitted job in log file - char line[128]; - FILE *fp = fopen(logFile.c_str(),"r"); - fgets( line, 128, fp); - fclose(fp); - - string sline(line); - int pos = sline.find("."); - string strjob; - if(pos == string::npos) - strjob = sline; - else - strjob = sline.substr(0,pos); - - JobId id(this, strjob); - return id; - } - - // Methode pour le controle des jobs : retire un job du gestionnaire - void BatchManager_ePBS::deleteJob(const JobId & jobid) - { - int status; - int ref; - istringstream iss(jobid.getReference()); - iss >> ref; - - // define command to submit batch - string command; - command = _protocol; - command += " "; - - if (_username != ""){ - command += _username; - command += "@"; - } - - command += _hostname; - command += " \"qdel " ; - command += iss.str(); - command += "\""; - cerr << command.c_str() << endl; - status = system(command.c_str()); - if(status) - throw EmulationException("Error of connection on remote host"); - - cerr << "jobId = " << ref << "killed" << endl; - } - - // Methode pour le controle des jobs : suspend un job en file d'attente - void BatchManager_ePBS::holdJob(const JobId & jobid) - { - throw EmulationException("Not yet implemented"); - } - - // Methode pour le controle des jobs : relache un job suspendu - void BatchManager_ePBS::releaseJob(const JobId & jobid) - { - throw EmulationException("Not yet implemented"); - } - - - // Methode pour le controle des jobs : modifie un job en file d'attente - void BatchManager_ePBS::alterJob(const JobId & jobid, const Parametre & param, const Environnement & env) - { - throw EmulationException("Not yet implemented"); - } - - // Methode pour le controle des jobs : modifie un job en file d'attente - void BatchManager_ePBS::alterJob(const JobId & jobid, const Parametre & param) - { - alterJob(jobid, param, Environnement()); - } - - // Methode pour le controle des jobs : modifie un job en file d'attente - void BatchManager_ePBS::alterJob(const JobId & jobid, const Environnement & env) - { - alterJob(jobid, Parametre(), env); - } - - // Methode pour le controle des jobs : renvoie l'etat du job - JobInfo BatchManager_ePBS::queryJob(const JobId & jobid) - { - int id; - istringstream iss(jobid.getReference()); - iss >> id; - - // define name of log file - string logFile="/tmp/logs/"; - logFile += getenv("USER"); - logFile += "/batchSalome_"; - - ostringstream oss; - oss << this << "_" << id; - logFile += oss.str(); - logFile += ".log"; - - string command; - int status; - - // define command to submit batch - command = _protocol; - command += " "; - - if (_username != ""){ - command += _username; - command += "@"; - } - - command += _hostname; - command += " \"qstat -f " ; - command += iss.str(); - command += "\" > "; - command += logFile; - cerr << command.c_str() << endl; - status = system(command.c_str()); - if(status && status != 153 && status != 256*153) - throw EmulationException("Error of connection on remote host"); - - JobInfo_ePBS ji = JobInfo_ePBS(id,logFile); - return ji; - } - - // Methode pour le controle des jobs : teste si un job est present en machine - bool BatchManager_ePBS::isRunning(const JobId & jobid) - { - throw EmulationException("Not yet implemented"); - } - - void BatchManager_ePBS::buildBatchScript(const Job & job) - { -#ifndef WIN32 //TODO: need for porting on Windows - int status; - Parametre params = job.getParametre(); - Environnement env = job.getEnvironnement(); - const long nbproc = params[NBPROC]; - const long edt = params[MAXWALLTIME]; - const long mem = params[MAXRAMSIZE]; - const string workDir = params[WORKDIR]; - const std::string dirForTmpFiles = params[TMPDIR]; - const string fileToExecute = params[EXECUTABLE]; - const string home = params[HOMEDIR]; - const std::string queue = params[QUEUE]; - std::string rootNameToExecute; - std::string fileNameToExecute; - std::string filelogtemp; - if( fileToExecute.size() > 0 ){ - string::size_type p1 = fileToExecute.find_last_of("/"); - string::size_type p2 = fileToExecute.find_last_of("."); - rootNameToExecute = fileToExecute.substr(p1+1,p2-p1-1); - char* basec=strdup(fileToExecute.c_str()); - fileNameToExecute = "~/" + dirForTmpFiles + "/" + string(basename(basec)); - free(basec); - - int idx = dirForTmpFiles.find("Batch/"); - filelogtemp = dirForTmpFiles.substr(idx+6, dirForTmpFiles.length()); - } - else{ - rootNameToExecute = "command"; - } - - ofstream tempOutputFile; - std::string TmpFileName = createAndOpenTemporaryFile(tempOutputFile); - - tempOutputFile << "#! /bin/sh -f" << endl; - if (queue != "") - tempOutputFile << "#BSUB -q " << queue << endl; - if( edt > 0 ) - tempOutputFile << "#PBS -l walltime=" << edt*60 << endl ; - if( mem > 0 ) - tempOutputFile << "#PBS -l mem=" << mem << "mb" << endl ; - if( fileToExecute.size() > 0 ){ - tempOutputFile << "#PBS -o " << home << "/" << dirForTmpFiles << "/output.log." << filelogtemp << endl ; - tempOutputFile << "#PBS -e " << home << "/" << dirForTmpFiles << "/error.log." << filelogtemp << endl ; - } - else{ - tempOutputFile << "#PBS -o " << dirForTmpFiles << "/" << env["LOGFILE"] << ".output.log" << endl ; - tempOutputFile << "#PBS -e " << dirForTmpFiles << "/" << env["LOGFILE"] << ".error.log" << endl ; - } - if( workDir.size() > 0 ) - tempOutputFile << "cd " << workDir << endl ; - if( fileToExecute.size() > 0 ){ - tempOutputFile << _mpiImpl->boot("${PBS_NODEFILE}",nbproc); - tempOutputFile << _mpiImpl->run("${PBS_NODEFILE}",nbproc,fileNameToExecute); - tempOutputFile << _mpiImpl->halt(); - } - else{ - tempOutputFile << "source " << env["SOURCEFILE"] << endl ; - tempOutputFile << env["COMMAND"]; - } - - tempOutputFile.flush(); - tempOutputFile.close(); -#ifdef WIN32 - _chmod( -#else - chmod( -#endif - TmpFileName.c_str(), 0x1ED); - cerr << TmpFileName.c_str() << endl; - - string command; - if( _protocol == "rsh" ) - command = "rcp "; - else if( _protocol == "ssh" ) - command = "scp "; - else - throw EmulationException("Unknown protocol"); - command += TmpFileName; - command += " "; - if(_username != ""){ - command += _username; - command += "@"; - } - command += _hostname; - command += ":"; - command += dirForTmpFiles ; - command += "/" ; - command += rootNameToExecute ; - command += "_Batch.sh" ; - cerr << command.c_str() << endl; - status = system(command.c_str()); - if(status) - throw EmulationException("Error of connection on remote host"); - - remove(TmpFileName.c_str()); -#endif - } - -} diff --git a/src/Batch/Batch_BatchManager_ePBS.hxx b/src/Batch/Batch_BatchManager_ePBS.hxx deleted file mode 100644 index 661b36829..000000000 --- a/src/Batch/Batch_BatchManager_ePBS.hxx +++ /dev/null @@ -1,95 +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 -// -/* - * BatchManager_ePBS.hxx : emulation of PBS client - * - * Auteur : Bernard SECHER - CEA DEN - * Mail : mailto:bernard.secher@cea.fr - * Date : Thu Apr 24 10:17:22 2008 - * Projet : PAL Salome - * - */ - -#ifndef _BATCHMANAGER_eLSF_H_ -#define _BATCHMANAGER_eLSF_H_ - -#include "Batch_Defines.hxx" - -#include "Batch_JobId.hxx" -#include "Batch_JobInfo.hxx" -#include "Batch_JobInfo_ePBS.hxx" -#include "Batch_InvalidArgumentException.hxx" -#include "Batch_ConnexionFailureException.hxx" -#include "Batch_APIInternalFailureException.hxx" -#include "Batch_NotYetImplementedException.hxx" -#include "Batch_BatchManager.hxx" -#include "Batch_BatchManager_eClient.hxx" - -namespace Batch { - - class Job; - class JobId; - class JobInfo; - class FactBatchManager; - - class BATCH_EXPORT BatchManager_ePBS : public BatchManager_eClient - { - public: - // Constructeur et destructeur - BatchManager_ePBS(const FactBatchManager * parent, const char * host="localhost", const char * protocol="ssh", const char * mpiImpl="nompi") throw(InvalidArgumentException,ConnexionFailureException); // connexion a la machine host - virtual ~BatchManager_ePBS(); - - // Recupere le nom du serveur par defaut - // static string BatchManager_LSF::getDefaultServer(); - - // Methodes pour le controle des jobs - virtual const JobId submitJob(const Job & job); // soumet un job au gestionnaire - virtual void deleteJob(const JobId & jobid); // retire un job du gestionnaire - virtual void holdJob(const JobId & jobid); // suspend un job en file d'attente - virtual void releaseJob(const JobId & jobid); // relache un job suspendu - virtual void alterJob(const JobId & jobid, const Parametre & param, const Environnement & env); // modifie un job en file d'attente - virtual void alterJob(const JobId & jobid, const Parametre & param); // modifie un job en file d'attente - virtual void alterJob(const JobId & jobid, const Environnement & env); // modifie un job en file d'attente - virtual JobInfo queryJob(const JobId & jobid); // renvoie l'etat du job - virtual bool isRunning(const JobId & jobid); // teste si un job est present en machine - - virtual void setParametre(const JobId & jobid, const Parametre & param) { return alterJob(jobid, param); } // modifie un job en file d'attente - virtual void setEnvironnement(const JobId & jobid, const Environnement & env) { return alterJob(jobid, env); } // modifie un job en file d'attente - - - protected: - void buildBatchScript(const Job & job); - - private: - -#ifdef SWIG - public: - // Recupere le l'identifiant d'un job deja soumis au BatchManager - //virtual const JobId getJobIdByReference(const string & ref) { return BatchManager::getJobIdByReference(ref); } - virtual const JobId getJobIdByReference(const char * ref) { return BatchManager::getJobIdByReference(ref); } -#endif - - }; - -} - -#endif diff --git a/src/Batch/Batch_BatchManager_eSGE.cxx b/src/Batch/Batch_BatchManager_eSGE.cxx deleted file mode 100644 index cb4f9604d..000000000 --- a/src/Batch/Batch_BatchManager_eSGE.cxx +++ /dev/null @@ -1,343 +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 -// -/* - * BatchManager_eSGE.cxx : emulation of SGE client - * - * Auteur : Bernard SECHER - CEA DEN - * Mail : mailto:bernard.secher@cea.fr - * Date : Thu Apr 24 10:17:22 2008 - * Projet : PAL Salome - * - */ - -#include -#include -#include -#include -#include "Batch_BatchManager_eSGE.hxx" -#include -#ifdef WIN32 -# include -# include -#else -#include -#endif - -using namespace std; - -namespace Batch { - - BatchManager_eSGE::BatchManager_eSGE(const FactBatchManager * parent, const char * host, const char * protocol, const char * mpiImpl) throw(InvalidArgumentException,ConnexionFailureException) : BatchManager_eClient(parent,host,protocol,mpiImpl) - { - // Nothing to do - } - - // Destructeur - BatchManager_eSGE::~BatchManager_eSGE() - { - // Nothing to do - } - - // Methode pour le controle des jobs : soumet un job au gestionnaire - const JobId BatchManager_eSGE::submitJob(const Job & job) - { - int status; - Parametre params = job.getParametre(); - const std::string dirForTmpFiles = params[TMPDIR]; - const string fileToExecute = params[EXECUTABLE]; - string::size_type p1 = fileToExecute.find_last_of("/"); - string::size_type p2 = fileToExecute.find_last_of("."); - std::string fileNameToExecute = fileToExecute.substr(p1+1,p2-p1-1); - - // export input files on cluster - exportInputFiles(job); - - // build batch script for job - buildBatchScript(job); - - // define name of log file - string logFile="/tmp/logs/"; - logFile += getenv("USER"); - logFile += "/batchSalome_"; - srand ( time(NULL) ); - int ir = rand(); - ostringstream oss; - oss << ir; - logFile += oss.str(); - logFile += ".log"; - - string command; - - // define command to submit batch - command = _protocol; - command += " "; - - if(_username != ""){ - command += _username; - command += "@"; - } - - command += _hostname; - command += " \"cd " ; - command += dirForTmpFiles ; - command += "; qsub " ; - command += fileNameToExecute ; - command += "_Batch.sh\" > "; - command += logFile; - cerr << command.c_str() << endl; - status = system(command.c_str()); - if(status) - throw EmulationException("Error of connection on remote host"); - - // read id of submitted job in log file - char line[128]; - FILE *fp = fopen(logFile.c_str(),"r"); - fgets( line, 128, fp); - fclose(fp); - - string strjob; - istringstream iss(line); - iss >> strjob >> strjob >> strjob; - - JobId id(this, strjob); - return id; - } - - // Methode pour le controle des jobs : retire un job du gestionnaire - void BatchManager_eSGE::deleteJob(const JobId & jobid) - { - int status; - int ref; - istringstream iss(jobid.getReference()); - iss >> ref; - - // define command to submit batch - string command; - command = _protocol; - command += " "; - - if (_username != ""){ - command += _username; - command += "@"; - } - - command += _hostname; - command += " \"qdel " ; - command += iss.str(); - command += "\""; - cerr << command.c_str() << endl; - status = system(command.c_str()); - if(status) - throw EmulationException("Error of connection on remote host"); - - cerr << "jobId = " << ref << "killed" << endl; - } - - // Methode pour le controle des jobs : suspend un job en file d'attente - void BatchManager_eSGE::holdJob(const JobId & jobid) - { - throw EmulationException("Not yet implemented"); - } - - // Methode pour le controle des jobs : relache un job suspendu - void BatchManager_eSGE::releaseJob(const JobId & jobid) - { - throw EmulationException("Not yet implemented"); - } - - - // Methode pour le controle des jobs : modifie un job en file d'attente - void BatchManager_eSGE::alterJob(const JobId & jobid, const Parametre & param, const Environnement & env) - { - throw EmulationException("Not yet implemented"); - } - - // Methode pour le controle des jobs : modifie un job en file d'attente - void BatchManager_eSGE::alterJob(const JobId & jobid, const Parametre & param) - { - alterJob(jobid, param, Environnement()); - } - - // Methode pour le controle des jobs : modifie un job en file d'attente - void BatchManager_eSGE::alterJob(const JobId & jobid, const Environnement & env) - { - alterJob(jobid, Parametre(), env); - } - - // Methode pour le controle des jobs : renvoie l'etat du job - JobInfo BatchManager_eSGE::queryJob(const JobId & jobid) - { - int id; - istringstream iss(jobid.getReference()); - iss >> id; - - // define name of log file - string logFile="/tmp/logs/"; - logFile += getenv("USER"); - logFile += "/batchSalome_"; - - ostringstream oss; - oss << this << "_" << id; - logFile += oss.str(); - logFile += ".log"; - - string command; - int status; - - // define command to submit batch - command = _protocol; - command += " "; - - if (_username != ""){ - command += _username; - command += "@"; - } - - command += _hostname; - command += " \"qstat | grep " ; - command += iss.str(); - command += "\" > "; - command += logFile; - cerr << command.c_str() << endl; - status = system(command.c_str()); - if(status && status != 256) - throw EmulationException("Error of connection on remote host"); - - JobInfo_eSGE ji = JobInfo_eSGE(id,logFile); - return ji; - } - - // Methode pour le controle des jobs : teste si un job est present en machine - bool BatchManager_eSGE::isRunning(const JobId & jobid) - { - throw EmulationException("Not yet implemented"); - } - - void BatchManager_eSGE::buildBatchScript(const Job & job) - { -#ifndef WIN32 - //TODO porting on Win32 platform - int status; - Parametre params = job.getParametre(); - Environnement env = job.getEnvironnement(); - const long nbproc = params[NBPROC]; - const long edt = params[MAXWALLTIME]; - const long mem = params[MAXRAMSIZE]; - const string workDir = params[WORKDIR]; - const std::string dirForTmpFiles = params[TMPDIR]; - const string fileToExecute = params[EXECUTABLE]; - const string home = params[HOMEDIR]; - const std::string queue = params[QUEUE]; - std::string rootNameToExecute; - std::string fileNameToExecute; - std::string filelogtemp; - if( fileToExecute.size() > 0 ){ - string::size_type p1 = fileToExecute.find_last_of("/"); - string::size_type p2 = fileToExecute.find_last_of("."); - rootNameToExecute = fileToExecute.substr(p1+1,p2-p1-1); - fileNameToExecute = "~/" + dirForTmpFiles + "/" + string(basename((char *) fileToExecute.c_str())); - - int idx = dirForTmpFiles.find("Batch/"); - filelogtemp = dirForTmpFiles.substr(idx+6, dirForTmpFiles.length()); - } - else{ - rootNameToExecute = "command"; - } - - ofstream tempOutputFile; - std::string TmpFileName = createAndOpenTemporaryFile(tempOutputFile); - - tempOutputFile << "#! /bin/sh -f" << endl; - if (queue != "") - tempOutputFile << "#$ -q " << queue << endl; - tempOutputFile << "#$ -pe mpich " << nbproc << endl; - if( edt > 0 ) - tempOutputFile << "#$ -l h_rt=" << getWallTime(edt) << endl ; - if( mem > 0 ) - tempOutputFile << "#$ -l h_vmem=" << mem << "M" << endl ; - if( fileToExecute.size() > 0 ){ - tempOutputFile << "#$ -o " << home << "/" << dirForTmpFiles << "/output.log." << filelogtemp << endl ; - tempOutputFile << "#$ -e " << home << "/" << dirForTmpFiles << "/error.log." << filelogtemp << endl ; - } - else{ - tempOutputFile << "#$ -o " << dirForTmpFiles << "/" << env["LOGFILE"] << ".output.log" << endl ; - tempOutputFile << "#$ -e " << dirForTmpFiles << "/" << env["LOGFILE"] << ".error.log" << endl ; - } - if( workDir.size() > 0 ) - tempOutputFile << "cd " << workDir << endl ; - if( fileToExecute.size() > 0 ){ - tempOutputFile << _mpiImpl->boot("",nbproc); - tempOutputFile << _mpiImpl->run("${TMPDIR}/machines",nbproc,fileNameToExecute); - tempOutputFile << _mpiImpl->halt(); - } - else{ - tempOutputFile << "source " << env["SOURCEFILE"] << endl ; - tempOutputFile << env["COMMAND"]; - } - - tempOutputFile.flush(); - tempOutputFile.close(); - chmod(TmpFileName.c_str(), 0x1ED); - cerr << TmpFileName.c_str() << endl; - - string command; - if( _protocol == "rsh" ) - command = "rcp "; - else if( _protocol == "ssh" ) - command = "scp "; - else - throw EmulationException("Unknown protocol"); - command += TmpFileName; - command += " "; - if(_username != ""){ - command += _username; - command += "@"; - } - command += _hostname; - command += ":"; - command += dirForTmpFiles ; - command += "/" ; - command += rootNameToExecute ; - command += "_Batch.sh" ; - cerr << command.c_str() << endl; - status = system(command.c_str()); - if(status) - throw EmulationException("Error of connection on remote host"); - - remove(TmpFileName.c_str()); -#endif //WIN32 - } - - std::string BatchManager_eSGE::getWallTime(const long edt) - { - long h, m; - h = edt / 60; - m = edt - h*60; - ostringstream oss; - if( m >= 10 ) - oss << h << ":" << m; - else - oss << h << ":0" << m; - return oss.str(); - } - -} diff --git a/src/Batch/Batch_BatchManager_eSGE.hxx b/src/Batch/Batch_BatchManager_eSGE.hxx deleted file mode 100644 index 4f7ca9685..000000000 --- a/src/Batch/Batch_BatchManager_eSGE.hxx +++ /dev/null @@ -1,95 +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 -// -/* - * BatchManager_eSGE.hxx : emulation of SGE client - * - * Auteur : Bernard SECHER - CEA DEN - * Mail : mailto:bernard.secher@cea.fr - * Date : Thu Apr 24 10:17:22 2008 - * Projet : PAL Salome - * - */ - -#ifndef _BATCHMANAGER_eLSF_H_ -#define _BATCHMANAGER_eLSF_H_ - -#include "Batch_Defines.hxx" -#include "Batch_JobId.hxx" -#include "Batch_JobInfo.hxx" -#include "Batch_JobInfo_eSGE.hxx" -#include "Batch_InvalidArgumentException.hxx" -#include "Batch_ConnexionFailureException.hxx" -#include "Batch_APIInternalFailureException.hxx" -#include "Batch_NotYetImplementedException.hxx" -#include "Batch_BatchManager.hxx" -#include "Batch_BatchManager_eClient.hxx" - -namespace Batch { - - class Job; - class JobId; - class JobInfo; - class FactBatchManager; - - class BATCH_EXPORT BatchManager_eSGE : public BatchManager_eClient - { - public: - // Constructeur et destructeur - BatchManager_eSGE(const FactBatchManager * parent, const char * host="localhost", const char * protocol="ssh", const char * mpiImpl="nompi") throw(InvalidArgumentException,ConnexionFailureException); // connexion a la machine host - virtual ~BatchManager_eSGE(); - - // Recupere le nom du serveur par defaut - // static string BatchManager_LSF::getDefaultServer(); - - // Methodes pour le controle des jobs - virtual const JobId submitJob(const Job & job); // soumet un job au gestionnaire - virtual void deleteJob(const JobId & jobid); // retire un job du gestionnaire - virtual void holdJob(const JobId & jobid); // suspend un job en file d'attente - virtual void releaseJob(const JobId & jobid); // relache un job suspendu - virtual void alterJob(const JobId & jobid, const Parametre & param, const Environnement & env); // modifie un job en file d'attente - virtual void alterJob(const JobId & jobid, const Parametre & param); // modifie un job en file d'attente - virtual void alterJob(const JobId & jobid, const Environnement & env); // modifie un job en file d'attente - virtual JobInfo queryJob(const JobId & jobid); // renvoie l'etat du job - virtual bool isRunning(const JobId & jobid); // teste si un job est present en machine - - virtual void setParametre(const JobId & jobid, const Parametre & param) { return alterJob(jobid, param); } // modifie un job en file d'attente - virtual void setEnvironnement(const JobId & jobid, const Environnement & env) { return alterJob(jobid, env); } // modifie un job en file d'attente - - - protected: - void buildBatchScript(const Job & job); - std::string getWallTime(const long edt); - - private: - -#ifdef SWIG - public: - // Recupere le l'identifiant d'un job deja soumis au BatchManager - //virtual const JobId getJobIdByReference(const string & ref) { return BatchManager::getJobIdByReference(ref); } - virtual const JobId getJobIdByReference(const char * ref) { return BatchManager::getJobIdByReference(ref); } -#endif - - }; - -} - -#endif diff --git a/src/Batch/Batch_BoolType.cxx b/src/Batch/Batch_BoolType.cxx deleted file mode 100644 index 138b4aebf..000000000 --- a/src/Batch/Batch_BoolType.cxx +++ /dev/null @@ -1,66 +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 -// -/* - * BoolType.cxx : - * - * Auteur : Ivan DUTKA-MALEN - EDF R&D - * Date : Septembre 2003 - * Projet : SALOME 2 - * - */ - -#include -#include -#include "Batch_BoolType.hxx" -using namespace std; - -namespace Batch { - - // Conversion en chaine - string BoolType::affiche() const - { - return _data ? string("true") : string("false"); - } - - // Operateur d'affectation - BoolType & BoolType::operator =(bool b) - { - _data = b; - return *this; - } - - // Conversion en bool - BoolType::operator bool() const - { - return this->_data; - } - - // Clone duplique l'objet et en fabrique un nouveau a l'aide de new - // qu'il faudra detruire ensuite manuellement - GenericType * BoolType::clone() const - { - BoolType * pB = new BoolType(this->_data); - assert(pB != 0); - return pB; - } - -} diff --git a/src/Batch/Batch_BoolType.hxx b/src/Batch/Batch_BoolType.hxx deleted file mode 100644 index 99e87ad99..000000000 --- a/src/Batch/Batch_BoolType.hxx +++ /dev/null @@ -1,69 +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 -// -/* - * BoolType.hxx : - * - * Auteur : Ivan DUTKA-MALEN - EDF R&D - * Date : Septembre 2003 - * Projet : SALOME 2 - * - */ - -#ifndef _BOOLTYPE_H_ -#define _BOOLTYPE_H_ - -#include "Batch_Defines.hxx" - -#include -#include "Batch_GenericType.hxx" - -namespace Batch { - - class BATCH_EXPORT BoolType : public GenericType - { - public: - // Constructeur - BoolType(const bool b=false) : _data(b) {} - - // Conversion en chaine - virtual std::string affiche() const; - - // Operateur d'affectation - virtual BoolType & operator =(bool); - - // Conversion en bool - virtual operator bool() const; - - // Clone duplique l'objet et en fabrique un nouveau a l'aide de new - // qu'il faudra detruire ensuite manuellement - virtual GenericType * clone() const; - - protected: - bool _data; - - private: - - }; - -} - -#endif diff --git a/src/Batch/Batch_CharType.cxx b/src/Batch/Batch_CharType.cxx deleted file mode 100644 index d1649c358..000000000 --- a/src/Batch/Batch_CharType.cxx +++ /dev/null @@ -1,66 +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 -// -/* - * CharType.cxx : - * - * Auteur : Ivan DUTKA-MALEN - EDF R&D - * Date : Septembre 2003 - * Projet : SALOME 2 - * - */ - -#include -#include -#include "Batch_CharType.hxx" -using namespace std; - -namespace Batch { - - // Conversion en chaine - string CharType::affiche() const - { - return string(1, _data); - } - - // Operateur d'affectation - CharType & CharType::operator =(char c) - { - _data = c; - return *this; - } - - // Conversion en char - CharType::operator char() const - { - return this->_data; - } - - // Clone duplique l'objet et en fabrique un nouveau a l'aide de new - // qu'il faudra detruire ensuite manuellement - GenericType * CharType::clone() const - { - CharType * pC = new CharType(this->_data); - assert(pC != 0); - return pC; - } - -} diff --git a/src/Batch/Batch_CharType.hxx b/src/Batch/Batch_CharType.hxx deleted file mode 100644 index 2a6afcaca..000000000 --- a/src/Batch/Batch_CharType.hxx +++ /dev/null @@ -1,70 +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 -// -/* - * CharType.hxx : - * - * Auteur : Ivan DUTKA-MALEN - EDF R&D - * Date : Septembre 2003 - * Projet : SALOME 2 - * - */ - -#ifndef _CHARTYPE_H_ -#define _CHARTYPE_H_ - -#include "Batch_Defines.hxx" - -#include -#include "Batch_GenericType.hxx" - -namespace Batch { - - class BATCH_EXPORT CharType : public GenericType - { - public: - // Constructeur - CharType(const char c=0) : _data(c) {} - - // Conversion en chaine - virtual std::string affiche() const; - - // Operateur d'affectation - virtual CharType & operator =(char); - - // Conversion en char - virtual operator char() const; - - // Clone duplique l'objet et en fabrique un nouveau a l'aide de new - // qu'il faudra detruire ensuite manuellement - virtual GenericType * clone() const; - - protected: - char _data; - - private: - - }; - -} - -#endif - diff --git a/src/Batch/Batch_ConnexionFailureException.cxx b/src/Batch/Batch_ConnexionFailureException.cxx deleted file mode 100644 index e1294f818..000000000 --- a/src/Batch/Batch_ConnexionFailureException.cxx +++ /dev/null @@ -1,37 +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 -// -/* - * ConnexionFailureException.cxx : - * - * Auteur : Ivan DUTKA-MALEN - EDF R&D - * Mail : mailto:ivan.dutka-malen@der.edf.fr - * Date : Thu Nov 13 11:24:31 2003 - * Projet : Salome 2 - * - */ - -#include "Batch_ConnexionFailureException.hxx" -using namespace std; - -namespace Batch { - -} diff --git a/src/Batch/Batch_ConnexionFailureException.hxx b/src/Batch/Batch_ConnexionFailureException.hxx deleted file mode 100644 index 178fecd45..000000000 --- a/src/Batch/Batch_ConnexionFailureException.hxx +++ /dev/null @@ -1,53 +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 -// -/* - * ConnexionFailureException.hxx : - * - * Auteur : Ivan DUTKA-MALEN - EDF R&D - * Mail : mailto:ivan.dutka-malen@der.edf.fr - * Date : Thu Nov 13 11:24:31 2003 - * Projet : Salome 2 - * - */ - -#ifndef _CONNEXIONFAILUREEXCEPTION_H_ -#define _CONNEXIONFAILUREEXCEPTION_H_ - -#include "Batch_Defines.hxx" - - -#include "Batch_GenericException.hxx" - -namespace Batch { - - class BATCH_EXPORT ConnexionFailureException : public GenericException - { - public: - // Constructeur - ConnexionFailureException(std::string ch = "undefined") : GenericException("ConnexionFailureException", ch) {} - - }; - -} - -#endif - diff --git a/src/Batch/Batch_Couple.cxx b/src/Batch/Batch_Couple.cxx deleted file mode 100644 index d70367ba7..000000000 --- a/src/Batch/Batch_Couple.cxx +++ /dev/null @@ -1,63 +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 -// -/* - * Couple.cxx : - * - * Auteur : Ivan DUTKA-MALEN - EDF R&D - * Mail : mailto:ivan.dutka-malen@der.edf.fr - * Date : Tue Dec 9 15:00:35 2003 - * Projet : Salome 2 - * - */ - -#include "Batch_Couple.hxx" -using namespace std; - -namespace Batch { - - // Operateur d'affectation - Couple & Couple::operator =(const Couple & C) - { - _local = C._local; - _remote = C._remote; - return *this; - } - - // Conversion en chaine - string Couple::str() const - { - string res; - res = "Couple(local : "; - res += _local; - res += ", remote : "; - res += _remote; - res += ")"; - return res; - } - - // Operateur pour l'affichage sur un stream - ostream & operator << (ostream & os, const Couple & cp) - { - return os << cp.str(); - } - -} diff --git a/src/Batch/Batch_Couple.hxx b/src/Batch/Batch_Couple.hxx deleted file mode 100644 index 12c428a2a..000000000 --- a/src/Batch/Batch_Couple.hxx +++ /dev/null @@ -1,74 +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 -// -/* - * Couple.hxx : - * - * Auteur : Ivan DUTKA-MALEN - EDF R&D - * Mail : mailto:ivan.dutka-malen@der.edf.fr - * Date : Tue Dec 9 15:00:35 2003 - * Projet : Salome 2 - * - */ - -#ifndef _COUPLE_H_ -#define _COUPLE_H_ - -#include "Batch_Defines.hxx" - -#include - -namespace Batch { - - class BATCH_EXPORT Couple - { - public: - // Constructeur standard - Couple(const std::string & local="", const std::string & remote="") : _local(local), _remote(remote) {} - - // Constructeur par recopie - Couple(const Couple & C) : _local(C._local), _remote(C._remote) {} - - // Operateur pour l'affichage sur un stream - friend std::ostream & operator << (std::ostream & os, const Couple & cp); - - // Operateur d'affectation - virtual Couple & operator =(const Couple &); - - // Conversion en chaine - virtual std::string str() const; - - // Accesseurs - virtual std::string getLocal() const { return _local; } - virtual std::string getRemote() const { return _remote; } - - protected: - std::string _local; // chemin d'acces au fichier local - std::string _remote; // chemin d'acees au fichier distant - - private: - - }; - -} - -#endif - diff --git a/src/Batch/Batch_CoupleType.cxx b/src/Batch/Batch_CoupleType.cxx deleted file mode 100644 index 2b6bfea63..000000000 --- a/src/Batch/Batch_CoupleType.cxx +++ /dev/null @@ -1,73 +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 -// -/* - * CoupleType.cxx : - * - * Auteur : Ivan DUTKA-MALEN - EDF R&D - * Mail : mailto:ivan.dutka-malen@der.edf.fr - * Date : Tue Dec 9 14:51:53 2003 - * Projet : Salome 2 - * - */ - -#include -#include "Batch_CoupleType.hxx" -using namespace std; - -namespace Batch { - - // Conversion en chaine - string CoupleType::affiche() const - { - return _data.str(); - } - - // Operateur d'affectation - CoupleType & CoupleType::operator =(const Couple & C) - { - _data = C; - return *this; - } - - // Conversion en char - CoupleType::operator Couple() const - { - return _data; - } - - // Conversion en chaine - CoupleType::operator string() const - { - return _data.str(); - } - - // Clone duplique l'objet et en fabrique un nouveau a l'aide de new - // qu'il faudra detruire ensuite manuellement - GenericType * CoupleType::clone() const - { - CoupleType * pC = new CoupleType(this->_data); - assert(pC != 0); - return pC; - } - -} - diff --git a/src/Batch/Batch_CoupleType.hxx b/src/Batch/Batch_CoupleType.hxx deleted file mode 100644 index ca2e7e9b6..000000000 --- a/src/Batch/Batch_CoupleType.hxx +++ /dev/null @@ -1,72 +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 -// -/* - * CoupleType.hxx : - * - * Auteur : Ivan DUTKA-MALEN - EDF R&D - * Mail : mailto:ivan.dutka-malen@der.edf.fr - * Date : Tue Dec 9 14:51:53 2003 - * Projet : Salome 2 - * - */ - -#ifndef _COUPLETYPE_H_ -#define _COUPLETYPE_H_ - -#include "Batch_Defines.hxx" - -#include -#include "Batch_GenericType.hxx" -#include "Batch_Couple.hxx" - -namespace Batch { - - class BATCH_EXPORT CoupleType : public GenericType - { - public: - // Constructeur - CoupleType(const Couple & C) : _data(C) {} - - // Conversion en chaine - virtual std::string affiche() const; - virtual operator std::string() const; - - // Operateur d'affectation - virtual CoupleType & operator =(const Couple & C); - - // Conversion en char - virtual operator Couple() const; - - // Clone duplique l'objet et en fabrique un nouveau a l'aide de new - // qu'il faudra detruire ensuite manuellement - virtual GenericType * clone() const; - - protected: - Couple _data; - - private: - - }; - -} - -#endif diff --git a/src/Batch/Batch_Date.cxx b/src/Batch/Batch_Date.cxx deleted file mode 100644 index bc99d9764..000000000 --- a/src/Batch/Batch_Date.cxx +++ /dev/null @@ -1,195 +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 -// -/* - * Date.cxx : - * - * Auteur : Ivan DUTKA-MALEN - EDF R&D - * Mail : mailto:ivan.dutka-malen@der.edf.fr - * Date : Wed Nov 26 14:11:42 2003 - * Projet : Salome 2 - * - */ - -#include -#include -#include "Batch_Date.hxx" -using namespace std; - -namespace Batch { - - Date::Date(const long 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; - _hour = p_tm->tm_hour; - _min = p_tm->tm_min; - _sec = p_tm->tm_sec; - } - - Date::Date(const string s) - { - if ((s == "now") || (s == "Now") || (s == "NOW")) { - long l = time(0); - 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; - _hour = p_tm->tm_hour; - _min = p_tm->tm_min; - _sec = p_tm->tm_sec; - - } else { -// char c; -// istringstream ist(s); -// ist >> _day >> c -// >> _month >> c -// >> _year >> c -// >> _hour >> c -// >> _min >> c -// >> _sec; - sscanf(s.c_str(), "%ld/%ld/%ld-%ld:%ld:%ld", &_day, &_month, &_year, &_hour, &_min, &_sec); - } - } - - Date & Date::operator =(long 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; - _hour = p_tm->tm_hour; - _min = p_tm->tm_min; - _sec = p_tm->tm_sec; - - return *this; - } - - Date & Date::operator +(long l) - { - *this = epoch() + l; - return *this; - } - - Date & Date::operator -(long l) - { - *this = epoch() - l; - return *this; - } - - Date & Date::operator +=(long l) - { - *this = epoch() + l; - return *this; - } - - Date & Date::operator -=(long l) - { - *this = epoch() - l; - return *this; - } - - Date & Date::operator =(const string & s) - { - if ((s == "now") || (s == "Now") || (s == "NOW")) { - long l = time(0); - 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; - _hour = p_tm->tm_hour; - _min = p_tm->tm_min; - _sec = p_tm->tm_sec; - - } else { -// char c; -// istringstream ist(s); -// ist >> _day >> c -// >> _month >> c -// >> _year >> c -// >> _hour >> c -// >> _min >> c -// >> _sec; - sscanf(s.c_str(), "%ld/%ld/%ld-%ld:%ld:%ld", &_day, &_month, &_year, &_hour, &_min, &_sec); - } - - return *this; - } - - string Date::str() const - { - char buf[64]; - string datestr; - - // _day to char * - sprintf(buf, "%02ld", _day); - datestr += buf; - datestr += "/"; - - // _month to char * - sprintf(buf, "%02ld", _month); - datestr += buf; - datestr += "/"; - - // _year to char * - sprintf(buf, "%04ld", _year); - datestr += buf; - datestr += "-"; - - // _hour to char * - sprintf(buf, "%02ld", _hour); - datestr += buf; - datestr += ":"; - - // _min to char * - sprintf(buf, "%02ld", _min); - datestr += buf; - datestr += ":"; - - // _sec to char * - sprintf(buf, "%02ld", _sec); - datestr += buf; - - return datestr; - } - - long Date::epoch() const - { - struct tm T; - T.tm_mday = _day; - T.tm_mon = _month - 1; - T.tm_year = _year - 1900; - T.tm_hour = _hour; - T.tm_min = _min; - T.tm_sec = _sec; - return mktime(&T); - } - -} - - -// COMMENTS diff --git a/src/Batch/Batch_Date.hxx b/src/Batch/Batch_Date.hxx deleted file mode 100644 index acbe81ff3..000000000 --- a/src/Batch/Batch_Date.hxx +++ /dev/null @@ -1,67 +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 -// -/* - * Date.hxx : - * - * Auteur : Ivan DUTKA-MALEN - EDF R&D - * Mail : mailto:ivan.dutka-malen@der.edf.fr - * Date : Wed Nov 26 14:11:42 2003 - * Projet : Salome 2 - * - */ - -#ifndef _DATE_H_ -#define _DATE_H_ - -#include "Batch_Defines.hxx" - -#include - -namespace Batch { - - class BATCH_EXPORT Date - { - public: - Date(const long l=0); - Date(const std::string s); - virtual Date & operator =(long l); - virtual Date & operator +(long l); - virtual Date & operator -(long l); - virtual Date & operator +=(long l); - virtual Date & operator -=(long l); - virtual Date & operator =(const std::string & s); - virtual std::string str() const; - virtual long epoch() const; - - protected: - int _day, _month, _year; - int _hour, _min, _sec; - - private: - - }; - -} - -#endif - -// COMMENTS diff --git a/src/Batch/Batch_DateType.cxx b/src/Batch/Batch_DateType.cxx deleted file mode 100644 index 43d78d966..000000000 --- a/src/Batch/Batch_DateType.cxx +++ /dev/null @@ -1,74 +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 -// -/* - * DateType.cxx : - * - * Auteur : Ivan DUTKA-MALEN - EDF R&D - * Mail : mailto:ivan.dutka-malen@der.edf.fr - * Date : Wed Nov 26 11:15:34 2003 - * Projet : Salome 2 - * - */ -extern "C" { -#include -} -#include -#include "Batch_DateType.hxx" -using namespace std; - -namespace Batch { - - // Conversion en chaine - string DateType::affiche() const - { - return _data.str(); - } - - // Operateur d'affectation - DateType & DateType::operator =(const Date & d) - { - _data = d; - return *this; - } - - // Conversion en Date - DateType::operator Date() const - { - return _data; - } - - // Conversion en long - DateType::operator long() const - { - return _data.epoch(); - } - - // Clone duplique l'objet et en fabrique un nouveau a l'aide de new - // qu'il faudra detruire ensuite manuellement - GenericType * DateType::clone() const - { - DateType * pD = new DateType(this->_data); - assert(pD != 0); - return pD; - } - -} diff --git a/src/Batch/Batch_DateType.hxx b/src/Batch/Batch_DateType.hxx deleted file mode 100644 index bed284683..000000000 --- a/src/Batch/Batch_DateType.hxx +++ /dev/null @@ -1,74 +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 -// -/* - * DateType.hxx : - * - * Auteur : Ivan DUTKA-MALEN - EDF R&D - * Mail : mailto:ivan.dutka-malen@der.edf.fr - * Date : Wed Nov 26 11:15:34 2003 - * Projet : Salome 2 - * - */ - -#ifndef _DATETYPE_H_ -#define _DATETYPE_H_ - -#include "Batch_Defines.hxx" - -#include -#include "Batch_GenericType.hxx" -#include "Batch_Date.hxx" - -namespace Batch { - - class BATCH_EXPORT DateType : public GenericType - { - public: - // Constructeur - DateType(const Date & d) : _data(d) {}; - - // Conversion en chaine - virtual std::string affiche() const; - - // Operateur d'affectation - virtual DateType & operator =(const Date &); - - // Conversion en Date - virtual operator Date() const; - - // Conversion en long - virtual operator long() const; - - // Clone duplique l'objet et en fabrique un nouveau a l'aide de new - // qu'il faudra detruire ensuite manuellement - virtual GenericType * clone() const; - - protected: - Date _data; - - private: - }; - -} - -#endif - diff --git a/src/Batch/Batch_Defines.hxx b/src/Batch/Batch_Defines.hxx deleted file mode 100755 index 84548ad42..000000000 --- a/src/Batch/Batch_Defines.hxx +++ /dev/null @@ -1,42 +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 -// -// File : Batch_Defines.hxx -// Author : Alexander A. BORODIN -// Module : SALOME -// -#ifndef _BATCH_Defines_HXX_ -#define _BATCH_Defines_HXX_ - -#ifdef WIN32 -# if defined BATCH_EXPORTS || defined SalomeBatch_EXPORTS -# define BATCH_EXPORT __declspec( dllexport ) -# else -# define BATCH_EXPORT __declspec( dllimport ) -# endif -# define RM "rm" -# define RCP "rpc" -# define RSH "rsh" -#else -# define BATCH_EXPORT -#endif - -#endif diff --git a/src/Batch/Batch_Environnement.cxx b/src/Batch/Batch_Environnement.cxx deleted file mode 100644 index f74b03025..000000000 --- a/src/Batch/Batch_Environnement.cxx +++ /dev/null @@ -1,38 +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 -// -/* - * Environnement.cxx : - * - * Auteur : Ivan DUTKA-MALEN - EDF R&D - * Mail : mailto:ivan.dutka-malen@der.edf.fr - * Date : Thu Oct 16 11:37:47 2003 - * Projet : Salome 2 - * - */ - -#include "Batch_Environnement.hxx" -using namespace std; - -namespace Batch { - - -} diff --git a/src/Batch/Batch_Environnement.hxx b/src/Batch/Batch_Environnement.hxx deleted file mode 100644 index 354be1b1a..000000000 --- a/src/Batch/Batch_Environnement.hxx +++ /dev/null @@ -1,48 +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 -// -/* - * Environnement.hxx : - * - * Auteur : Ivan DUTKA-MALEN - EDF R&D - * Mail : mailto:ivan.dutka-malen@der.edf.fr - * Date : Thu Oct 16 11:37:47 2003 - * Projet : Salome 2 - * - */ - -#ifndef _ENVIRONNEMENT_H_ -#define _ENVIRONNEMENT_H_ - -#include "Batch_Defines.hxx" - - -#include -#include - -namespace Batch { - - typedef std::map < std::string, std::string > Environnement; - -} - -#endif - diff --git a/src/Batch/Batch_FactBatchManager.cxx b/src/Batch/Batch_FactBatchManager.cxx deleted file mode 100644 index 0adc4e7d0..000000000 --- a/src/Batch/Batch_FactBatchManager.cxx +++ /dev/null @@ -1,68 +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 -// -/* - * FactBatchManager.cxx : - * - * Auteur : Ivan DUTKA-MALEN - EDF R&D - * Date : Septembre 2004 - * Projet : SALOME 2 - * - */ - -#include -#include -#include -#include "Batch_BatchManagerCatalog.hxx" -#include "Batch_FactBatchManager.hxx" -using namespace std; - -namespace Batch { - - // Constructeur - FactBatchManager::FactBatchManager(const string & _t) : type(_t) - { - BatchManagerCatalog::addFactBatchManager(type.c_str(), this); - ostringstream msg; - msg << "FactBatchManager of type '" << type << "' inserted into catalog"; - cerr << msg.str().c_str() << endl; - } - - // Destructeur - FactBatchManager::~FactBatchManager() - { - // Nothing to do - } - - // Accesseur - string FactBatchManager::getType() const - { - return type; - } - - string FactBatchManager::__repr__() const - { - ostringstream oss; - oss << ""; - return oss.str(); - } - -} diff --git a/src/Batch/Batch_FactBatchManager.hxx b/src/Batch/Batch_FactBatchManager.hxx deleted file mode 100644 index 6b73b0159..000000000 --- a/src/Batch/Batch_FactBatchManager.hxx +++ /dev/null @@ -1,63 +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 -// -/* - * FactBatchManager.hxx : - * - * Auteur : Ivan DUTKA-MALEN - EDF R&D - * Date : Septembre 2004 - * Projet : SALOME 2 - * - */ - -#ifndef _FACTBATCHMANAGER_H_ -#define _FACTBATCHMANAGER_H_ - -#include "Batch_Defines.hxx" - -#include -#include - -namespace Batch { - - class BatchManager; - - class BATCH_EXPORT FactBatchManager - { - public: - // Constructeur et destructeur - FactBatchManager(const std::string & type); - virtual ~FactBatchManager(); - - virtual Batch::BatchManager * operator() (const char * hostname) const = 0; - std::string getType() const; - std::string __repr__() const; - - protected: - std::string type; - - private: - - }; - -} - -#endif diff --git a/src/Batch/Batch_FactBatchManager_LSF.cxx b/src/Batch/Batch_FactBatchManager_LSF.cxx deleted file mode 100644 index 6149947ff..000000000 --- a/src/Batch/Batch_FactBatchManager_LSF.cxx +++ /dev/null @@ -1,60 +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 -// -/* - * FactBatchManager_LSF.cxx : - * - * Auteur : Ivan DUTKA-MALEN - EDF R&D - * Date : Septembre 2004 - * Projet : SALOME 2 - * - */ - -#include -#include "Batch_BatchManager_LSF.hxx" -#include "Batch_FactBatchManager_LSF.hxx" -//#include "utilities.h" - -namespace Batch { - - static FactBatchManager_LSF sFBM_LSF; - - // Constructeur - FactBatchManager_LSF::FactBatchManager_LSF() : FactBatchManager("LSF") - { - // Nothing to do - } - - // Destructeur - FactBatchManager_LSF::~FactBatchManager_LSF() - { - // Nothing to do - } - - // Functor - BatchManager * FactBatchManager_LSF::operator() (const char * hostname) const - { - // MESSAGE("Building new BatchManager_LSF on host '" << hostname << "'"); - return new BatchManager_LSF(this, hostname); - } - - -} diff --git a/src/Batch/Batch_FactBatchManager_LSF.hxx b/src/Batch/Batch_FactBatchManager_LSF.hxx deleted file mode 100644 index 59ef2ad4f..000000000 --- a/src/Batch/Batch_FactBatchManager_LSF.hxx +++ /dev/null @@ -1,57 +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 -// -/* - * FactBatchManager_LSF.hxx : - * - * Auteur : Ivan DUTKA-MALEN - EDF R&D - * Date : Septembre 2004 - * Projet : SALOME 2 - * - */ - -#ifndef _FACTBATCHMANAGER_LSF_H_ -#define _FACTBATCHMANAGER_LSF_H_ - -#include "Batch_FactBatchManager.hxx" - -namespace Batch { - - class BatchManager_LSF; - - class FactBatchManager_LSF : public FactBatchManager - { - public: - // Constructeur et destructeur - FactBatchManager_LSF(); - virtual ~FactBatchManager_LSF(); - - virtual BatchManager * operator() (const char * hostname) const; - - protected: - - private: - - }; - -} - -#endif diff --git a/src/Batch/Batch_FactBatchManager_Local.cxx b/src/Batch/Batch_FactBatchManager_Local.cxx deleted file mode 100644 index 46fb1302f..000000000 --- a/src/Batch/Batch_FactBatchManager_Local.cxx +++ /dev/null @@ -1,60 +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 -// -/* - * FactBatchManager_Local.cxx : - * - * Auteur : Ivan DUTKA-MALEN - EDF R&D - * Date : Septembre 2004 - * Projet : SALOME 2 - * - */ - -#include -#include "Batch_BatchManager_Local.hxx" -#include "Batch_FactBatchManager_Local.hxx" -//#include "utilities.h" - -namespace Batch { - -// static FactBatchManager_Local sFBM_Local; - - // Constructeur - FactBatchManager_Local::FactBatchManager_Local() : FactBatchManager("Local") - { - // Nothing to do - } - - // Destructeur - FactBatchManager_Local::~FactBatchManager_Local() - { - // Nothing to do - } - - // Functor -// BatchManager * FactBatchManager_Local::operator() (const char * hostname) const -// { -// // MESSAGE("Building new BatchManager_Local on host '" << hostname << "'"); -// return new BatchManager_Local(this, hostname); -// } - - -} diff --git a/src/Batch/Batch_FactBatchManager_Local.hxx b/src/Batch/Batch_FactBatchManager_Local.hxx deleted file mode 100644 index 4b2f0d497..000000000 --- a/src/Batch/Batch_FactBatchManager_Local.hxx +++ /dev/null @@ -1,57 +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 -// -/* - * FactBatchManager_Local.hxx : - * - * Auteur : Ivan DUTKA-MALEN - EDF R&D - * Date : Septembre 2004 - * Projet : SALOME 2 - * - */ - -#ifndef _FACTBATCHMANAGER_LOCAL_H_ -#define _FACTBATCHMANAGER_LOCAL_H_ - -#include "Batch_FactBatchManager.hxx" - -namespace Batch { - - class BatchManager_Local; - - class FactBatchManager_Local : public FactBatchManager - { - public: - // Constructeur et destructeur - FactBatchManager_Local(); - virtual ~FactBatchManager_Local(); - - virtual BatchManager * operator() (const char * hostname) const = 0; - - protected: - - private: - - }; - -} - -#endif diff --git a/src/Batch/Batch_FactBatchManager_Local_RSH.cxx b/src/Batch/Batch_FactBatchManager_Local_RSH.cxx deleted file mode 100644 index 8e21bb577..000000000 --- a/src/Batch/Batch_FactBatchManager_Local_RSH.cxx +++ /dev/null @@ -1,58 +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 -// -/* - * FactBatchManager_Local_RSH.cxx : - * - * Auteur : Ivan DUTKA-MALEN - EDF R&D - * Date : Septembre 2004 - * Projet : SALOME 2 - * - */ - -#include -#include "Batch_BatchManager_Local_RSH.hxx" -#include "Batch_FactBatchManager_Local_RSH.hxx" -//#include "utilities.h" - -namespace Batch { - - // Constructeur - FactBatchManager_Local_RSH::FactBatchManager_Local_RSH() : FactBatchManager("RSH") - { - // Nothing to do - } - - // Destructeur - FactBatchManager_Local_RSH::~FactBatchManager_Local_RSH() - { - // Nothing to do - } - - // Functor - BatchManager * FactBatchManager_Local_RSH::operator() (const char * hostname) const - { - // MESSAGE("Building new BatchManager_Local_RSH on host '" << hostname << "'"); - return new BatchManager_Local_RSH(this, hostname); - } - - -} diff --git a/src/Batch/Batch_FactBatchManager_Local_RSH.hxx b/src/Batch/Batch_FactBatchManager_Local_RSH.hxx deleted file mode 100644 index 8b11c5d00..000000000 --- a/src/Batch/Batch_FactBatchManager_Local_RSH.hxx +++ /dev/null @@ -1,57 +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 -// -/* - * FactBatchManager_Local_RSH.hxx : - * - * Auteur : Ivan DUTKA-MALEN - EDF R&D - * Date : Septembre 2004 - * Projet : SALOME 2 - * - */ - -#ifndef _FACTBATCHMANAGER_LOCAL_RSH_H_ -#define _FACTBATCHMANAGER_LOCAL_RSH_H_ - -#include "Batch_FactBatchManager.hxx" - -namespace Batch { - - class BatchManager_Local_RSH; - - class FactBatchManager_Local_RSH : public FactBatchManager - { - public: - // Constructeur et destructeur - FactBatchManager_Local_RSH(); - virtual ~FactBatchManager_Local_RSH(); - - virtual BatchManager * operator() (const char * hostname) const; - - protected: - - private: - - }; - -} - -#endif diff --git a/src/Batch/Batch_FactBatchManager_Local_SH.cxx b/src/Batch/Batch_FactBatchManager_Local_SH.cxx deleted file mode 100644 index a317e3c5a..000000000 --- a/src/Batch/Batch_FactBatchManager_Local_SH.cxx +++ /dev/null @@ -1,60 +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 -// -/* - * FactBatchManager_Local_SH.cxx : - * - * Auteur : Ivan DUTKA-MALEN - EDF R&D - * Date : Septembre 2004 - * Projet : SALOME 2 - * - */ - -#include -#include "Batch_BatchManager_Local_SH.hxx" -#include "Batch_FactBatchManager_Local_SH.hxx" -//#include "utilities.h" - -namespace Batch { - - static FactBatchManager_Local_SH sFBM_Local_SH; - - // Constructeur - FactBatchManager_Local_SH::FactBatchManager_Local_SH() : FactBatchManager("SH") - { - // Nothing to do - } - - // Destructeur - FactBatchManager_Local_SH::~FactBatchManager_Local_SH() - { - // Nothing to do - } - - // Functor - BatchManager * FactBatchManager_Local_SH::operator() (const char * hostname) const - { - // MESSAGE("Building new BatchManager_Local_SH on host '" << hostname << "'"); - return new BatchManager_Local_SH(this, hostname); - } - - -} diff --git a/src/Batch/Batch_FactBatchManager_Local_SH.hxx b/src/Batch/Batch_FactBatchManager_Local_SH.hxx deleted file mode 100644 index 499eafef4..000000000 --- a/src/Batch/Batch_FactBatchManager_Local_SH.hxx +++ /dev/null @@ -1,57 +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 -// -/* - * FactBatchManager_Local_SH.hxx : - * - * Auteur : Ivan DUTKA-MALEN - EDF R&D - * Date : Septembre 2004 - * Projet : SALOME 2 - * - */ - -#ifndef _FACTBATCHMANAGER_LOCAL_SH_H_ -#define _FACTBATCHMANAGER_LOCAL_SH_H_ - -#include "Batch_FactBatchManager.hxx" - -namespace Batch { - - class BatchManager_Local_SH; - - class FactBatchManager_Local_SH : public FactBatchManager - { - public: - // Constructeur et destructeur - FactBatchManager_Local_SH(); - virtual ~FactBatchManager_Local_SH(); - - virtual BatchManager * operator() (const char * hostname) const; - - protected: - - private: - - }; - -} - -#endif diff --git a/src/Batch/Batch_FactBatchManager_Local_SSH.cxx b/src/Batch/Batch_FactBatchManager_Local_SSH.cxx deleted file mode 100644 index d96237451..000000000 --- a/src/Batch/Batch_FactBatchManager_Local_SSH.cxx +++ /dev/null @@ -1,60 +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 -// -/* - * FactBatchManager_Local_SSH.cxx : - * - * Auteur : Ivan DUTKA-MALEN - EDF R&D - * Date : Septembre 2004 - * Projet : SALOME 2 - * - */ - -#include -#include "Batch_BatchManager_Local_SSH.hxx" -#include "Batch_FactBatchManager_Local_SSH.hxx" -//#include "utilities.h" - -namespace Batch { - - static FactBatchManager_Local_SSH sFBM_Local_SSH; - - // Constructeur - FactBatchManager_Local_SSH::FactBatchManager_Local_SSH() : FactBatchManager("SSH") - { - // Nothing to do - } - - // Destructeur - FactBatchManager_Local_SSH::~FactBatchManager_Local_SSH() - { - // Nothing to do - } - - // Functor - BatchManager * FactBatchManager_Local_SSH::operator() (const char * hostname) const - { - // MESSAGE("Building new BatchManager_Local_SSH on host '" << hostname << "'"); - return new BatchManager_Local_SSH(this, hostname); - } - - -} diff --git a/src/Batch/Batch_FactBatchManager_Local_SSH.hxx b/src/Batch/Batch_FactBatchManager_Local_SSH.hxx deleted file mode 100644 index 7f64f0e26..000000000 --- a/src/Batch/Batch_FactBatchManager_Local_SSH.hxx +++ /dev/null @@ -1,57 +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 -// -/* - * FactBatchManager_Local_SSH.hxx : - * - * Auteur : Ivan DUTKA-MALEN - EDF R&D - * Date : Septembre 2004 - * Projet : SALOME 2 - * - */ - -#ifndef _FACTBATCHMANAGER_LOCAL_SSH_H_ -#define _FACTBATCHMANAGER_LOCAL_SSH_H_ - -#include "Batch_FactBatchManager.hxx" - -namespace Batch { - - class BatchManager_Local_SSH; - - class FactBatchManager_Local_SSH : public FactBatchManager - { - public: - // Constructeur et destructeur - FactBatchManager_Local_SSH(); - virtual ~FactBatchManager_Local_SSH(); - - virtual BatchManager * operator() (const char * hostname) const; - - protected: - - private: - - }; - -} - -#endif diff --git a/src/Batch/Batch_FactBatchManager_PBS.cxx b/src/Batch/Batch_FactBatchManager_PBS.cxx deleted file mode 100644 index 43c79e213..000000000 --- a/src/Batch/Batch_FactBatchManager_PBS.cxx +++ /dev/null @@ -1,58 +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 -// -/* - * FactBatchManager_PBS.cxx : - * - * Auteur : Ivan DUTKA-MALEN - EDF R&D - * Date : Septembre 2004 - * Projet : SALOME 2 - * - */ - -#include "Batch_BatchManager_PBS.hxx" -#include "Batch_FactBatchManager_PBS.hxx" -using namespace std; - -namespace Batch { - - static FactBatchManager_PBS sFBM_PBS; - - // Constructeur - FactBatchManager_PBS::FactBatchManager_PBS() : FactBatchManager("PBS") - { - // Nothing to do - } - - // Destructeur - FactBatchManager_PBS::~FactBatchManager_PBS() - { - // Nothing to do - } - - // Functor - BatchManager * FactBatchManager_PBS::operator() (const char * hostname) const - { - return new BatchManager_PBS(this, hostname); - } - - -} diff --git a/src/Batch/Batch_FactBatchManager_PBS.hxx b/src/Batch/Batch_FactBatchManager_PBS.hxx deleted file mode 100644 index cc43b6e2d..000000000 --- a/src/Batch/Batch_FactBatchManager_PBS.hxx +++ /dev/null @@ -1,57 +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 -// -/* - * FactBatchManager_PBS.hxx : - * - * Auteur : Ivan DUTKA-MALEN - EDF R&D - * Date : Septembre 2004 - * Projet : SALOME 2 - * - */ - -#ifndef _FACTBATCHMANAGER_PBS_H_ -#define _FACTBATCHMANAGER_PBS_H_ - -#include "Batch_FactBatchManager.hxx" - -namespace Batch { - - class BatchManager_PBS; - - class FactBatchManager_PBS : public FactBatchManager - { - public: - // Constructeur et destructeur - FactBatchManager_PBS(); - virtual ~FactBatchManager_PBS(); - - virtual BatchManager * operator() (const char * hostname) const; - - protected: - - private: - - }; - -} - -#endif diff --git a/src/Batch/Batch_FactBatchManager_eClient.cxx b/src/Batch/Batch_FactBatchManager_eClient.cxx deleted file mode 100644 index 528bed807..000000000 --- a/src/Batch/Batch_FactBatchManager_eClient.cxx +++ /dev/null @@ -1,50 +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 -// -/* - * FactBatchManager_eClient.cxx : emulation of client - * - * Auteur : Bernard SECHER - CEA DEN - * Mail : mailto:bernard.secher@cea.fr - * Date : Thu Apr 24 10:17:22 2008 - * Projet : PAL Salome - * - */ - -#include -#include -#include "Batch_FactBatchManager_eClient.hxx" -using namespace std; - -namespace Batch { - - // Constructeur - FactBatchManager_eClient::FactBatchManager_eClient(const string & _t) : FactBatchManager(_t) - { - } - - // Destructeur - FactBatchManager_eClient::~FactBatchManager_eClient() - { - // Nothing to do - } - -} diff --git a/src/Batch/Batch_FactBatchManager_eClient.hxx b/src/Batch/Batch_FactBatchManager_eClient.hxx deleted file mode 100644 index 82192d714..000000000 --- a/src/Batch/Batch_FactBatchManager_eClient.hxx +++ /dev/null @@ -1,60 +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 -// -/* - * FactBatchManager_eClient.hxx : emulation of client - * - * Auteur : Bernard SECHER - CEA DEN - * Mail : mailto:bernard.secher@cea.fr - * Date : Thu Apr 24 10:17:22 2008 - * Projet : PAL Salome - * - */ - -#ifndef _FACTBATCHMANAGER_eClient_H_ -#define _FACTBATCHMANAGER_eClient_H_ - -#include -#include -#include "Batch_FactBatchManager.hxx" - -namespace Batch { - - class BatchManager_eClient; - - class FactBatchManager_eClient : public FactBatchManager - { - public: - // Constructeur et destructeur - FactBatchManager_eClient(const std::string & type); - virtual ~FactBatchManager_eClient(); - - virtual Batch::BatchManager_eClient * operator() (const char * hostname,const char * protocol, const char * mpi) const = 0; - - protected: - - private: - - }; - -} - -#endif diff --git a/src/Batch/Batch_FactBatchManager_eLSF.cxx b/src/Batch/Batch_FactBatchManager_eLSF.cxx deleted file mode 100644 index e46b355bd..000000000 --- a/src/Batch/Batch_FactBatchManager_eLSF.cxx +++ /dev/null @@ -1,63 +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 -// -/* - * FactBatchManager_eLSF.cxx : - * - * Auteur : Bernard SECHER - CEA DEN - * Date : Avril 2008 - * Projet : PAL Salome - * - */ - -#include -#include "Batch_BatchManager_eLSF.hxx" -#include "Batch_FactBatchManager_eLSF.hxx" -//#include "utilities.h" - -namespace Batch { - - // Constructeur - FactBatchManager_eLSF::FactBatchManager_eLSF() : FactBatchManager_eClient("eLSF") - { - // Nothing to do - } - - // Destructeur - FactBatchManager_eLSF::~FactBatchManager_eLSF() - { - // Nothing to do - } - - // Functor - BatchManager * FactBatchManager_eLSF::operator() (const char * hostname) const - { - // MESSAGE("Building new BatchManager_LSF on host '" << hostname << "'"); - return new BatchManager_eLSF(this, hostname); - } - - BatchManager_eClient * FactBatchManager_eLSF::operator() (const char * hostname, const char * protocol, const char * mpiImpl) const - { - // MESSAGE("Building new BatchManager_LSF on host '" << hostname << "'"); - return new BatchManager_eLSF(this, hostname, protocol, mpiImpl); - } - -} diff --git a/src/Batch/Batch_FactBatchManager_eLSF.hxx b/src/Batch/Batch_FactBatchManager_eLSF.hxx deleted file mode 100644 index d2dec68b1..000000000 --- a/src/Batch/Batch_FactBatchManager_eLSF.hxx +++ /dev/null @@ -1,63 +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 -// -/* - * FactBatchManager_eLSF.hxx : - * - * Auteur : Bernard SECHER : CEA DEN - * Date : Avril 2008 - * Projet : PAL Salome - * - */ - -#ifndef _FACTBATCHMANAGER_eLSF_H_ -#define _FACTBATCHMANAGER_eLSF_H_ - -#include "Batch_Defines.hxx" - -#include -#include -#include "Batch_BatchManager_eClient.hxx" -#include "Batch_FactBatchManager_eClient.hxx" - -namespace Batch { - - class BatchManager_eLSF; - - class BATCH_EXPORT FactBatchManager_eLSF : public FactBatchManager_eClient - { - public: - // Constructeur et destructeur - FactBatchManager_eLSF(); - virtual ~FactBatchManager_eLSF(); - - virtual BatchManager * operator() (const char * hostname) const; - virtual BatchManager_eClient * operator() (const char * hostname, const char * protocol, const char * mpiImpl) const; - - protected: - - private: - - }; - -} - -#endif diff --git a/src/Batch/Batch_FactBatchManager_ePBS.cxx b/src/Batch/Batch_FactBatchManager_ePBS.cxx deleted file mode 100644 index 863ed5212..000000000 --- a/src/Batch/Batch_FactBatchManager_ePBS.cxx +++ /dev/null @@ -1,64 +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 -// -/* - * FactBatchManager_ePBS.cxx : - * - * Auteur : Bernard SECHER - CEA DEN - * Date : Avril 2008 - * Projet : PAL Salome - * - */ - -#include -#include "Batch_BatchManager_ePBS.hxx" -#include "Batch_FactBatchManager_ePBS.hxx" -//#include "utilities.h" - -namespace Batch { - - // Constructeur - FactBatchManager_ePBS::FactBatchManager_ePBS() : FactBatchManager_eClient("ePBS") - { - // Nothing to do - } - - // Destructeur - FactBatchManager_ePBS::~FactBatchManager_ePBS() - { - // Nothing to do - } - - // Functor - BatchManager * FactBatchManager_ePBS::operator() (const char * hostname) const - { - // MESSAGE("Building new BatchManager_PBS on host '" << hostname << "'"); - return new BatchManager_ePBS(this, hostname); - } - - BatchManager_eClient * FactBatchManager_ePBS::operator() (const char * hostname, const char * protocol, const char * mpiImpl) const - { - // MESSAGE("Building new BatchManager_PBS on host '" << hostname << "'"); - return new BatchManager_ePBS(this, hostname, protocol, mpiImpl); - } - - -} diff --git a/src/Batch/Batch_FactBatchManager_ePBS.hxx b/src/Batch/Batch_FactBatchManager_ePBS.hxx deleted file mode 100644 index 027e9ed62..000000000 --- a/src/Batch/Batch_FactBatchManager_ePBS.hxx +++ /dev/null @@ -1,63 +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 -// -/* - * FactBatchManager_ePBS.hxx : - * - * Auteur : Bernard SECHER : CEA DEN - * Date : Avril 2008 - * Projet : PAL Salome - * - */ - -#ifndef _FACTBATCHMANAGER_ePBS_H_ -#define _FACTBATCHMANAGER_ePBS_H_ - -#include "Batch_Defines.hxx" - -#include -#include -#include "Batch_BatchManager_eClient.hxx" -#include "Batch_FactBatchManager_eClient.hxx" - -namespace Batch { - - class BatchManager_ePBS; - - class BATCH_EXPORT FactBatchManager_ePBS : public FactBatchManager_eClient - { - public: - // Constructeur et destructeur - FactBatchManager_ePBS(); - virtual ~FactBatchManager_ePBS(); - - virtual BatchManager * operator() (const char * hostname) const; - virtual BatchManager_eClient * operator() (const char * hostname, const char * protocol, const char * mpiImpl) const; - - protected: - - private: - - }; - -} - -#endif diff --git a/src/Batch/Batch_FactBatchManager_eSGE.cxx b/src/Batch/Batch_FactBatchManager_eSGE.cxx deleted file mode 100644 index c7a6c9f90..000000000 --- a/src/Batch/Batch_FactBatchManager_eSGE.cxx +++ /dev/null @@ -1,66 +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 -// -/* - * FactBatchManager_eSGE.cxx : - * - * Auteur : Bernard SECHER - CEA DEN - * Date : Avril 2008 - * Projet : PAL Salome - * - */ - -#include -#include "Batch_BatchManager_eSGE.hxx" -#include "Batch_FactBatchManager_eSGE.hxx" -//#include "utilities.h" - -namespace Batch { - - static FactBatchManager_eSGE sFBM_eSGE; - - // Constructeur - FactBatchManager_eSGE::FactBatchManager_eSGE() : FactBatchManager_eClient("eSGE") - { - // Nothing to do - } - - // Destructeur - FactBatchManager_eSGE::~FactBatchManager_eSGE() - { - // Nothing to do - } - - // Functor - BatchManager * FactBatchManager_eSGE::operator() (const char * hostname) const - { - // MESSAGE("Building new BatchManager_SGE on host '" << hostname << "'"); - return new BatchManager_eSGE(this, hostname); - } - - BatchManager_eClient * FactBatchManager_eSGE::operator() (const char * hostname, const char * protocol, const char * mpiImpl) const - { - // MESSAGE("Building new BatchManager_SGE on host '" << hostname << "'"); - return new BatchManager_eSGE(this, hostname, protocol, mpiImpl); - } - - -} diff --git a/src/Batch/Batch_FactBatchManager_eSGE.hxx b/src/Batch/Batch_FactBatchManager_eSGE.hxx deleted file mode 100644 index 44f7f6ce0..000000000 --- a/src/Batch/Batch_FactBatchManager_eSGE.hxx +++ /dev/null @@ -1,61 +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 -// -/* - * FactBatchManager_eSGE.hxx : - * - * Auteur : Bernard SECHER : CEA DEN - * Date : Avril 2008 - * Projet : PAL Salome - * - */ - -#ifndef _FACTBATCHMANAGER_eSGE_H_ -#define _FACTBATCHMANAGER_eSGE_H_ - -#include "Batch_Defines.hxx" - -#include "Batch_BatchManager_eClient.hxx" -#include "Batch_FactBatchManager_eClient.hxx" - -namespace Batch { - - class BatchManager_eSGE; - - class BATCH_EXPORT FactBatchManager_eSGE : public FactBatchManager_eClient - { - public: - // Constructeur et destructeur - FactBatchManager_eSGE(); - virtual ~FactBatchManager_eSGE(); - - virtual BatchManager * operator() (const char * hostname) const; - virtual BatchManager_eClient * operator() (const char * hostname, const char * protocol, const char * mpiImpl) const; - - protected: - - private: - - }; - -} - -#endif diff --git a/src/Batch/Batch_GenericException.cxx b/src/Batch/Batch_GenericException.cxx deleted file mode 100644 index 4303e1c57..000000000 --- a/src/Batch/Batch_GenericException.cxx +++ /dev/null @@ -1,37 +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 -// -/* - * GenericException.cxx : - * - * Auteur : Ivan DUTKA-MALEN - EDF R&D - * Mail : mailto:ivan.dutka-malen@der.edf.fr - * Date : Wed Nov 26 10:15:57 2003 - * Projet : Salome 2 - * - */ - -#include "Batch_GenericException.hxx" -using namespace std; - -namespace Batch { - -} diff --git a/src/Batch/Batch_GenericException.hxx b/src/Batch/Batch_GenericException.hxx deleted file mode 100644 index ed80ab193..000000000 --- a/src/Batch/Batch_GenericException.hxx +++ /dev/null @@ -1,54 +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 -// -/* - * GenericException.hxx : - * - * Auteur : Ivan DUTKA-MALEN - EDF R&D - * Mail : mailto:ivan.dutka-malen@der.edf.fr - * Date : Wed Nov 26 10:15:56 2003 - * Projet : Salome 2 - * - */ - -#ifndef _GENERICEXCEPTION_H_ -#define _GENERICEXCEPTION_H_ - -#include "Batch_Defines.hxx" - - -#include - -namespace Batch { - - class BATCH_EXPORT GenericException - { - public: - const std::string type; // la nature de l'exception - const std::string message; // la raison de l'exception - - // Constructeur - GenericException(const std::string tp = "GenericException", const std::string ch = "undefined") : type(tp), message(ch) {} - }; - -} - -#endif diff --git a/src/Batch/Batch_GenericType.cxx b/src/Batch/Batch_GenericType.cxx deleted file mode 100644 index 95a5a16a2..000000000 --- a/src/Batch/Batch_GenericType.cxx +++ /dev/null @@ -1,65 +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 -// -/* - * GenericType.cxx : - * - * Auteur : Ivan DUTKA-MALEN - EDF R&D - * Date : Septembre 2003 - * Projet : SALOME 2 - * - */ - - -#include -#include -#include -#include "Batch_GenericType.hxx" -using namespace std; - -namespace Batch { - - // nombre total d'objet GenericType et al. - int GenericType::_nb = 0; - - // Operateur pour l'affichage sur un stream - ostream & operator << (ostream & os, const GenericType & obj) - { - return os << obj.affiche(); - } - - // Conversion en chaine - string GenericType::affiche() const - { - return string("(GenericType : si ce message apparait, vous devez avoir un probleme)"); - } - - // Clone duplique l'objet et en fabrique un nouveau a l'aide de new - // qu'il faudra detruire ensuite manuellement - GenericType * GenericType::clone() const - { - GenericType * pG = new GenericType; - assert(pG != 0); - return pG; - } - -} - diff --git a/src/Batch/Batch_GenericType.hxx b/src/Batch/Batch_GenericType.hxx deleted file mode 100644 index 613d1f5ff..000000000 --- a/src/Batch/Batch_GenericType.hxx +++ /dev/null @@ -1,72 +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 -// -/* - * GenericType.hxx : - * - * Auteur : Ivan DUTKA-MALEN - EDF R&D - * Date : Septembre 2003 - * Projet : SALOME 2 - * - */ - -#ifndef _GENERICTYPE_H_ -#define _GENERICTYPE_H_ - -#include "Batch_Defines.hxx" - - -#include -#include - -namespace Batch { - - class BATCH_EXPORT GenericType - { - public: - // Constructeur et destructeur - GenericType() { _nb++; } - virtual ~GenericType() { _nb--; } - - // Operateur pour l'affichage sur un stream - friend std::ostream & operator << (std::ostream & os, const GenericType & obj); - - // Conversion en chaine - virtual std::string affiche() const; - - // Clone duplique l'objet et en fabrique un nouveau a l'aide de new - // qu'il faudra detruire ensuite manuellement - virtual GenericType * clone() const; - - // Retourne le nombre d'objets GenericType et al. - static int getNb() { return _nb; } - - protected: - - private: - static int _nb; // nombre total d'objets GenericType et al. - - }; - -} - -#endif - diff --git a/src/Batch/Batch_IOMutex.cxx b/src/Batch/Batch_IOMutex.cxx deleted file mode 100644 index 06a9f7e84..000000000 --- a/src/Batch/Batch_IOMutex.cxx +++ /dev/null @@ -1,38 +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 -// -/* - * IOMutex.cxx : - * - * Auteur : Ivan DUTKA-MALEN - EDF R&D - * Mail : mailto:ivan.dutka-malen@der.edf.fr - * Date : Fri Nov 14 11:00:39 2003 - * Projet : Salome 2 - * - */ - -#include "Batch_IOMutex.hxx" - -namespace Batch { - - pthread_mutex_t IOMutex = PTHREAD_MUTEX_INITIALIZER; - -} diff --git a/src/Batch/Batch_IOMutex.hxx b/src/Batch/Batch_IOMutex.hxx deleted file mode 100644 index a047b380f..000000000 --- a/src/Batch/Batch_IOMutex.hxx +++ /dev/null @@ -1,47 +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 -// -/* - * IOMutex.hxx : - * - * Auteur : Ivan DUTKA-MALEN - EDF R&D - * Mail : mailto:ivan.dutka-malen@der.edf.fr - * Date : Fri Nov 14 11:00:39 2003 - * Projet : Salome 2 - * - */ - -#ifndef _IOMUTEX_H_ -#define _IOMUTEX_H_ - -#include - -#define LOCK_IO { pthread_mutex_lock(&Batch::IOMutex) ; } -#define UNLOCK_IO { pthread_mutex_unlock(&Batch::IOMutex) ; } -#define UNDER_LOCK(statement) { LOCK_IO ; { statement ; } ; UNLOCK_IO ; } - -namespace Batch { - - extern pthread_mutex_t IOMutex; - -} - -#endif diff --git a/src/Batch/Batch_IntType.cxx b/src/Batch/Batch_IntType.cxx deleted file mode 100644 index aa704ef27..000000000 --- a/src/Batch/Batch_IntType.cxx +++ /dev/null @@ -1,72 +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 -// -/* - * IntType.cxx : - * - * Auteur : Ivan DUTKA-MALEN - EDF R&D - * Date : Septembre 2003 - * Projet : SALOME 2 - * - */ - -#include -#include -#include -//#include "MEDMEM_STRING.hxx" -#include "Batch_IntType.hxx" -using namespace std; - - -namespace Batch { - - // Conversion en chaine - string IntType::affiche() const - { - //MEDMEM::STRING sst; - ostringstream sst; - sst << _data; - return sst.str(); - } - - // Operateur d'affectation - IntType & IntType::operator =(int i) - { - _data = i; - return *this; - } - - // Conversion en int - IntType::operator int() const - { - return this->_data; - } - - // Clone duplique l'objet et en fabrique un nouveau a l'aide de new - // qu'il faudra detruire ensuite manuellement - GenericType * IntType::clone() const - { - IntType * pI = new IntType(this->_data); - assert(pI != 0); - return pI; - } - -} diff --git a/src/Batch/Batch_IntType.hxx b/src/Batch/Batch_IntType.hxx deleted file mode 100644 index 79db3b734..000000000 --- a/src/Batch/Batch_IntType.hxx +++ /dev/null @@ -1,69 +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 -// -/* - * IntType.hxx : - * - * Auteur : Ivan DUTKA-MALEN - EDF R&D - * Date : Septembre 2003 - * Projet : SALOME 2 - * - */ - -#ifndef _INTTYPE_H_ -#define _INTTYPE_H_ - -#include "Batch_Defines.hxx" - -#include -#include "Batch_GenericType.hxx" - -namespace Batch { - - class BATCH_EXPORT IntType : public GenericType - { - public: - // Constructeur - IntType(const int i=0) : _data(i) {} - - // Conversion en chaine - virtual std::string affiche() const; - - // Operateur d'affectation - virtual IntType & operator =(int); - - // Conversion en int - virtual operator int() const; - - // Clone duplique l'objet et en fabrique un nouveau a l'aide de new - // qu'il faudra detruire ensuite manuellement - virtual GenericType * clone() const; - - protected: - int _data; - - private: - - }; - -} - -#endif diff --git a/src/Batch/Batch_InvalidArgumentException.cxx b/src/Batch/Batch_InvalidArgumentException.cxx deleted file mode 100644 index b57b83453..000000000 --- a/src/Batch/Batch_InvalidArgumentException.cxx +++ /dev/null @@ -1,37 +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 -// -/* - * InvalidArgumentException.cxx : - * - * Auteur : Ivan DUTKA-MALEN - EDF R&D - * Mail : mailto:ivan.dutka-malen@der.edf.fr - * Date : Thu Oct 16 16:18:00 2003 - * Projet : Salome 2 - * - */ - -#include "Batch_InvalidArgumentException.hxx" -using namespace std; - -namespace Batch { - -} diff --git a/src/Batch/Batch_InvalidArgumentException.hxx b/src/Batch/Batch_InvalidArgumentException.hxx deleted file mode 100644 index b8dd07289..000000000 --- a/src/Batch/Batch_InvalidArgumentException.hxx +++ /dev/null @@ -1,53 +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 -// -/* - * InvalidArgumentException.hxx : - * - * Auteur : Ivan DUTKA-MALEN - EDF R&D - * Mail : mailto:ivan.dutka-malen@der.edf.fr - * Date : Thu Oct 16 16:18:00 2003 - * Projet : Salome 2 - * - */ - -#ifndef _INVALIDARGUMENTEXCEPTION_H_ -#define _INVALIDARGUMENTEXCEPTION_H_ - - -#include "Batch_Defines.hxx" - -#include "Batch_GenericException.hxx" -#include "Batch_GenericException.hxx" - -namespace Batch { - - class BATCH_EXPORT InvalidArgumentException : public GenericException - { - public: - // Constructeur - InvalidArgumentException(std::string ch = "undefined") : GenericException("InvalidArgumentException", ch) {} - }; - -} - -#endif - diff --git a/src/Batch/Batch_InvalidKeyException.cxx b/src/Batch/Batch_InvalidKeyException.cxx deleted file mode 100644 index 2daaabfd1..000000000 --- a/src/Batch/Batch_InvalidKeyException.cxx +++ /dev/null @@ -1,38 +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 -// -/* - * InvalidKeyException.cxx : - * - * Auteur : Ivan DUTKA-MALEN - EDF R&D - * Mail : mailto:ivan.dutka-malen@der.edf.fr - * Date : Wed Oct 15 10:39:51 2003 - * Projet : Salome 2 - * - */ - -#include "Batch_InvalidKeyException.hxx" -using namespace std; - -namespace Batch { - -} - diff --git a/src/Batch/Batch_InvalidKeyException.hxx b/src/Batch/Batch_InvalidKeyException.hxx deleted file mode 100644 index 9fc8c70de..000000000 --- a/src/Batch/Batch_InvalidKeyException.hxx +++ /dev/null @@ -1,58 +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 -// -/* - * InvalidKeyException.hxx : - * - * Auteur : Ivan DUTKA-MALEN - EDF R&D - * Mail : mailto:ivan.dutka-malen@der.edf.fr - * Date : Wed Oct 15 10:39:51 2003 - * Projet : Salome 2 - * - */ - -#ifndef _INVALIDKEYEXCEPTION_H_ -#define _INVALIDKEYEXCEPTION_H_ - -#include "Batch_Defines.hxx" - - -#include "Batch_GenericException.hxx" -#include "Batch_GenericException.hxx" - -namespace Batch { - - class BATCH_EXPORT InvalidKeyException : public GenericException - { - public: - // Constructeur - InvalidKeyException(std::string ch = "undefined") : GenericException("InvalidKeyException", ch) {} - - protected: - - private: - - }; - -} - -#endif - diff --git a/src/Batch/Batch_Job.cxx b/src/Batch/Batch_Job.cxx deleted file mode 100644 index 276037296..000000000 --- a/src/Batch/Batch_Job.cxx +++ /dev/null @@ -1,117 +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 -// -/* - * Job.cxx : - * - * Auteur : Ivan DUTKA-MALEN - EDF R&D - * Date : Septembre 2003 - * Projet : SALOME 2 - * - */ - -#include "Batch_Job.hxx" -#include "Batch_Parametre.hxx" -#include -//#include "MEDMEM_STRING.hxx" -using namespace std; - -namespace Batch { - - // Constructeur - Job::Job() : _param(), _env() - { - // Nothing to do - } - - - // Constructeur - Job::Job(Parametre param) : _param(param), _env() - { - // Nothing to do - } - - - // Constructeur - Job::Job(Environnement env) : _param(), _env(env) - { - // Nothing to do - } - - - // Constructeur - Job::Job(Parametre param, Environnement env) : _param(param), _env(env) - { - // Nothing to do - } - - // Operateur pour l'affichage sur un stream - ostream & operator <<(ostream & os, const Job & job) - { - return os << job.__str__(); - } - - // Accesseur - Batch::Parametre Job::getParametre() const - { - return _param; - } - - // Accesseur - void Job::setParametre(const Batch::Parametre & param) - { - _param = param; - } - - // Accesseur - Environnement Job::getEnvironnement() const - { - return _env; - } - - // Accesseur - void Job::setEnvironnement(const Environnement & env) - { - _env = env; - } - - - // Methode pour l'interfacage avec Python (SWIG) : affichage en Python - string Job::__str__() const { - //MEDMEM::STRING str; - ostringstream str; - str << ""; - return str.str(); - } - - -} diff --git a/src/Batch/Batch_Job.hxx b/src/Batch/Batch_Job.hxx deleted file mode 100644 index 264fb8e82..000000000 --- a/src/Batch/Batch_Job.hxx +++ /dev/null @@ -1,78 +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 -// -/* - * Job.hxx : - * - * Auteur : Ivan DUTKA-MALEN - EDF R&D - * Date : Septembre 2003 - * Projet : SALOME 2 - * - */ - -#ifndef _JOB_H_ -#define _JOB_H_ - -#include "Batch_Defines.hxx" - - -#include "Batch_Parametre.hxx" -#include "Batch_Environnement.hxx" - -namespace Batch { - - class BATCH_EXPORT Job - { - public: - // Constructeurs et destructeur - Job(); - Job(Batch::Parametre param); - Job(Batch::Environnement env); - Job(Batch::Parametre param, Batch::Environnement env); - virtual ~Job() {} - - // Operateur pour l'affichage sur un stream - friend std::ostream & operator <<(std::ostream & os, const Job & job); - - // Accesseurs - Batch::Parametre getParametre() const; - void setParametre(const Batch::Parametre &); - - // Accesseurs - Batch::Environnement getEnvironnement() const; - void setEnvironnement(const Batch::Environnement &); - - // Methodes pour l'interfacage avec Python (SWIG) - // TODO : supprimer ces methodes et transferer leur definitions dans SWIG - std::string __str__() const; // SWIG : affichage en Python - std::string __repr__() const { return __str__(); }; // SWIG : affichage en Python - - protected: - Batch::Parametre _param; // table des parametres batch du job - Batch::Environnement _env; // table des variables d'environnement - - private: - - }; - -} - -#endif diff --git a/src/Batch/Batch_JobId.cxx b/src/Batch/Batch_JobId.cxx deleted file mode 100644 index c465ada53..000000000 --- a/src/Batch/Batch_JobId.cxx +++ /dev/null @@ -1,137 +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 -// -/* - * JobId.cxx : - * - * Auteur : Ivan DUTKA-MALEN - EDF R&D - * Date : Septembre 2003 - * Projet : SALOME 2 - * - */ - -#include "Batch_JobId.hxx" -#include "Batch_BatchManager.hxx" -#include -#include -//#include "MEDMEM_STRING.hxx" -using namespace std; - -namespace Batch { - - // Constructeur standard - JobId::JobId() : _p_batchmanager(), _reference("undefined") - { - // Nothing to do - } - - // Constructeur avec le pointeur sur le BatchManager associe et avec une reference - JobId::JobId(BatchManager * _p_bm, string ref) : _p_batchmanager(_p_bm), _reference(ref) - { - // Nothing to do - } - - // Destructeur - JobId::~JobId() - { - // Nothing to do - } - - // Operateur d'affectation entre objets - JobId & JobId::operator =(const JobId & jobid) - { - _p_batchmanager = jobid._p_batchmanager; - _reference = jobid._reference; - - return *this; - } - - // Constructeur par recopie - JobId::JobId(const JobId & jobid) : _p_batchmanager(jobid._p_batchmanager), _reference(jobid._reference) - { - // Nothing to do - } - - // Accesseur pour la reference interne - string JobId::getReference() const - { - return _reference; - } - - // Methode pour le controle du job : retire le job du gestionnaire - void JobId::deleteJob() const - { - assert(_p_batchmanager != 0); - _p_batchmanager->deleteJob(*this); - } - - // Methode pour le controle du job : suspend le job en file d'attente - void JobId::holdJob() const - { - assert(_p_batchmanager != 0); - _p_batchmanager->holdJob(*this); - } - - // Methode pour le controle du job : relache le job suspendu - void JobId::releaseJob() const - { - assert(_p_batchmanager != 0); - _p_batchmanager->releaseJob(*this); - } - - // Methode pour le controle du job : modifie le job en file d'attente - void JobId::alterJob(const Parametre & param, const Environnement & env) const - { - assert(_p_batchmanager != 0); - _p_batchmanager->alterJob(*this, param, env); - } - - // Methode pour le controle du job : modifie le job en file d'attente - void JobId::alterJob(const Parametre & param) const - { - assert(_p_batchmanager != 0); - _p_batchmanager->alterJob(*this, param); - } - - // Methode pour le controle du job : modifie le job en file d'attente - void JobId::alterJob(const Environnement & env) const - { - assert(_p_batchmanager != 0); - _p_batchmanager->alterJob(*this, env); - } - - // Methode pour le controle du job : renvoie l'etat du job - JobInfo JobId::queryJob() const - { - assert(_p_batchmanager != 0); - return _p_batchmanager->queryJob(*this); - } - - - // Methode pour l'interfacage avec Python (SWIG) : affichage en Python - string JobId::__str__() const { - //MEDMEM::STRING str; - ostringstream str; - str << ""; - return str.str(); - } - -} diff --git a/src/Batch/Batch_JobId.hxx b/src/Batch/Batch_JobId.hxx deleted file mode 100644 index efd26321d..000000000 --- a/src/Batch/Batch_JobId.hxx +++ /dev/null @@ -1,91 +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 -// -/* - * JobId.hxx : - * - * Auteur : Ivan DUTKA-MALEN - EDF R&D - * Date : Septembre 2003 - * Projet : SALOME 2 - * - */ - -#ifndef _JOBID_H_ -#define _JOBID_H_ - - -#include "Batch_Defines.hxx" - -#include "Batch_JobInfo.hxx" -#include "Batch_BatchManager.hxx" - -namespace Batch { - - class BatchManager; - - class BATCH_EXPORT JobId - { - friend class BatchManager; - - public: - // Constructeur standard et destructeur - JobId(); - virtual ~JobId(); - - // Constructeur avec le pointeur sur le BatchManager associe et avec une reference - JobId(Batch::BatchManager *, std::string ref); - - // Operateur d'affectation entre objets - virtual JobId & operator =(const Batch::JobId &); - - // Constructeur par recopie - JobId(const Batch::JobId &); - - // Accesseur pour la reference interne - virtual std::string getReference() const; - - // Methodes pour le controle du job - virtual void deleteJob() const; // retire un job du gestionnaire - virtual void holdJob() const; // suspend un job en file d'attente - virtual void releaseJob() const; // relache un job suspendu - virtual void alterJob(const Batch::Parametre & param, const Batch::Environnement & env) const; // modifie un job en file d'attente - virtual void alterJob(const Batch::Parametre & param) const; // modifie un job en file d'attente - virtual void alterJob(const Batch::Environnement & env) const; // modifie un job en file d'attente - virtual void setParametre(const Batch::Parametre & param) { return alterJob(param); } // modifie un job en file d'attente - virtual void setEnvironnement(const Batch::Environnement & env) { return alterJob(env); } // modifie un job en file d'attente - virtual Batch::JobInfo queryJob() const; // renvoie l'etat du job - - // Methodes pour l'interfacage avec Python (SWIG) - // TODO : supprimer ces methodes et transferer leur definitions dans SWIG - std::string __str__() const; // SWIG : affichage en Python - std::string __repr__() const { return __str__(); }; // SWIG : affichage en Python - - protected: - Batch::BatchManager * _p_batchmanager; // pointeur sur le BatchManager qui controle le job - std::string _reference; // reference du job au sein du BatchManager - - private: - - }; - -} - -#endif diff --git a/src/Batch/Batch_JobInfo.cxx b/src/Batch/Batch_JobInfo.cxx deleted file mode 100644 index 63c85024f..000000000 --- a/src/Batch/Batch_JobInfo.cxx +++ /dev/null @@ -1,96 +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 -// -/* - * JobInfo.cxx : - * - * Auteur : Ivan DUTKA-MALEN - EDF R&D - * Mail : mailto:ivan.dutka-malen@der.edf.fr - * Date : Thu Nov 6 10:05:30 2003 - * Projet : Salome 2 - * - */ - -#include -#include -#include -//#include "MEDMEM_STRING.hxx" -#include "Batch_JobInfo.hxx" - -using namespace std; - -namespace Batch { - - // Destructeur - JobInfo::~JobInfo() - { - // Nothing to do - } - - - // Operateur pour l'affichage sur un stream - ostream & operator <<(ostream & os, const JobInfo & ji) - { - return os << ji.__str__(); - } - - - // Methodes pour l'interfacage avec Python (SWIG) : affichage en Python - string JobInfo::__str__() const - { - //MEDMEM::STRING sst; - ostringstream sst; - sst << ""; - - return sst.str(); - } - - // Accesseur - Parametre JobInfo::getParametre() const - { - return _param; - } - - // Accesseur - Environnement JobInfo::getEnvironnement() const - { - return _env; - } - - -} diff --git a/src/Batch/Batch_JobInfo.hxx b/src/Batch/Batch_JobInfo.hxx deleted file mode 100644 index f4b54f115..000000000 --- a/src/Batch/Batch_JobInfo.hxx +++ /dev/null @@ -1,79 +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 -// -/* - * JobInfo.hxx : - * - * Auteur : Ivan DUTKA-MALEN - EDF R&D - * Mail : mailto:ivan.dutka-malen@der.edf.fr - * Date : Thu Nov 6 10:05:30 2003 - * Projet : Salome 2 - * - */ - -#ifndef _JOBINFO_H_ -#define _JOBINFO_H_ - -#include "Batch_Defines.hxx" - -#include -#include -#include "Batch_Parametre.hxx" -#include "Batch_Environnement.hxx" - -namespace Batch { - - class BATCH_EXPORT JobInfo - { - public: - // Constructeur standard et destructeur - JobInfo() : _param(), _env() {}; - virtual ~JobInfo(); - - // Constructeur par recopie - JobInfo(const JobInfo & jinfo) : _param(jinfo._param), _env(jinfo._env) {}; - - // Operateur pour l'affichage sur un stream - friend std::ostream & operator <<(std::ostream & os, const JobInfo & ji); - - // Accesseurs - // _CS_gbo Ajout explicite du namespace pour les besoins de swig (mauvaise gestion - // des namespace par swig. - virtual Batch::Parametre getParametre() const; - virtual Batch::Environnement getEnvironnement() const; - - // Methodes pour l'interfacage avec Python (SWIG) - // TODO : supprimer ces methodes et transferer leur definitions dans SWIG - std::string __str__() const; // SWIG : affichage en Python - std::string __repr__() const { return __str__(); }; // SWIG : affichage en Python - - protected: - Parametre _param; // parametres du job - Environnement _env; // variables d'environnement du job - JobInfo(const Parametre & param, const Environnement & env) : _param(param), _env(env) {}; - - private: - - }; - -} - -#endif diff --git a/src/Batch/Batch_JobInfo_LSF.cxx b/src/Batch/Batch_JobInfo_LSF.cxx deleted file mode 100644 index b964aba9b..000000000 --- a/src/Batch/Batch_JobInfo_LSF.cxx +++ /dev/null @@ -1,204 +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 -// -/* - * JobInfo_LSF.cxx : - * - * Auteur : Ivan DUTKA-MALEN - EDF R&D - * Mail : mailto:ivan.dutka-malen@der.edf.fr - * Date : Fri Nov 21 09:42:06 2003 - * Projet : Salome 2 - * - */ - -#include -#include -#include -#include "Batch_Parametre.hxx" -#include "Batch_Environnement.hxx" -#include "Batch_RunTimeException.hxx" -#include "Batch_APIInternalFailureException.hxx" -#include "Batch_JobInfo_LSF.hxx" - -using namespace std; - -namespace Batch { - - - - // Constructeurs - JobInfo_LSF::JobInfo_LSF(int id) : JobInfo() - { - struct loadIndexLog * p_ld = new struct loadIndexLog; - struct jobInfoHead * p_jInfoHead = lsb_openjobinfo_a(id, NULL, NULL, NULL, NULL, ALL_JOB); - - int more = p_jInfoHead->numJobs; - if (more != 1) { - char * msg = lsb_sysmsg(); - if (!msg) msg = "unknown"; - throw APIInternalFailureException(string("LSF lsb_openjobinfo error. Reason : ") + msg); - } - - // on remplit une structure contenant elements - struct jobInfoEnt & jobInfo = * lsb_readjobinfo(&more); - - - // On remplit les membres _param et _env - _param[ACCOUNT] = jobInfo.submit.projectName; - _param[CHECKPOINT] = jobInfo.submit.chkpntPeriod != 0; - _param[CKPTINTERVAL] = jobInfo.submit.chkpntPeriod; - _param[CREATIONTIME] = jobInfo.submitTime; - // _param[EGROUP] = jobInfo.; - _param[ELIGIBLETIME] = jobInfo.reserveTime; - _param[ENDTIME] = jobInfo.endTime; - _param[EUSER] = jobInfo.execUsername; - _param[EXECUTABLE] = jobInfo.submit.command; - _param[EXITCODE] = jobInfo.exitStatus; - _param[HOLD] = jobInfo.status & (JOB_STAT_PSUSP | JOB_STAT_SSUSP | JOB_STAT_USUSP); - _param[MAIL] = jobInfo.submit.mailUser; - _param[MAXCPUTIME] = jobInfo.submit.rLimits[LSF_RLIMIT_CPU]; - _param[MAXDISKSIZE] = jobInfo.submit.rLimits[LSF_RLIMIT_FSIZE]; - _param[MAXRAMSIZE] = jobInfo.submit.rLimits[LSF_RLIMIT_SWAP]; - _param[MAXWALLTIME] = jobInfo.submit.rLimits[LSF_RLIMIT_RUN]; - _param[MODIFICATIONTIME] = jobInfo.lastEvent; - _param[NAME] = jobInfo.jName; - _param[NBPROC] = jobInfo.submit.numProcessors; - _param[PID] = jobInfo.jobPid; - _param[QUEUE] = jobInfo.submit.queue; - _param[QUEUEDTIME] = jobInfo.submitTime; - // _param[SERVER] = jobInfo.; - _param[STARTTIME] = jobInfo.startTime; - _param[TEXT] = jobInfo.numReasons ? lsb_pendreason(jobInfo.numReasons, - jobInfo.reasonTb, - p_jInfoHead, - p_ld,0) : ""; - // _param[TMPDIR] = jobInfo.; - _param[USEDCPUTIME] = static_cast(jobInfo.cpuTime); - // _param[USEDDISKSIZE] = jobInfo.; - _param[USEDRAMSIZE] = jobInfo.runRusage.mem; - _param[USEDWALLTIME] = jobInfo.duration * 60L; - _param[USER] = jobInfo.user; - - - ostringstream oss; - int jobid = jobInfo.jobId; - oss << jobid; - _param[ID] = oss.str(); - - - string hosts, sep; - for(int i=0; i < jobInfo.numExHosts; i++, sep="+") { - hosts += jobInfo.exHosts[i]; - hosts += sep; - } - _param[EXECUTIONHOST] = hosts; - - ostringstream status; - - if (IS_PEND(jobInfo.status)) - status << " Job is pending;"; - if (IS_START(jobInfo.status)) - status << " Job is started;"; - if (IS_FINISH(jobInfo.status)) - status << " Job is finished;"; - if (IS_SUSP(jobInfo.status)) - status << " Job is suspended;"; - if (IS_POST_DONE(jobInfo.status)) - status << " Job is post-done;"; - if (IS_POST_ERR(jobInfo.status)) - status << " Job is post-error;"; - - _param[STATE] = status.str(); - _running = IS_FINISH(jobInfo.status) ? false : true; - - - if (strlen(jobInfo.submit.inFile)) - _param[INFILE] += Couple(jobInfo.submit.inFile, "stdin"); - if (strlen(jobInfo.submit.outFile)) - _param[OUTFILE] += Couple(jobInfo.submit.outFile, "stdout"); - if (strlen(jobInfo.submit.errFile)) - _param[OUTFILE] += Couple(jobInfo.submit.errFile, "stderr"); - - for(int i=0; i < jobInfo.submit.nxf; i++) { - switch (jobInfo.submit.xf[i].options) { - case XF_OP_SUB2EXEC: - _param[INFILE] += Couple(jobInfo.submit.xf[i].subFn, jobInfo.submit.xf[i].execFn); - break; - - case XF_OP_EXEC2SUB: - _param[OUTFILE] += Couple(jobInfo.submit.xf[i].subFn, jobInfo.submit.xf[i].execFn); - break; - - default: - break; - } - } - - - lsb_closejobinfo(); - delete p_ld; - } - - - - // Teste si un job est present en machine - bool JobInfo_LSF::isRunning() const - { - return _running; - } - - - // Destructeur - JobInfo_LSF::~JobInfo_LSF() - { - // Nothing to do - } - - - - // Convertit une date HH:MM:SS en secondes - long JobInfo_LSF::HMStoLong(const string & s) - { - long hour, min, sec; - - sscanf( s.c_str(), "%ld:%ld:%ld", &hour, &min, &sec); - return ( ( ( hour * 60L ) + min ) * 60L ) + sec; - } - - // Methode pour l'interfacage avec Python (SWIG) : affichage en Python - string JobInfo_LSF::__str__() const - { - ostringstream sst; - sst << " -#include -} -#include -#include "Batch_RunTimeException.hxx" -#include "Batch_JobInfo.hxx" - -namespace Batch { - - class JobInfo_LSF : public JobInfo - { - public: - // Constructeurs et destructeur - JobInfo_LSF() : _running(false) {}; - JobInfo_LSF(int id); - virtual ~JobInfo_LSF(); - - // Constructeur par recopie - JobInfo_LSF(const JobInfo_LSF & jinfo) : JobInfo(jinfo) {}; - - // Teste si un job est present en machine - virtual bool isRunning() const; - - // Methodes pour l'interfacage avec Python (SWIG) - // TODO : supprimer ces methodes et transferer leur definitions dans SWIG - std::string __str__() const; // SWIG : affichage en Python - std::string __repr__() const { return __str__(); }; // SWIG : affichage en Python - - protected: - bool _running; // etat du job en machine - - private: - // Convertit une date HH:MM:SS en secondes - long HMStoLong(const std::string &); - - }; - -} - -#endif diff --git a/src/Batch/Batch_JobInfo_Local.cxx b/src/Batch/Batch_JobInfo_Local.cxx deleted file mode 100644 index da7a32ca4..000000000 --- a/src/Batch/Batch_JobInfo_Local.cxx +++ /dev/null @@ -1,54 +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 -// -/* - * JobInfo_Local.cxx : - * - * Auteur : Ivan DUTKA-MALEN - EDF R&D - * Mail : mailto:ivan.dutka-malen@der.edf.fr - * Date : Fri Nov 21 09:42:06 2003 - * Projet : Salome 2 - * - */ - -#include -#include "Batch_Parametre.hxx" -#include "Batch_Environnement.hxx" -#include "Batch_JobInfo_Local.hxx" - -namespace Batch { - - // Constructeurs - JobInfo_Local::JobInfo_Local(const Parametre & param, const Environnement & env) : - JobInfo(param, env) - { - // Nothing to do - } - - - // Destructeur - JobInfo_Local::~JobInfo_Local() - { - // Nothing to do - } - - -} diff --git a/src/Batch/Batch_JobInfo_Local.hxx b/src/Batch/Batch_JobInfo_Local.hxx deleted file mode 100644 index ed325b4e8..000000000 --- a/src/Batch/Batch_JobInfo_Local.hxx +++ /dev/null @@ -1,60 +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 -// -/* - * JobInfo_Local.hxx : - * - * Auteur : Ivan DUTKA-MALEN - EDF R&D - * Mail : mailto:ivan.dutka-malen@der.edf.fr - * Date : Fri Nov 21 09:42:05 2003 - * Projet : Salome 2 - * - */ - -#ifndef _JOBINFO_LOCAL_H_ -#define _JOBINFO_LOCAL_H_ - -#include -#include "Batch_JobInfo.hxx" - -namespace Batch { - - class JobInfo_Local : public JobInfo - { - public: - // Constructeurs et destructeur - JobInfo_Local() {}; - JobInfo_Local(const Parametre & param, const Environnement & env); - virtual ~JobInfo_Local(); - - // Constructeur par recopie - JobInfo_Local(const JobInfo_Local & jinfo) : JobInfo(jinfo) {}; - - - protected: - - private: - - }; - -} - -#endif diff --git a/src/Batch/Batch_JobInfo_PBS.cxx b/src/Batch/Batch_JobInfo_PBS.cxx deleted file mode 100644 index 3a474fc69..000000000 --- a/src/Batch/Batch_JobInfo_PBS.cxx +++ /dev/null @@ -1,198 +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 -// -/* - * JobInfo_PBS.cxx : - * - * Auteur : Ivan DUTKA-MALEN - EDF R&D - * Mail : mailto:ivan.dutka-malen@der.edf.fr - * Date : Fri Nov 21 09:42:06 2003 - * Projet : Salome 2 - * - */ - -#include -#include -//#include "MEDMEM_STRING.hxx" -#include "Batch_Parametre.hxx" -#include "Batch_Environnement.hxx" -#include "Batch_RunTimeException.hxx" -#include "Batch_JobInfo_PBS.hxx" -using namespace std; - -namespace Batch { - - // Constructeurs - JobInfo_PBS::JobInfo_PBS(struct batch_status * list, bool tobedeleted) : JobInfo() - { - // On ne considere que le premier element de la liste - // Si tout est OK, la liste ne devrait contenir qu'un element - // Sinon on leve une exception. - struct batch_status * p_job = list; - int i; - for(i=0; p_job; p_job = p_job->next) i++; - if (i == 0) throw RunTimeException("Liste vide (le job est absent de la file)"); - if (i > 1) { - //MEDMEM::STRING sst; - ostringstream sst; - sst << "JobInfo_PBS::JobInfo_PBS(struct batch_status * list, bool tobedeleted) : la liste contient " - << i << " elements" << " (1 seul requis)" << endl; - throw RunTimeException(sst.str()); - } - p_job = list; - - // On remplit les membres _param et _env - - if (p_job->name && strlen(p_job->name)) _param[ID] = p_job->name; - if (p_job->text && strlen(p_job->text)) _param[TEXT] = p_job->text; - - for(struct attrl * p_attr = p_job->attribs; p_attr; p_attr = p_attr->next) { - - string name, res, value; - if (p_attr->name && strlen(p_attr->name)) name = p_attr->name; - if (p_attr->resource && strlen(p_attr->resource)) res = p_attr->resource; - if (p_attr->value && strlen(p_attr->value)) value = p_attr->value; - - if (name == ATTR_N) { - _param[NAME] = value; - - } else if (name == ATTR_owner) { - _param[USER] = value; - - } else if (name == ATTR_state) { - _param[STATE] = value; - - } else if (name == ATTR_queue) { - _param[QUEUE] = value; - - } else if (name == ATTR_A) { - _param[ACCOUNT] = value; - - } else if (name == ATTR_M) { - _param[MAIL] = value; - - } else if (name == ATTR_c) { - if (!strcmp(value.c_str(), CHECKPOINT_UNSPECIFIED)) _param[CHECKPOINT] = 1L; - else _param[CHECKPOINT] = 0L; - - } else if (name == ATTR_h) { - if (!strcmp(value.c_str(), NO_HOLD)) _param[HOLD] = 0L; - else _param[HOLD] = 1L; - - } else if (name == ATTR_ctime) { - _param[CREATIONTIME] = atol(value.c_str()); - - } else if (name == ATTR_etime) { - _param[ELIGIBLETIME] = atol(value.c_str()); - - } else if (name == ATTR_mtime) { - _param[MODIFICATIONTIME] = atol(value.c_str()); - - } else if (name == ATTR_qtime) { - _param[QUEUEDTIME] = atol(value.c_str()); - - } else if (name == ATTR_exechost) { - _param[EXECUTIONHOST] = value; - - } else if (name == ATTR_session) { - _param[PID] = atol(value.c_str()); - - } else if (name == ATTR_euser) { - _param[EUSER] = value; - - } else if (name == ATTR_egroup) { - _param[EGROUP] = value; - - } else if (name == ATTR_l) { - if (res == "cput") { - _param[MAXCPUTIME] = HMStoLong(value); - - } else if (res == "walltime") { - _param[MAXWALLTIME] = HMStoLong(value); - - } - - } else if (name == ATTR_used) { - if (res == "cput") { - _param[USEDCPUTIME] = HMStoLong(value); - - } else if (res == "walltime") { - _param[USEDWALLTIME] = HMStoLong(value); - - } - - } else if (name == ATTR_v) { - int deb = 0; - int pos = 0; - bool ok = true; - - while (ok) { - pos = value.find(",", deb); - string sub = value.substr(deb, pos-deb); - deb = pos + 1; - if (pos < 0) ok = false; - - int eq = sub.find("="); - _env[sub.substr(0, eq)] = sub.substr(eq+1); - } - - } - } - - - if (tobedeleted) pbs_statfree(list); - } - - // Destructeur - JobInfo_PBS::~JobInfo_PBS() - { - // Nothing to do - } - - // Convertit une date HH:MM:SS en secondes - long JobInfo_PBS::HMStoLong(const string & s) - { - long hour, min, sec; - - sscanf( s.c_str(), "%ld:%ld:%ld", &hour, &min, &sec); - return ( ( ( hour * 60L ) + min ) * 60L ) + sec; - } - - // Methode pour l'interfacage avec Python (SWIG) : affichage en Python - string JobInfo_PBS::__str__() const - { - //MEDMEM::STRING sst; - ostringstream sst; - sst << " -#include -} -#include -#include "Batch_RunTimeException.hxx" -#include "Batch_JobInfo.hxx" - -namespace Batch { - - class JobInfo_PBS : public JobInfo - { - public: - // Constructeurs et destructeur - JobInfo_PBS() : JobInfo() {}; - JobInfo_PBS(struct batch_status * stat_list, bool tobedeleted = false); - virtual ~JobInfo_PBS(); - - // Constructeur par recopie - JobInfo_PBS(const JobInfo_PBS & jinfo) : JobInfo(jinfo) {}; - - // Methodes pour l'interfacage avec Python (SWIG) - // TODO : supprimer ces methodes et transferer leur definitions dans SWIG - std::string __str__() const; // SWIG : affichage en Python - std::string __repr__() const { return __str__(); }; // SWIG : affichage en Python - - protected: - - private: - // Convertit une date HH:MM:SS en secondes - long HMStoLong(const std::string &); - - }; - -} - -#endif diff --git a/src/Batch/Batch_JobInfo_eLSF.cxx b/src/Batch/Batch_JobInfo_eLSF.cxx deleted file mode 100644 index 6f6f06312..000000000 --- a/src/Batch/Batch_JobInfo_eLSF.cxx +++ /dev/null @@ -1,107 +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 -// -/* - * JobInfo_eLSF.cxx : emulation of LSF client - * - * Auteur : Bernard SECHER - CEA DEN - * Mail : mailto:bernard.secher@cea.fr - * Date : Thu Apr 24 10:17:22 2008 - * Projet : PAL Salome - * - */ - -#include -#include -#include -#include -#include "Batch_Parametre.hxx" -#include "Batch_Environnement.hxx" -#include "Batch_RunTimeException.hxx" -#include "Batch_APIInternalFailureException.hxx" -#include "Batch_JobInfo_eLSF.hxx" - -using namespace std; - -namespace Batch { - - - - // Constructeurs - JobInfo_eLSF::JobInfo_eLSF(int id, string logFile) : JobInfo() - { - // On remplit les membres _param et _env - ostringstream oss; - oss << id; - _param[ID] = oss.str(); - - // read status of job in log file - char line[128]; - ifstream fp(logFile.c_str(),ios::in); - fp.getline(line,80,'\n'); - - string sjobid, username, status; - fp >> sjobid; - fp >> username; - fp >> status; - - _param[STATE] = status; - - if( status.find("RUN") != string::npos) - _running = true; - - } - - // Teste si un job est present en machine - bool JobInfo_eLSF::isRunning() const - { - return _running; - } - - - // Destructeur - JobInfo_eLSF::~JobInfo_eLSF() - { - // Nothing to do - } - - // Convertit une date HH:MM:SS en secondes - long JobInfo_eLSF::HMStoLong(const string & s) - { - long hour, min, sec; - - sscanf( s.c_str(), "%ld:%ld:%ld", &hour, &min, &sec); - return ( ( ( hour * 60L ) + min ) * 60L ) + sec; - } - - // Methode pour l'interfacage avec Python (SWIG) : affichage en Python - string JobInfo_eLSF::__str__() const - { - ostringstream sst; - sst << " - -namespace Batch { - - class JobInfo_eLSF : public JobInfo - { - public: - // Constructeurs et destructeur - JobInfo_eLSF() : _running(false) {}; - JobInfo_eLSF(int id,std::string logFile); - virtual ~JobInfo_eLSF(); - - // Constructeur par recopie - JobInfo_eLSF(const JobInfo_eLSF & jinfo) : JobInfo(jinfo) {}; - - // Teste si un job est present en machine - virtual bool isRunning() const; - - // Methodes pour l'interfacage avec Python (SWIG) - // TODO : supprimer ces methodes et transferer leur definitions dans SWIG - std::string __str__() const; // SWIG : affichage en Python - std::string __repr__() const { return __str__(); }; // SWIG : affichage en Python - - protected: - bool _running; // etat du job en machine - - private: - // Convertit une date HH:MM:SS en secondes - long HMStoLong(const std::string &); - - }; - -} - -#endif diff --git a/src/Batch/Batch_JobInfo_ePBS.cxx b/src/Batch/Batch_JobInfo_ePBS.cxx deleted file mode 100644 index b8cd1e888..000000000 --- a/src/Batch/Batch_JobInfo_ePBS.cxx +++ /dev/null @@ -1,118 +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 -// -/* - * JobInfo_ePBS.cxx : emulation of PBS client - * - * Auteur : Bernard SECHER - CEA DEN - * Mail : mailto:bernard.secher@cea.fr - * Date : Thu Apr 24 10:17:22 2008 - * Projet : PAL Salome - * - */ - -#include -#include -#include -#include -#include "Batch_Parametre.hxx" -#include "Batch_Environnement.hxx" -#include "Batch_RunTimeException.hxx" -#include "Batch_APIInternalFailureException.hxx" -#include "Batch_JobInfo_ePBS.hxx" - -using namespace std; - -namespace Batch { - - - - // Constructeurs - JobInfo_ePBS::JobInfo_ePBS(int id, string logFile) : JobInfo() - { - // On remplit les membres _param et _env - ostringstream oss; - oss << id; - _param[ID] = oss.str(); - - // read of log file - char line[128]; - ifstream fp(logFile.c_str(),ios::in); - - string status; - string sline; - int pos = string::npos; - while( (pos == string::npos) && fp.getline(line,80,'\n') ){ - sline = string(line); - pos = sline.find("job_state"); - }; - - if(pos!=string::npos){ - istringstream iss(sline); - iss >> status; - iss >> status; - iss >> status; - } - else - status = "U"; - - _param[STATE] = status; - - if( status.find("R") != string::npos) - _running = true; - - } - - // Teste si un job est present en machine - bool JobInfo_ePBS::isRunning() const - { - return _running; - } - - - // Destructeur - JobInfo_ePBS::~JobInfo_ePBS() - { - // Nothing to do - } - - // Convertit une date HH:MM:SS en secondes - long JobInfo_ePBS::HMStoLong(const string & s) - { - long hour, min, sec; - - sscanf( s.c_str(), "%ld:%ld:%ld", &hour, &min, &sec); - return ( ( ( hour * 60L ) + min ) * 60L ) + sec; - } - - // Methode pour l'interfacage avec Python (SWIG) : affichage en Python - string JobInfo_ePBS::__str__() const - { - ostringstream sst; - sst << " -#include -#include -#include -#include "Batch_Parametre.hxx" -#include "Batch_Environnement.hxx" -#include "Batch_RunTimeException.hxx" -#include "Batch_APIInternalFailureException.hxx" -#include "Batch_JobInfo_eSGE.hxx" - -using namespace std; - -namespace Batch { - - - - // Constructeurs - JobInfo_eSGE::JobInfo_eSGE(int id, string logFile) : JobInfo() - { - // On remplit les membres _param et _env - ostringstream oss; - oss << id; - _param[ID] = oss.str(); - - // read of log file - char line[128]; - ifstream fp(logFile.c_str(),ios::in); - - string status; - string sline; - fp.getline(line,80,'\n'); - sline = string(line); - - if( sline.length() > 0 ){ - istringstream iss(sline); - iss >> status >> status >> status >> status >> status; - } - else - status = "e"; - - _param[STATE] = status; - - if( status.find("r") != string::npos) - _running = true; - - } - - // Teste si un job est present en machine - bool JobInfo_eSGE::isRunning() const - { - return _running; - } - - - // Destructeur - JobInfo_eSGE::~JobInfo_eSGE() - { - // Nothing to do - } - - // Convertit une date HH:MM:SS en secondes - long JobInfo_eSGE::HMStoLong(const string & s) - { - long hour, min, sec; - - sscanf( s.c_str(), "%ld:%ld:%ld", &hour, &min, &sec); - return ( ( ( hour * 60L ) + min ) * 60L ) + sec; - } - - // Methode pour l'interfacage avec Python (SWIG) : affichage en Python - string JobInfo_eSGE::__str__() const - { - ostringstream sst; - sst << " -#include -#include -#include -#include -#include "Batch_Job_LSF.hxx" - -using namespace std; - -namespace Batch { - - - // Constructeur - Job_LSF::Job_LSF(const Job & job) : _p_submit(0) - { - Parametre P = job.getParametre(); - _p_submit = ParametreToSubmitStruct(P); - } - - - // Destructeur - Job_LSF::~Job_LSF() - { - if (_p_submit) { - if (_p_submit->jobName) delete [] _p_submit->jobName; - if (_p_submit->queue) delete [] _p_submit->queue; - if (_p_submit->askedHosts) { - delete [] *(_p_submit->askedHosts); - delete [] _p_submit->askedHosts; - } - if (_p_submit->resReq) delete [] _p_submit->resReq; - if (_p_submit->hostSpec) delete [] _p_submit->hostSpec; - if (_p_submit->dependCond) delete [] _p_submit->dependCond; - if (_p_submit->timeEvent) delete [] _p_submit->timeEvent; - if (_p_submit->inFile) delete [] _p_submit->inFile; - if (_p_submit->outFile) delete [] _p_submit->outFile; - if (_p_submit->errFile) delete [] _p_submit->errFile; - if (_p_submit->command) delete [] _p_submit->command; - if (_p_submit->newCommand) delete [] _p_submit->newCommand; - if (_p_submit->chkpntDir) delete [] _p_submit->chkpntDir; - if (_p_submit->xf) delete [] _p_submit->xf; - if (_p_submit->preExecCmd) delete [] _p_submit->preExecCmd; - if (_p_submit->mailUser) delete [] _p_submit->mailUser; - if (_p_submit->projectName) delete [] _p_submit->projectName; - if (_p_submit->loginShell) delete [] _p_submit->loginShell; - if (_p_submit->exceptList) delete [] _p_submit->exceptList; - delete _p_submit; - } - } - - - // Accesseur - struct submit * Job_LSF::getSubmitStruct() - { - return _p_submit; - } - - - char * Job_LSF::string2char(const string & s) - { - char * ch = new char [s.size() + 1]; - memset(ch, 0, s.size() + 1); - strncat(ch, s.c_str(), s.size()); - return ch; - } - - - struct submit * Job_LSF::ParametreToSubmitStruct(const Parametre & P) - { - if (! _p_submit) _p_submit = new struct submit; - - memset( (void *) _p_submit, 0, sizeof(struct submit)); - - struct submit & sub = * _p_submit; - sub.options = 0; - sub.options2 = 0; - - sub.beginTime = 0; // job can run as soon as possible (default) - sub.termTime = 0; // job can run as long as it wishes (default) - - sub.numProcessors = 1; // job can run on one single processor (default) - sub.maxNumProcessors = 1; // job can run on one single processor (default) - - for(int i = 0; i< LSF_RLIM_NLIMITS; i++) sub.rLimits[i] = DEFAULT_RLIMIT; - - typedef std::vector< struct xFile > XFTAB; - XFTAB xf_tab; - - string st_second; - for(Parametre::const_iterator it = P.begin(); it != P.end(); it++) { - if ( (*it).first == ACCOUNT ) { - sub.options |= SUB_PROJECT_NAME; - st_second = (*it).second.str(); - sub.projectName = string2char(st_second); - - } else if ( (*it).first == CHECKPOINT ) { - if (static_cast< long >((*it).second)) - sub.options |= SUB_CHKPNT_PERIOD; - else - sub.options &= ~ SUB_CHKPNT_PERIOD; - - } else if ( (*it).first == CKPTINTERVAL ) { - sub.chkpntPeriod = static_cast< long >((*it).second); - - } else if ( (*it).first == EXECUTABLE ) { - st_second = (*it).second.str(); - sub.command = string2char(st_second); - - } else if ( (*it).first == EXECUTIONHOST ) { - sub.options |= SUB_HOST; - if (! sub.numAskedHosts) { - sub.numAskedHosts = 1; - sub.askedHosts = new char* [1]; - } - st_second = (*it).second.str(); - sub.askedHosts[0] = string2char(st_second); - - } else if ( (*it).first == HOLD ) { - if (static_cast< long >((*it).second)) - sub.options2 |= SUB2_HOLD; - else - sub.options2 &= ~ SUB2_HOLD; - - } else if ( (*it).first == INFILE ) { - Versatile V = (*it).second; - Versatile::iterator Vit; - - for(Vit=V.begin(); Vit!=V.end(); Vit++) { - CoupleType cpt = *static_cast< CoupleType * >(*Vit); - Couple cp = cpt; - string local = cp.getLocal(); - string remote = cp.getRemote(); - - // ATTENTION : les notions de fichier "local" ou "remote" sont inverses de celle de PBS qui a un point de vue serveur et non pas utilisateur - if (remote == "stdin"){ - sub.options |= SUB_IN_FILE; - sub.inFile = string2char(local); - - } else { - struct xFile xf; - 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); - } - } - - } else if ( (*it).first == MAIL ) { - sub.options |= SUB_MAIL_USER; - st_second = (*it).second.str(); - sub.mailUser = string2char(st_second); - - } else if ( (*it).first == MAXCPUTIME ) { - sub.rLimits[LSF_RLIMIT_CPU] = static_cast< long >((*it).second); - - } else if ( (*it).first == MAXDISKSIZE ) { - sub.rLimits[LSF_RLIMIT_FSIZE] = static_cast< long >((*it).second); - - } else if ( (*it).first == MAXRAMSIZE ) { - sub.rLimits[LSF_RLIMIT_SWAP] = static_cast< long >((*it).second); - - } else if ( (*it).first == MAXWALLTIME ) { - sub.rLimits[LSF_RLIMIT_RUN] = static_cast< long >((*it).second); - - } else if ( (*it).first == NAME ) { - sub.options |= SUB_JOB_NAME; - st_second = (*it).second.str(); - sub.jobName = string2char(st_second); - - } else if ( (*it).first == NBPROC ) { - sub.numProcessors = static_cast< long >((*it).second); - sub.maxNumProcessors = static_cast< long >((*it).second); - - } else if ( (*it).first == OUTFILE ) { - Versatile V = (*it).second; - Versatile::iterator Vit; - - for(Vit=V.begin(); Vit!=V.end(); Vit++) { - CoupleType cpt = *static_cast< CoupleType * >(*Vit); - Couple cp = cpt; - string local = cp.getLocal(); - string remote = cp.getRemote(); - - // ATTENTION : les notions de fichier "local" ou "remote" sont inverses de celle de PBS qui a un point de vue serveur et non pas utilisateur - if (remote == "stdout"){ - sub.options |= SUB_OUT_FILE; - sub.outFile = string2char(local); - - } else if (remote == "stderr"){ - sub.options |= SUB_ERR_FILE; - sub.errFile = string2char(local); - - } else { - struct xFile xf; - 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); - } - } - - - } else if ( (*it).first == QUEUE ) { - sub.options |= SUB_QUEUE; - st_second = (*it).second.str(); - sub.queue = string2char(st_second); - - } else if ( (*it).first == STARTTIME ) { - sub.beginTime = static_cast< long >((*it).second); - - } else if ( (*it).first == TMPDIR ) { - // TODO - - } else if ( (*it).first == USER ) { - // TODO - - } - } - - - // Transfert de fichiers en entree et sortie - sub.options |= SUB_OTHER_FILES; - sub.nxf = xf_tab.size(); - sub.xf = new struct xFile [sub.nxf]; - int ixf = 0; - for(XFTAB::const_iterator it_xf=xf_tab.begin(); it_xf != xf_tab.end(); it_xf++, ixf++) - sub.xf[ixf] = *it_xf; // *it_xf == xf_tab[ixf] - - - return _p_submit; - } - -} diff --git a/src/Batch/Batch_Job_LSF.hxx b/src/Batch/Batch_Job_LSF.hxx deleted file mode 100644 index 8db076685..000000000 --- a/src/Batch/Batch_Job_LSF.hxx +++ /dev/null @@ -1,65 +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 -// -/* - * Job_LSF.hxx : - * - * Auteur : Ivan DUTKA-MALEN - EDF R&D - * Mail : mailto:ivan.dutka-malen@der.edf.fr - * Date : Fri Nov 14 11:00:39 2003 - * Projet : Salome 2 - * - */ - -#ifndef _JOB_LSF_H_ -#define _JOB_LSF_H_ - -extern "C" { - -#include -#include -} -#include -#include "Batch_Job.hxx" - -namespace Batch { - - class Job_LSF - { - public: - // Constructeur et destructeur - Job_LSF(const Job & job); - virtual ~Job_LSF(); - - // Accesseurs - struct submit * getSubmitStruct(); - - protected: - struct submit * _p_submit; // structure pour soumettre les jobs - - private: - struct submit * ParametreToSubmitStruct(const Parametre & P); - char * string2char(const std::string &); - }; - -} - -#endif diff --git a/src/Batch/Batch_Job_Local.cxx b/src/Batch/Batch_Job_Local.cxx deleted file mode 100644 index 3fa1062d1..000000000 --- a/src/Batch/Batch_Job_Local.cxx +++ /dev/null @@ -1,106 +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 -// -/* - * Job_Local.cxx : - * - * Auteur : Ivan DUTKA-MALEN - EDF R&D - * Mail : mailto:ivan.dutka-malen@der.edf.fr - * Date : Fri Nov 14 11:00:39 2003 - * Projet : Salome 2 - * - */ - -#include -#include -#ifndef WIN32 -#include -#endif -#include "Batch_Job_Local.hxx" - -using namespace std; - -namespace Batch { - - // Constructeur - Job_Local::Job_Local(const Job & job) : - _command(), _param(job.getParametre()), _env(job.getEnvironnement()) - { - // On positionne le nom du EXECUTIONHOST a "localhost" s'il n'est pas precise - if ( _param.find(EXECUTIONHOST) == _param.end() ) { - _param[EXECUTIONHOST] = "localhost"; - } - - // On convertit les objets Parametre et Environnement en liste chainee d'attributs + operateur - addEnvironnement( _env ); - addParametre ( _param ); - - } - - - // Destructeur - Job_Local::~Job_Local() - { - } - - - void Job_Local::addParametre(const Parametre & P) - { - // En dernier, on ajoute le chemin complet de la commande - _command += P[EXECUTABLE].str(); - } - - - void Job_Local::addEnvironnement(const Environnement & E) - { - for(Environnement::const_iterator it=E.begin(); it != E.end(); it++) { - string variable = (*it).first; - string value = (*it).second; - - // On remplace toutes les occurences de single-quote par backslash-single-quote - for(int pos=0; pos < value.size(); pos++) { - pos = value.find("'", pos); - if ( (pos < 0) || (pos > value.size()) ) break; - value.replace(pos, 1, "\'"); - } - _command += variable + "='" + value + "' "; - } - } - - string Job_Local::getCommand(void) const { - return _command; - } - - - // Retourne l'objet Parametre - Parametre Job_Local::getParametre() const - { - return _param; - } - - // Retourne l'objet Environnement - Environnement Job_Local::getEnvironnement() const - { - return _env; - } - - -} diff --git a/src/Batch/Batch_Job_Local.hxx b/src/Batch/Batch_Job_Local.hxx deleted file mode 100644 index 30e8ffde8..000000000 --- a/src/Batch/Batch_Job_Local.hxx +++ /dev/null @@ -1,71 +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 -// -/* - * Job_Local.hxx : - * - * Auteur : Ivan DUTKA-MALEN - EDF R&D - * Mail : mailto:ivan.dutka-malen@der.edf.fr - * Date : Fri Nov 14 11:00:39 2003 - * Projet : Salome 2 - * - */ - -#ifndef _JOB_LOCAL_H_ -#define _JOB_LOCAL_H_ - -#include "Batch_Parametre.hxx" -#include "Batch_Environnement.hxx" -#include "Batch_Job.hxx" - -namespace Batch { - - class Job_Local - { - public: - // Constructeur et destructeur - Job_Local(const Job & job); - virtual ~Job_Local(); - - // Retourne la commande _command - virtual std::string getCommand(void) const; - - // Retourne l'objet Parametre - virtual Parametre getParametre() const; - - // Retourne l'objet Environnement - virtual Environnement getEnvironnement() const; - - - protected: - std::string _command; - Parametre _param; - Environnement _env; - - private: - void addParametre(const Parametre & P); - void addEnvironnement(const Environnement & E); - - }; - -} - -#endif diff --git a/src/Batch/Batch_Job_PBS.cxx b/src/Batch/Batch_Job_PBS.cxx deleted file mode 100644 index cb4369731..000000000 --- a/src/Batch/Batch_Job_PBS.cxx +++ /dev/null @@ -1,472 +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 -// -/* - * Job_PBS.cxx : - * - * Auteur : Ivan DUTKA-MALEN - EDF R&D - * Mail : mailto:ivan.dutka-malen@der.edf.fr - * Date : Fri Nov 14 11:00:39 2003 - * Projet : Salome 2 - * - */ - -#include -#include -#include -#include "Batch_Job_PBS.hxx" -using namespace std; - -namespace Batch { - - // Ajoute un element (name,resource,value) a la liste chainee d'attributs + operateur - void Job_PBS::setResourceAttributeOP(struct attropl ** attr_list, const char * attr_name, const char * attr_resource, const char * attr_value) - { - // L'element (name,resource,value) existe-t-il deja ? si oui ptr != 0 - struct attropl * ptr = findResourceAttributeOP(*attr_list, attr_name, attr_resource); - - if (!ptr) { // L'element n'existe pas, il faut le creer - if (ptr = lastAttributeOP(*attr_list)) { // la liste n'est pas vide - ptr->next = new struct attropl; - ptr = ptr->next; - ptr->next = 0; - - } else { // la liste est completement vide - ptr = *attr_list = new struct attropl; - ptr->next = 0; - } - - // On remplit les champs (name,resource,value) - ptr->name = new char[strlen(attr_name) + 1]; - strncpy(ptr->name, attr_name, strlen(attr_name)); - ptr->name[strlen(attr_name)] = 0; - - ptr->resource = new char[strlen(attr_resource) + 1]; - strncpy(ptr->resource, attr_resource, strlen(attr_resource)); - ptr->resource[strlen(attr_resource)] = 0; - - ptr->value = new char[strlen(attr_value) + 1]; - strncpy(ptr->value, attr_value, strlen(attr_value)); - ptr->value[strlen(attr_value)] = 0; - - } else { // L'attribut existe, on change sa valeur - delete[] ptr->value; // On efface la valeur precedente - ptr->value = new char[strlen(attr_value) + 1]; - strncpy(ptr->value, attr_value, strlen(attr_value)); - ptr->value[strlen(attr_value)] = 0; - - } - } - - - // Recherche un element (name,resource,value) dans la liste chainee d'attributs + operateur - struct attropl * Job_PBS::findResourceAttributeOP(struct attropl * attr_list, const char * attr_name, const char * attr_resource) - { - // On parcoure la liste chainee pour trouver l'element dont les champs name et resource coincident - struct attropl * ptr = attr_list; - while (ptr) { - if (!strcmp(ptr->name, attr_name) && !strcmp(ptr->resource, attr_resource)) break; - ptr = ptr->next; - } - return ptr; - } - - - // Recherche le dernier element de la liste chainee d'attributs + operateur - struct attropl * Job_PBS::lastAttributeOP(struct attropl * attr_list) - { - struct attropl * ptr = attr_list; - while (ptr && ptr->next) { - ptr = ptr->next; - } - return ptr; - } - - - // Convertit un objet Parametre en liste chainee d'attributs + operateur - struct attropl * Job_PBS::ParametreToAttributeOPList(struct attropl ** _p_attr_list, Parametre & P) - { - Parametre::iterator it; - string st_second; - for(it=P.begin(); it!=P.end(); it++) { - if ( (*it).first == ACCOUNT ) { - st_second = (*it).second.str(); - setResourceAttributeOP(_p_attr_list, ATTR_A, "", st_second.c_str()); - - - } else if ( (*it).first == CHECKPOINT ) { - setResourceAttributeOP(_p_attr_list, ATTR_c, "", "u"); - - - } else if ( (*it).first == CKPTINTERVAL ) { - // Not significant - - } else if ( (*it).first == EXECUTABLE ) { - // Already done - - } else if ( (*it).first == HOLD ) { - if (static_cast< long >((*it).second)) - setResourceAttributeOP(_p_attr_list, ATTR_h, "", USER_HOLD); - else - setResourceAttributeOP(_p_attr_list, ATTR_h, "", NO_HOLD); - - } else if ( (*it).first == INFILE ) { - Versatile V = (*it).second; - Versatile::iterator Vit; - - string sep = ""; - string stagein; - - for(Vit=V.begin(); Vit!=V.end(); Vit++, sep=",") { - CoupleType cpt = *static_cast< CoupleType * >(*Vit); - Couple cp = cpt; - string local = cp.getLocal(); - string remote = cp.getRemote(); - - // ATTENTION : les notions de fichier "local" ou "remote" sont inverses de celle de PBS qui a un point de vue serveur et non pas utilisateur - stagein += sep + remote + "@" + local; - } - - if (stagein.size()) - setResourceAttributeOP(_p_attr_list, ATTR_stagein, "", stagein.c_str()); - - - } else if ( (*it).first == MAIL ) { - st_second = (*it).second.str(); - setResourceAttributeOP(_p_attr_list, ATTR_M, "", st_second.c_str()); - - } else if ( (*it).first == MAXCPUTIME ) { - char attr_value[32]; - long secondes = (*it).second; - long heures = secondes / 3600L; - long minutes = (secondes - 3600L * heures) / 60L; - secondes = secondes % 60L; - sprintf(attr_value, "%02ld:%02ld:%02ld", heures, minutes, secondes); - - setResourceAttributeOP(_p_attr_list, ATTR_l, "cput", attr_value); - - - } else if ( (*it).first == MAXDISKSIZE ) { - - } else if ( (*it).first == MAXRAMSIZE ) { - - } else if ( (*it).first == MAXWALLTIME ) { - char attr_value[32]; - long secondes = (*it).second; - long heures = secondes / 3600L; - long minutes = (secondes - 3600L * heures) / 60L; - secondes = secondes % 60L; - sprintf(attr_value, "%02ld:%02ld:%02ld", heures, minutes, secondes); - - setResourceAttributeOP(_p_attr_list, ATTR_l, "walltime", attr_value); - - - } else if ( (*it).first == NAME ) { - st_second = (*it).second.str(); - setResourceAttributeOP(_p_attr_list, ATTR_N, "", st_second.c_str()); - - - } else if ( (*it).first == OUTFILE ) { - Versatile V = (*it).second; - Versatile::iterator Vit; - - string sep = ""; - string stageout; - - for(Vit=V.begin(); Vit!=V.end(); Vit++, sep=",") { - CoupleType cpt = *static_cast< CoupleType * >(*Vit); - Couple cp = cpt; - string local = cp.getLocal(); - string remote = cp.getRemote(); - - if (remote == "stdout") - setResourceAttributeOP(_p_attr_list, ATTR_o, "", local.c_str()); - - else if (remote == "stderr") - setResourceAttributeOP(_p_attr_list, ATTR_e, "", local.c_str()); - - else - // ATTENTION : les notions de fichier "local" ou "remote" sont inverses de celle de PBS qui a un point de vue serveur et non pas utilisateur - stageout += sep + remote + "@" + local; - } - - if (stageout.size()) - setResourceAttributeOP(_p_attr_list, ATTR_stageout, "", stageout.c_str()); - - } else if ( (*it).first == QUEUE ) { - // Already done - - } else if ( (*it).first == STARTTIME ) { - - } else if ( (*it).first == TMPDIR ) { - - } else if ( (*it).first == USER ) { - st_second = (*it).second.str(); - setResourceAttributeOP(_p_attr_list, ATTR_u, "", st_second.c_str()); - - } - } - return *_p_attr_list; - } - - - // Convertit un objet Environnement en liste chainee d'attributs + operateur - struct attropl * Job_PBS::EnvironnementToAttributeOPList(struct attropl ** _p_attr_list, Environnement & E) - { - Environnement::iterator it; - for(it=E.begin(); it!=E.end(); it++) { - setResourceAttributeOP(_p_attr_list, ATTR_v, (*it).first.c_str(), ( (*it).first + "=" + (*it).second ).c_str()); - } - return *_p_attr_list; - } - - - // Ajoute les variables d'environnement presentes dans tout job PBS - void Job_PBS::addPBSEnvironnement(Environnement & E) - { - char * c; - - c = getenv("HOME"); - if (c) E["PBS_O_HOME"] = c; - - c = getenv("LANG"); - if (c) E["PBS_O_LANG"] = c; - - c = getenv("LOGNAME"); - if (c) E["PBS_O_LOGNAME"] = c; - - c = getenv("PATH"); - if (c) E["PBS_O_PATH"] = c; - - c = getenv("LD_LIBRARY_PATH"); - if (c) E["PBS_O_LD_LIBRARY_PATH"] = c; - - c = getenv("MAIL"); - if (c) E["PBS_O_MAIL"] = c; - - c = getenv("SHELL"); - if (c) E["PBS_O_SHELL"] = c; - - c = getenv("TZ"); - if (c) E["PBS_O_TZ"] = c; - - /* Recuperation du working directory */ - size_t size = 256; - char * buf = 0; - char * rc = 0; - do { - if (buf) delete[] buf; - buf = new char[size]; - rc = getcwd(buf, size); - size += size; - } while (!rc); - E["PBS_O_WORKDIR"] = buf; - delete[] buf; - } - - - // Ajoute un element (name,resource,value) a la liste chainee d'attributs - void Job_PBS::setResourceAttribute(struct attrl ** attr_list, const char * attr_name, const char * attr_resource, const char * attr_value) - { - // L'element (name,resource,value) existe-t-il deja ? si oui ptr != 0 - struct attrl * ptr = findResourceAttribute(*attr_list, attr_name, attr_resource); - - if (!ptr) { // L'attribut n'existe pas, il faut le creer - if (ptr = lastAttribute(*attr_list)) { // la liste n'est pas vide - ptr->next = new struct attrl; - ptr = ptr->next; - ptr->next = 0; - - } else { // la liste est completement vide - ptr = *attr_list = new struct attrl; - ptr->next = 0; - } - - // On remplit les champs (name,resource,value) - ptr->name = new char[strlen(attr_name) + 1]; - strncpy(ptr->name, attr_name, strlen(attr_name)); - ptr->name[strlen(attr_name)] = 0; - - ptr->resource = new char[strlen(attr_resource) + 1]; - strncpy(ptr->resource, attr_resource, strlen(attr_resource)); - ptr->resource[strlen(attr_resource)] = 0; - - ptr->value = new char[strlen(attr_value) + 1]; - strncpy(ptr->value, attr_value, strlen(attr_value)); - ptr->value[strlen(attr_value)] = 0; - - } else { // L'attribut existe, on change sa valeur - delete[] ptr->value; // On efface la valeur precedente - ptr->value = new char[strlen(attr_value) + 1]; - strncpy(ptr->value, attr_value, strlen(attr_value)); - ptr->value[strlen(attr_value)] = 0; - - } - } - - // Recherche un element (name,resource,value) dans la liste chainee d'attributs - struct attrl * Job_PBS::findResourceAttribute(struct attrl * attr_list, const char * attr_name, const char * attr_resource) - { - // On parcoure la liste chainee pour trouver l'element dont les champs name et resource coincident - struct attrl * ptr = attr_list; - while (ptr) { - if (!strcmp(ptr->name, attr_name) && !strcmp(ptr->resource, attr_resource)) break; - ptr = ptr->next; - } - return ptr; - } - - - // Recherche le dernier element de la liste chainee d'attributs - struct attrl * Job_PBS::lastAttribute(struct attrl * attr_list) - { - struct attrl * ptr = attr_list; - while (ptr && ptr->next) { - ptr = ptr->next; - } - return ptr; - } - - - // Constructeur - Job_PBS::Job_PBS(const Job & job) : _p_attropl(0), _p_attrl(0), _script(0), _destination(0) - { - Parametre P = job.getParametre(); - Parametre::iterator it; - - // On extrait de l'objet Parametre le champ EXECUTABLE qui deviendra le script PBS - if ( (it=P.find(EXECUTABLE)) != P.end()) { - Versatile V = (*it).second; - string st_exe = V.str(); - const char * exe = st_exe.c_str(); - int lg = strlen(exe); - _script = new char[lg + 1]; - for (int ii=0; iinext; - delete[] current_p_attropl->name; - delete[] current_p_attropl->resource; - delete[] current_p_attropl->value; - delete current_p_attropl; - current_p_attropl = next; - } - - // On detruit la liste chainee d'attributs - struct attrl * current_p_attrl = _p_attrl; - while (current_p_attrl) { - struct attrl * next = current_p_attrl->next; - delete[] current_p_attrl->name; - delete[] current_p_attrl->resource; - delete[] current_p_attrl->value; - delete current_p_attrl; - current_p_attrl = next; - } - - // On detruit les champs alloues - delete[] _script; - delete[] _destination; - } - - - // Accesseur - struct attropl * Job_PBS::getAttributesOP() - { - return _p_attropl; - } - - // Accesseur - // Cette methode sert pour les pbs_alter de PBS - // Pbs_alter est buggé par rapport a la specification ers_all.ps car les - // variables d'environnement ne sont pas supportees (ATTR_v) - struct attrl * Job_PBS::getAttributes() - { - if (_p_attrl == 0) { - - // On remplit la structure attrl a partir de la strucuture attropl - // (elles ne different que par le parametre op, mais elles ne sont pas interchangeables - // dans les appels) - - struct attropl * current_p_attropl = _p_attropl; - while (current_p_attropl) { - if (strcmp(current_p_attropl->name, ATTR_v)) // Bug fix for ATTR_v - setResourceAttribute(&_p_attrl, - current_p_attropl->name, - current_p_attropl->resource, - current_p_attropl->value); - - current_p_attropl = current_p_attropl->next; - } - - } - - return _p_attrl; - } - - // Accesseur - char * Job_PBS::getScript() - { - return _script; - } - - // Accesseur - char * Job_PBS::getDestination() - { - return _destination; - } - -} diff --git a/src/Batch/Batch_Job_PBS.hxx b/src/Batch/Batch_Job_PBS.hxx deleted file mode 100644 index 8124f1c61..000000000 --- a/src/Batch/Batch_Job_PBS.hxx +++ /dev/null @@ -1,96 +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 -// -/* - * Job_PBS.hxx : - * - * Auteur : Ivan DUTKA-MALEN - EDF R&D - * Mail : mailto:ivan.dutka-malen@der.edf.fr - * Date : Fri Nov 14 11:00:39 2003 - * Projet : Salome 2 - * - */ - -#ifndef _JOB_PBS_H_ -#define _JOB_PBS_H_ - -extern "C" { - -#include -#include -} -#include "Batch_Job.hxx" - -namespace Batch { - - class Job_PBS - { - public: - // Constructeur et destructeur - Job_PBS(const Job & job); - virtual ~Job_PBS(); - - // Accesseurs - struct attropl * getAttributesOP(); - struct attrl * getAttributes(); - char * getScript(); - char * getDestination(); - - protected: - struct attropl * _p_attropl; // liste chainee d'attributs + operateur - struct attrl * _p_attrl; // liste chainee d'attributs - char * _script; // chemin d'acces au script du job - char * _destination; // queue dans laquelle le job est soumis - - private: - // Ajoute un element (name,resource,value) a la liste chainee d'attributs + operateur - void setResourceAttributeOP(struct attropl ** attr_list, const char * attr_name, const char * attr_resource, const char * attr_value); - - // Recherche un element (name,resource,value) dans la liste chainee d'attributs + operateur - struct attropl * findResourceAttributeOP(struct attropl * attr_list, const char * attr_name, const char * attr_resource); - - // Recherche le dernier element de la liste chainee d'attributs + operateur - struct attropl * lastAttributeOP(struct attropl * attr_list); - - // Convertit un objet Parametre en liste chainee d'attributs + operateur - struct attropl * ParametreToAttributeOPList(struct attropl ** _p_attr_list, Parametre & param); - - // Convertit un objet Environnement en liste chainee d'attributs + operateur - struct attropl * EnvironnementToAttributeOPList(struct attropl ** _p_attr_list, Environnement & env); - - // Ajoute les variables d'environnement presentes dans tout job PBS - void addPBSEnvironnement(Environnement & E); - - - // Ajoute un element (name,resource,value) a la liste chainee d'attributs - void setResourceAttribute(struct attrl ** attr_list, const char * attr_name, const char * attr_resource, const char * attr_value); - - // Recherche un element (name,resource,value) dans la liste chainee d'attributs - struct attrl * findResourceAttribute(struct attrl * attr_list, const char * attr_name, const char * attr_resource); - - // Recherche le dernier element de la liste chainee d'attributs - struct attrl * lastAttribute(struct attrl * attr_list); - - }; - -} - -#endif diff --git a/src/Batch/Batch_ListIsFullException.cxx b/src/Batch/Batch_ListIsFullException.cxx deleted file mode 100644 index 1da8c0e6d..000000000 --- a/src/Batch/Batch_ListIsFullException.cxx +++ /dev/null @@ -1,37 +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 -// -/* - * ListIsFullException.cxx : - * - * Auteur : Ivan DUTKA-MALEN - EDF R&D - * Date : Septembre 2003 - * Projet : SALOME 2 - * - */ - -#include "Batch_ListIsFullException.hxx" -using namespace std; - - -namespace Batch { - -} diff --git a/src/Batch/Batch_ListIsFullException.hxx b/src/Batch/Batch_ListIsFullException.hxx deleted file mode 100644 index bfb7ff88d..000000000 --- a/src/Batch/Batch_ListIsFullException.hxx +++ /dev/null @@ -1,50 +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 -// -/* - * ListIsFullException.hxx : - * - * Auteur : Ivan DUTKA-MALEN - EDF R&D - * Date : Septembre 2003 - * Projet : SALOME 2 - * - */ - -#ifndef _LISTISFULLEXCEPTION_H_ -#define _LISTISFULLEXCEPTION_H_ - -#include "Batch_Defines.hxx" - -#include "Batch_GenericException.hxx" - -namespace Batch { - - class BATCH_EXPORT ListIsFullException : public GenericException - { - public: - // Constructeur - ListIsFullException(std::string ch = "undefined") : GenericException("ListIsFullException", ch) {} - }; - -} - -#endif - diff --git a/src/Batch/Batch_LongType.cxx b/src/Batch/Batch_LongType.cxx deleted file mode 100644 index 867c2bcbb..000000000 --- a/src/Batch/Batch_LongType.cxx +++ /dev/null @@ -1,71 +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 -// -/* - * LongType.cxx : - * - * Auteur : Ivan DUTKA-MALEN - EDF R&D - * Date : Septembre 2003 - * Projet : SALOME 2 - * - */ - -#include -#include -#include -//#include "MEDMEM_STRING.hxx" -#include "Batch_LongType.hxx" -using namespace std; - -namespace Batch { - - // Conversion en chaine - string LongType::affiche() const - { - //MEDMEM::STRING sst; - ostringstream sst; - sst << _data; - return sst.str(); - } - - // Operateur d'affectation - LongType & LongType::operator =(long l) - { - _data = l; - return *this; - } - - // Conversion en long - LongType::operator long() const - { - return this->_data; - } - - // Clone duplique l'objet et en fabrique un nouveau a l'aide de new - // qu'il faudra detruire ensuite manuellement - GenericType * LongType::clone() const - { - LongType * pL = new LongType(this->_data); - assert(pL != 0); - return pL; - } - -} diff --git a/src/Batch/Batch_LongType.hxx b/src/Batch/Batch_LongType.hxx deleted file mode 100644 index 448035bfa..000000000 --- a/src/Batch/Batch_LongType.hxx +++ /dev/null @@ -1,69 +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 -// -/* - * LongType.hxx : - * - * Auteur : Ivan DUTKA-MALEN - EDF R&D - * Date : Septembre 2003 - * Projet : SALOME 2 - * - */ - -#ifndef _LONGTYPE_H_ -#define _LONGTYPE_H_ - -#include "Batch_Defines.hxx" - -#include -#include "Batch_GenericType.hxx" - -namespace Batch { - - class BATCH_EXPORT LongType : public GenericType - { - public: - // Constructeur - LongType(const long l=0L) : _data(l) {} - - // Conversion en chaine - virtual std::string affiche() const; - - // Operateur d'affectation - virtual LongType & operator =(long); - - // Conversion en long - virtual operator long() const; - - // Clone duplique l'objet et en fabrique un nouveau a l'aide de new - // qu'il faudra detruire ensuite manuellement - virtual GenericType * clone() const; - - protected: - long _data; - - private: - - }; - -} - -#endif diff --git a/src/Batch/Batch_MapKey.cxx b/src/Batch/Batch_MapKey.cxx deleted file mode 100644 index 0a4d40198..000000000 --- a/src/Batch/Batch_MapKey.cxx +++ /dev/null @@ -1,42 +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 -// -/* - * 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/Batch/Batch_MapKey.hxx b/src/Batch/Batch_MapKey.hxx deleted file mode 100644 index c4a7afe2a..000000000 --- a/src/Batch/Batch_MapKey.hxx +++ /dev/null @@ -1,69 +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 -// -/* - * 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 - -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 - 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/Batch/Batch_NotYetImplementedException.cxx b/src/Batch/Batch_NotYetImplementedException.cxx deleted file mode 100644 index b9ef409f9..000000000 --- a/src/Batch/Batch_NotYetImplementedException.cxx +++ /dev/null @@ -1,37 +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 -// -/* - * NotYetImplementedException.cxx : - * - * Auteur : Ivan DUTKA-MALEN - EDF R&D - * Mail : mailto:ivan.dutka-malen@der.edf.fr - * Date : Tue Nov 25 11:35:07 2003 - * Projet : Salome 2 - * - */ - -#include "Batch_NotYetImplementedException.hxx" - -namespace Batch { - -} - diff --git a/src/Batch/Batch_NotYetImplementedException.hxx b/src/Batch/Batch_NotYetImplementedException.hxx deleted file mode 100644 index 2f3b8b446..000000000 --- a/src/Batch/Batch_NotYetImplementedException.hxx +++ /dev/null @@ -1,52 +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 -// -/* - * NotYetImplementedException.hxx : - * - * Auteur : Ivan DUTKA-MALEN - EDF R&D - * Mail : mailto:ivan.dutka-malen@der.edf.fr - * Date : Tue Nov 25 11:35:07 2003 - * Projet : Salome 2 - * - */ - -#ifndef _NOTYETIMPLEMENTEDEXCEPTION_H_ -#define _NOTYETIMPLEMENTEDEXCEPTION_H_ - -#include "Batch_Defines.hxx" -#include "Batch_GenericException.hxx" - -#include - -namespace Batch { - - class BATCH_EXPORT NotYetImplementedException : public GenericException - { - public: - // Constructeur - NotYetImplementedException(std::string ch = "undefined") : GenericException("NotYetImplementedException", ch) {} - }; - -} - -#endif - diff --git a/src/Batch/Batch_Parametre.cxx b/src/Batch/Batch_Parametre.cxx deleted file mode 100644 index c9d35f602..000000000 --- a/src/Batch/Batch_Parametre.cxx +++ /dev/null @@ -1,295 +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 -// -/* - * Parametre.cxx : - * - * Auteur : Ivan DUTKA-MALEN - EDF R&D - * Date : Septembre 2003 - * Projet : SALOME 2 - * - */ - -#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); -def_static_MapKey(MAIL); -def_static_MapKey(MAXCPUTIME); -def_static_MapKey(MAXDISKSIZE); -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(STARTTIME); -def_static_MapKey(STATE); -def_static_MapKey(TEXT); -def_static_MapKey(TMPDIR); -def_static_MapKey(USEDCPUTIME); -def_static_MapKey(USEDDISKSIZE); -def_static_MapKey(USEDRAMSIZE); -def_static_MapKey(USEDWALLTIME); -def_static_MapKey(USER); -def_static_MapKey(WORKDIR); -def_static_MapKey(HOMEDIR); - -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 - // Cet operateur agit sur les objets NON CONSTANTS, il autorise la modification de - // la valeur associée à la clef car il retourne une reference non constante - Versatile & Parametre::operator [] (const string & mk) - { - // On controle que la clef est valide - if (TypeMap.find(mk) == TypeMap.end()) throw InvalidKeyException(mk.c_str()); - - // On recherche la valeur associee... - Versatile & V = map< string, Versatile >::operator [] (mk); - - // ... et on l'initialise systematiquement - // ATTENTION : si un probleme de type survient (ie, on stocke une valeur d'un type - // different de celui inscrit dans TypeMap) une exception TypeMismatchException est - // levee - V.setName(mk); - V.setType(TypeMap[mk].type); - V.setMaxSize(TypeMap[mk].maxelem); - - return V; - } - - // Operateur de recherche dans la map - // Cet operateur agit sur les objets CONSTANTS - 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()); - - // On recherche la valeur associee - Parametre::const_iterator it = find(mk); - if (it == end()) throw InvalidKeyException(mk.c_str()); - const Versatile & V = (*it).second; - - return V; - } - - // Operateur d'affectation - Parametre & Parametre::operator =(const Parametre & PM) - { - // On ne reaffecte pas l'objet a lui-meme, sinon aie, aie, aie - if (this == &PM) return *this; - - // 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) - ) ); - - return *this; - } - - // Constructeur par recopie - Parametre::Parametre(const Parametre & PM) - { - // 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) - ) ); - } - - // map< string, TypeParam > Parametre::getTypeMap() const - // { - // return TypeMap; - // } - -} diff --git a/src/Batch/Batch_Parametre.hxx b/src/Batch/Batch_Parametre.hxx deleted file mode 100644 index c572a73bf..000000000 --- a/src/Batch/Batch_Parametre.hxx +++ /dev/null @@ -1,159 +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 -// -/* - * Parametre.hxx : - * - * Auteur : Ivan DUTKA-MALEN - EDF R&D - * Date : Septembre 2003 - * Projet : SALOME 2 - * - */ - -#ifndef _PARAMETRE_H_ -#define _PARAMETRE_H_ - -#include "Batch_Defines.hxx" - -#include -#include -#include "Batch_InvalidKeyException.hxx" -#include "Batch_Versatile.hxx" - -// Ces macros permettent de simplifier l'ajout de nouvelles -// clefs dans la map Parametre -// TODO : remplacer ce mecanisme statique par la lecture -// TODO : d'une descrption dans un fichier exterieur (genre XML) - -#define def_extern_MapKey(mk) extern BATCH_EXPORT const std::string & mk; -#define def_static_MapKey(mk) const std::string Batch::Parametre::mk(#mk); \ - const std::string & mk = Batch::Parametre::mk; - -namespace Batch { - - class BATCH_EXPORT Parametre : public std::map< std::string, Versatile > - { - public: - // Constructeur standard - Parametre(); - - // Constructeur par recopie - Parametre(const Parametre & PM); - - // 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); - - // 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; - static const std::string MAIL; - static const std::string MAXCPUTIME; - static const std::string MAXDISKSIZE; - static const std::string MAXRAMSIZE; - 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 STARTTIME; - static const std::string STATE; - static const std::string TEXT; - static const std::string TMPDIR; - static const std::string USEDCPUTIME; - static const std::string USEDDISKSIZE; - static const std::string USEDRAMSIZE; - static const std::string USEDWALLTIME; - static const std::string USER; - static const std::string WORKDIR; - static const std::string HOMEDIR; - - protected: - std::map< std::string, TypeParam > TypeMap; // map interne servant a controler le type de la valeur associee a chaque clef - - private: - - }; - -} - -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); -def_extern_MapKey(MAIL); -def_extern_MapKey(MAXCPUTIME); -def_extern_MapKey(MAXDISKSIZE); -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(STARTTIME); -def_extern_MapKey(STATE); -def_extern_MapKey(TEXT); -def_extern_MapKey(TMPDIR); -def_extern_MapKey(USEDCPUTIME); -def_extern_MapKey(USEDDISKSIZE); -def_extern_MapKey(USEDRAMSIZE); -def_extern_MapKey(USEDWALLTIME); -def_extern_MapKey(USER); -def_extern_MapKey(WORKDIR); -def_extern_MapKey(HOMEDIR); - -#endif diff --git a/src/Batch/Batch_PyVersatile.cxx b/src/Batch/Batch_PyVersatile.cxx deleted file mode 100644 index 620cf5eca..000000000 --- a/src/Batch/Batch_PyVersatile.cxx +++ /dev/null @@ -1,202 +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 -// -/* - * PyVersatile.cxx : - * - * Auteur : Ivan DUTKA-MALEN - EDF R&D - * Mail : mailto:ivan.dutka-malen@der.edf.fr - * Date : Mon Oct 13 12:01:12 2003 - * Projet : Salome 2 - * - */ - -#include -#include "Batch_TypeMismatchException.hxx" -#include "Batch_ListIsFullException.hxx" -#include "Batch_InvalidArgumentException.hxx" -#include "Batch_PyVersatile.hxx" -#include - -using namespace std; - -namespace Batch { - - // Constructeur a partir d'un objet Versatile - PyVersatile::PyVersatile(const Versatile & V) : Versatile(V) - { - // Nothing to do - } - - - // Constructeur a partir d'un PyObject - // Les objets autorises sont les strings et les ints, - // ainsi que les listes de strings - PyVersatile::PyVersatile(const PyObject * PyO) throw(TypeMismatchException, ListIsFullException, InvalidArgumentException) : Versatile() - { - PyObject * _PyO = const_cast(PyO); - - if (PyList_Check(_PyO)) { // c'est une liste - _maxsize = PyList_Size(_PyO); - for(int i=0; i<_maxsize; i++) { - PyObject * val = PyList_GetItem(_PyO, i); - if (PyString_Check(val)) { - *this += PyString_AsString(val); - - } else if (PyTuple_Check(val) && - (PyTuple_Size(val) == 2) && - PyString_Check( PyTuple_GetItem(val,0) ) && - PyString_Check( PyTuple_GetItem(val,1) ) ) { - *this += Couple( PyString_AsString( PyTuple_GetItem(val,0) ), - PyString_AsString( PyTuple_GetItem(val,1) ) - ); - - } else { - PyErr_SetString(PyExc_RuntimeWarning, "PyVersatile::PyVersatile(const PyObject * PyO) : invalid PyObject"); - } - } - - } else if (PyString_Check(_PyO)) { // c'est une string - const char * s = PyString_AsString(_PyO); - Versatile V = string(s); - *this = V; - - } else if (PyInt_Check(_PyO)) { // c'est un int - *this = PyInt_AsLong(_PyO); - - } else { // erreur - PyErr_SetString(PyExc_RuntimeWarning, "PyVersatile::PyVersatile(const PyObject * PyO) : invalid PyObject"); - } - } - - - - // Conversion de type vers un PyObject - PyVersatile::operator PyObject *() const - { - PyObject * obj; - - if (_maxsize != 1) { // une liste - obj = PyList_New(0); - for(Versatile::const_iterator it=begin(); it!=end(); it++) { -// char ch[2] = {0, 0}; - string st; - Couple cp; -// PyObject * tuple; - switch (_discriminator) { - // case BOOL: - // PyList_Append(obj, PyInt_FromLong(* static_cast(*it))); - // break; - - // case CHAR: - // *ch = * static_cast(*it); - // PyList_Append(obj, PyString_FromString(ch)); - // break; - - // case INT: - // PyList_Append(obj, PyInt_FromLong(* static_cast(*it))); - // break; - - case LONG: - PyList_Append(obj, PyInt_FromLong(* static_cast(*it))); - break; - - case STRING: - st = * static_cast(*it); - PyList_Append(obj, PyString_FromString(st.c_str())); - break; - - case COUPLE: - cp = * static_cast(*it); -// tuple = PyTuple_New(2); -// PyTuple_SetItem(tuple, 0, PyString_FromString( cp.getLocal().c_str() ) ); -// PyTuple_SetItem(tuple, 1, PyString_FromString( cp.getRemote().c_str() ) ); -// PyList_Append(obj, tuple); - PyList_Append(obj, Py_BuildValue("(ss)", cp.getLocal().c_str(), cp.getRemote().c_str() )); - break; - - case UNDEFINED: - PyList_Append(obj, Py_None); - break; - } - - } - - } else { // un scalaire -// char ch[2] = {0, 0}; - string st; - Couple cp; -// PyObject * tuple; - switch (_discriminator) { - // case BOOL: - // obj = PyInt_FromLong(* static_cast(front())); - // break; - - // case CHAR: - // *ch = * static_cast(front()); - // obj = PyString_FromString(ch); - // break; - - // case INT: - // obj = PyInt_FromLong(* static_cast(front())); - // break; - - case LONG: - obj = PyInt_FromLong(* static_cast(front())); - break; - - case STRING: - st = * static_cast(front()); - obj = PyString_FromString(st.c_str()); - break; - - case COUPLE: - cp = * static_cast(front()); -// tuple = PyTuple_New(2); -// PyTuple_SetItem(tuple, 0, PyString_FromString( cp.getLocal().c_str() ) ); -// PyTuple_SetItem(tuple, 1, PyString_FromString( cp.getRemote().c_str() ) ); -// obj = PyList_New(0); -// PyList_Append(obj, tuple); - obj = Py_BuildValue("[(ss)]", cp.getLocal().c_str(), cp.getRemote().c_str() ); - break; - - case UNDEFINED: - obj = Py_None; - break; - } - } - - return obj; - } - - - // Operateur d'affectation a partir d'un objet Versatile - PyVersatile & PyVersatile::operator =(const Versatile & V) - { - Versatile * me = this; - *me = V; - return *this; - } - -} - - -// COMMENTS diff --git a/src/Batch/Batch_PyVersatile.hxx b/src/Batch/Batch_PyVersatile.hxx deleted file mode 100644 index 41439fc6d..000000000 --- a/src/Batch/Batch_PyVersatile.hxx +++ /dev/null @@ -1,69 +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 -// -/* - * PyVersatile.hxx : - * - * Auteur : Ivan DUTKA-MALEN - EDF R&D - * Mail : mailto:ivan.dutka-malen@der.edf.fr - * Date : Mon Oct 13 12:01:12 2003 - * Projet : Salome 2 - * - */ - -#ifndef _PYVERSATILE_H_ -#define _PYVERSATILE_H_ - - -#include "Batch_Defines.hxx" - -#include -#include "Batch_Versatile.hxx" -#include "Batch_TypeMismatchException.hxx" -#include "Batch_ListIsFullException.hxx" -#include "Batch_InvalidArgumentException.hxx" - -namespace Batch { - - class BATCH_EXPORT PyVersatile : public Versatile - { - public: - // Constructeur a partir d'un objet Versatile - PyVersatile(const Versatile &); - - // Constructeur a partir d'un PyObject - PyVersatile(const PyObject *) throw(TypeMismatchException, ListIsFullException, InvalidArgumentException); - - // Conversion de type vers un PyObject - operator PyObject *() const; - - // Operateur d'affectation a partir d'un objet Versatile - PyVersatile & operator =(const Versatile &); - - protected: - - private: - - }; - -} - -#endif diff --git a/src/Batch/Batch_RunTimeException.cxx b/src/Batch/Batch_RunTimeException.cxx deleted file mode 100644 index 3db54fdaf..000000000 --- a/src/Batch/Batch_RunTimeException.cxx +++ /dev/null @@ -1,37 +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 -// -/* - * RunTimeException.cxx : - * - * Auteur : Ivan DUTKA-MALEN - EDF R&D - * Mail : mailto:ivan.dutka-malen@der.edf.fr - * Date : Tue Nov 25 14:04:13 2003 - * Projet : Salome 2 - * - */ - -#include "Batch_RunTimeException.hxx" -using namespace std; - -namespace Batch { - -} diff --git a/src/Batch/Batch_RunTimeException.hxx b/src/Batch/Batch_RunTimeException.hxx deleted file mode 100644 index bdb31489f..000000000 --- a/src/Batch/Batch_RunTimeException.hxx +++ /dev/null @@ -1,51 +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 -// -/* - * RunTimeException.hxx : - * - * Auteur : %author% - EDF R&D - * Mail : mailto:ivan.dutka-malen@der.edf.fr - * Date : Tue Nov 25 14:04:13 2003 - * Projet : Salome 2 - * - */ - -#ifndef _RUNTIMEEXCEPTION_H_ -#define _RUNTIMEEXCEPTION_H_ - -#include "Batch_Defines.hxx" - - -#include "Batch_GenericException.hxx" - -namespace Batch { - - class BATCH_EXPORT RunTimeException : public GenericException - { - public: - // Constructeur - RunTimeException(std::string ch = "undefined") : GenericException("RunTimeException", ch) {} - }; - -} - -#endif diff --git a/src/Batch/Batch_StringType.cxx b/src/Batch/Batch_StringType.cxx deleted file mode 100644 index 33c7c5fd3..000000000 --- a/src/Batch/Batch_StringType.cxx +++ /dev/null @@ -1,66 +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 -// -/* - * StringType.cxx : - * - * Auteur : Ivan DUTKA-MALEN - EDF R&D - * Date : Septembre 2003 - * Projet : SALOME 2 - * - */ - -#include -#include -#include "Batch_StringType.hxx" -using namespace std; - -namespace Batch { - - // Conversion en chaine - string StringType::affiche() const - { - return _data; - } - - // Operateur d'affectation - StringType & StringType::operator =(string s) - { - _data = s; - return *this; - } - - // Conversion en chaine - StringType::operator string() const - { - return this->_data; - } - - // Clone duplique l'objet et en fabrique un nouveau a l'aide de new - // qu'il faudra detruire ensuite manuellement - GenericType * StringType::clone() const - { - StringType * pS = new StringType(this->_data); - assert(pS != 0); - return pS; - } - -} diff --git a/src/Batch/Batch_StringType.hxx b/src/Batch/Batch_StringType.hxx deleted file mode 100644 index fb5a80e0d..000000000 --- a/src/Batch/Batch_StringType.hxx +++ /dev/null @@ -1,67 +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 -// -/* - * StringType.hxx : - * - * Auteur : Ivan DUTKA-MALEN - EDF R&D - * Date : Septembre 2003 - * Projet : SALOME 2 - * - */ - -#ifndef _STRINGTYPE_H_ -#define _STRINGTYPE_H_ - -#include "Batch_Defines.hxx" - -#include -#include "Batch_GenericType.hxx" - -namespace Batch { - - class BATCH_EXPORT StringType : public GenericType - { - public: - // Constructeur - StringType(const std::string & s="") : _data(s) {} - - // Conversion en chaine - virtual std::string affiche() const; - virtual operator std::string() const; - - // Operateur d'affectation - virtual StringType & operator =(std::string); - - // Clone duplique l'objet et en fabrique un nouveau a l'aide de new - // qu'il faudra detruire ensuite manuellement - virtual GenericType * clone() const; - - protected: - std::string _data; - - private: - - }; - -} - -#endif diff --git a/src/Batch/Batch_TypeMismatchException.cxx b/src/Batch/Batch_TypeMismatchException.cxx deleted file mode 100644 index 96b30be4c..000000000 --- a/src/Batch/Batch_TypeMismatchException.cxx +++ /dev/null @@ -1,36 +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 -// -/* - * TypeMismatchException.cxx : - * - * Auteur : Ivan DUTKA-MALEN - EDF R&D - * Date : Septembre 2003 - * Projet : SALOME 2 - * - */ - -#include "Batch_TypeMismatchException.hxx" -using namespace std; - -namespace Batch { - -} diff --git a/src/Batch/Batch_TypeMismatchException.hxx b/src/Batch/Batch_TypeMismatchException.hxx deleted file mode 100644 index 10912f6fb..000000000 --- a/src/Batch/Batch_TypeMismatchException.hxx +++ /dev/null @@ -1,51 +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 -// -/* - * TypeMismatchException.hxx : - * - * Auteur : Ivan DUTKA-MALEN - EDF R&D - * Date : Septembre 2003 - * Projet : SALOME 2 - * - */ - -#ifndef _TYPEMISMATCHEXCEPTION_H_ -#define _TYPEMISMATCHEXCEPTION_H_ - -#include "Batch_Defines.hxx" - - -#include "Batch_GenericException.hxx" - -namespace Batch { - - class BATCH_EXPORT TypeMismatchException : public GenericException - { - public: - // Constructeur - TypeMismatchException(std::string ch = "undefined") : GenericException("TypeMismatchException", ch) {} - }; - -} - -#endif - diff --git a/src/Batch/Batch_Versatile.cxx b/src/Batch/Batch_Versatile.cxx deleted file mode 100644 index 00746006a..000000000 --- a/src/Batch/Batch_Versatile.cxx +++ /dev/null @@ -1,323 +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 -// -/* - * Versatile.cxx : - * - * Auteur : Ivan DUTKA-MALEN - EDF R&D - * Date : Septembre 2003 - * Projet : SALOME 2 - * - */ - -#include -#include -#include -#include -#include -//#include "MEDMEM_STRING.hxx" -#include "Batch_GenericType.hxx" -#include "Batch_IntType.hxx" -#include "Batch_BoolType.hxx" -#include "Batch_CharType.hxx" -#include "Batch_LongType.hxx" -#include "Batch_StringType.hxx" -#include "Batch_Versatile.hxx" -#include "Batch_TypeMismatchException.hxx" -#include "Batch_ListIsFullException.hxx" -using namespace std; - -namespace Batch { - - // Constructeur par recopie - Versatile::Versatile(const Versatile & V) : _discriminator(V._discriminator), _maxsize(V._maxsize), _name(V._name) // , _str_value(0) - { - Versatile::const_iterator it; - - // On prend un a un les elements de l'objet passe en argument qu'on duplique - for(it=V.begin(); it!=V.end(); it++) - push_back( (*it)->clone() ); // Attention, la methode clone fait un new implicite - } - - // Destructeur - Versatile::~Versatile() - { - eraseAll(); - } - - // Operateur d'affectation entre objets - Versatile & Versatile::operator = (const Versatile & Vrhs) throw(TypeMismatchException) - { - // ATTENTION : le forçage de type leve une exception TypeMismatchException entre cas de conflit - setType(Vrhs._discriminator); - setMaxSize(Vrhs._maxsize); - _name = Vrhs._name; - - // On efface les donnees precedentes - eraseAll(); - - // On copie les donnees de Vrhs - Versatile::const_iterator it; - - for(it=Vrhs.begin(); it!=Vrhs.end(); it++) - push_back( (*it)->clone() ); // Attention, la methode clone fait un new implicite - - return *this; - } - - // Operateur d'affectation a partir d'un long - Versatile & Versatile::operator = (const long l) throw(TypeMismatchException) - { - // ATTENTION : le forçage de type leve une exception TypeMismatchException entre cas de conflit - setType(LONG); - - // On efface les donnees precedentes - eraseAll(); - - // On ajoute un element interne de type long a l'objet - LongType * pL = new LongType(l); - assert(pL != 0); - push_back(pL); - return *this; - } - - // Operateur d'affectation a partir d'une string - Versatile & Versatile::operator = (const string & ch) throw(TypeMismatchException) - { - // ATTENTION : le forçage de type leve une exception TypeMismatchException entre cas de conflit - setType(STRING); - - // On efface les donnees precedentes - eraseAll(); - - // On ajoute un element interne de type string a l'objet - StringType * pS = new StringType(ch); - assert(pS != 0); - push_back(pS); - - return *this; - } - - // Operateur de concatenation a partir d'une string - Versatile & Versatile::operator +=(const string & ch) throw(TypeMismatchException,ListIsFullException) - { - // ATTENTION : le forçage de type leve une exception TypeMismatchException entre cas de conflit - setType(STRING); - - // Si la taille maximale est atteinte, on leve une exception ListIsFullException - if (_maxsize == 0) push_back(new StringType(ch)); - else if ((_maxsize > 0) && (size() < _maxsize)) push_back(new StringType(ch)); - else { - //MEDMEM::STRING msg; - ostringstream msg; - msg << "Taille maximum : " << _maxsize; - throw(ListIsFullException(msg.str())); - } - return *this; - } - - // Operateur de concatenation a partir d'une string - Versatile & Versatile::operator , (const string & ch) throw(TypeMismatchException,ListIsFullException) - { - *this += ch; - return *this; - } - - // Operateur d'affectation a partir d'un Couple - Versatile & Versatile::operator = (const Couple & cp) throw(TypeMismatchException) - { - // ATTENTION : le forçage de type leve une exception TypeMismatchException entre cas de conflit - setType(COUPLE); - - // On efface les donnees precedentes - eraseAll(); - - // On ajoute un element interne de type Couple a l'objet - CoupleType * pC = new CoupleType(cp); - assert(pC != 0); - push_back(pC); - - return *this; - } - - // Operateur de concatenation a partir d'un Couple - Versatile & Versatile::operator +=(const Couple & cp) throw(TypeMismatchException,ListIsFullException) - { - // ATTENTION : le forçage de type leve une exception TypeMismatchException entre cas de conflit - setType(COUPLE); - - // Si la taille maximale est atteinte, on leve une exception ListIsFullException - if (_maxsize == 0) push_back(new CoupleType(cp)); - else if ((_maxsize > 0) && (size() < _maxsize)) push_back(new CoupleType(cp)); - else { - //MEDMEM::STRING msg; - ostringstream msg; - msg << "Taille maximum : " << _maxsize; - throw(ListIsFullException(msg.str())); - } - return *this; - } - - // Operateur de concatenation a partir d'un Couple - Versatile & Versatile::operator , (const Couple & cp) throw(TypeMismatchException,ListIsFullException) - { - *this += cp; - return *this; - } - - ostream & operator << (ostream & os, const Versatile & V) - { - Versatile::const_iterator it; - const char * sep = ""; - - for(it=V.begin(); it!=V.end(); it++, sep=" ") { - string s = (*it)->affiche(); - os << sep << s; - } - return os; - } - - // Positionnement du type de l'element interne - void Versatile::setType(DiscriminatorType t) throw(TypeMismatchException) - { - // Si le type est deja defini et ne correspond pas au type en argument - // une exception TypeMismatchException est levee - if ( (_discriminator == UNDEFINED) || (_discriminator == t) ) - _discriminator = t; - else { - //MEDMEM::STRING sst; - ostringstream sst; - sst << "Trying to change type of Versatile object \"" - << _name << "\""; - throw(TypeMismatchException(sst.str())); - } - } - - // Positionnement du nombre d'elements internes - void Versatile::setMaxSize(int i) - { - _maxsize = i; - if (i <= 0) return; - // Si la nouvelle taille est inferieure au nombre d'elements deja - // presents, les elements en surplus sont effaces (troncature) - if (size() > _maxsize) - { - int reste = size() - _maxsize; - Versatile::iterator it; - for(it=end(); (it!=begin()) && reste; it--, reste--) - { - delete back(); - pop_back(); - } - } - } - - - // Conversion de type vers un long - Versatile::operator long() const throw(TypeMismatchException) - { - // Si le type ne correspond pas ou si la liste contient plus d'un element, - // la conversion est impossible et une exception TypeMismatchException - // est levee - if ( (_maxsize != 1) || (_discriminator != LONG) || (size() == 0) ) { - //MEDMEM::STRING sst; - ostringstream sst; - sst << "Cannot cast Versatile object \"" - << _name << "\" to long"; - throw(TypeMismatchException(sst.str())); - } - return *( static_cast(this->front()) ); - } - - // Conversion de type vers un Couple - Versatile::operator Couple() const throw(TypeMismatchException) - { - // Si le type ne correspond pas ou si la liste contient plus d'un element, - // la conversion est impossible et une exception TypeMismatchException - // est levee - if ( (_maxsize != 1) || (_discriminator != COUPLE) || (size() == 0) ) { - //MEDMEM::STRING sst; - ostringstream sst; - sst << "Cannot cast Versatile object \"" - << _name << "\" to Couple"; - throw(TypeMismatchException(sst.str())); - } - return *( static_cast(this->front()) ); - } - - // Conversion de type vers une string - string Versatile::str() const throw(TypeMismatchException) - { - // Si le type ne correspond pas, la conversion est impossible et - // une exception TypeMismatchException est levee - if ( (_discriminator != STRING) || (size() == 0) ) { - //MEDMEM::STRING sst; - ostringstream sst; - sst << "Cannot cast Versatile object \"" - << _name << "\" to string"; - throw(TypeMismatchException(sst.str())); - } - - // La chaine renvoyee est la concatenation des chaines internes - string s; - Versatile::const_iterator it; - const char * sep = ""; - for(it=begin(); it!=end(); it++, s+=sep, sep=" ") - s += *( static_cast(*it)); - - return s; - } - - // Conversion de type vers une string - Versatile::operator string () const throw(TypeMismatchException) - { - return str(); - } - - // Efface tous les elements internes de l'objet - void Versatile::eraseAll() - { - while(!empty()) - { - delete back(); - pop_back(); - } - } - - - // Recuperation du type de l'element interne - DiscriminatorType Versatile::getType() const - { - return _discriminator; - } - - // Recuperation du nom de l'objet - string Versatile::getName() const - { - return _name; - } - - // Positionnement du nom de l'objet - void Versatile::setName(const string & name) - { - _name = name; - } -} diff --git a/src/Batch/Batch_Versatile.hxx b/src/Batch/Batch_Versatile.hxx deleted file mode 100644 index 92278b8f8..000000000 --- a/src/Batch/Batch_Versatile.hxx +++ /dev/null @@ -1,123 +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 -// -/* - * Versatile.hxx : - * - * Auteur : Ivan DUTKA-MALEN - EDF R&D - * Date : Septembre 2003 - * Projet : SALOME 2 - * - */ - -#ifndef _VERSATILE_H_ -#define _VERSATILE_H_ - -#include "Batch_Defines.hxx" - -#include -#include -#include -#include "Batch_GenericType.hxx" -#include "Batch_IntType.hxx" -#include "Batch_BoolType.hxx" -#include "Batch_CharType.hxx" -#include "Batch_LongType.hxx" -#include "Batch_StringType.hxx" -#include "Batch_CoupleType.hxx" -#include "Batch_TypeMismatchException.hxx" -#include "Batch_ListIsFullException.hxx" - -namespace Batch { - - // Les types autorises - // 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: - // Constructeur standard et destructeur - Versatile() : _discriminator(UNDEFINED), _maxsize(1), _name("undefined") {} - virtual ~Versatile(); - - // Constructeur par recopie - Versatile(const Versatile & V); - - // Constructeur depuis le type de "base" - Versatile(long l) : _discriminator(LONG), _maxsize(1), _name("long") { push_back(new LongType(l)); } - Versatile(const std::string & s) : _discriminator(STRING), _maxsize(1), _name("string") { push_back(new StringType(s)); } - Versatile(const Couple & c) : _discriminator(COUPLE), _maxsize(1), _name("couple") { push_back(new CoupleType(c)); } - - // Operateur d'affectation et de concatenation a partir d'un type de "base" - Versatile & operator = (const long l) throw(TypeMismatchException); - Versatile & operator = (const std::string & ch) throw(TypeMismatchException); - Versatile & operator +=(const std::string & ch) throw(TypeMismatchException,ListIsFullException); - Versatile & operator , (const std::string & ch) throw(TypeMismatchException,ListIsFullException); - Versatile & operator = (const Couple & cp) throw(TypeMismatchException); - Versatile & operator +=(const Couple & cp) throw(TypeMismatchException,ListIsFullException); - Versatile & operator , (const Couple & cp) throw(TypeMismatchException,ListIsFullException); - - // Operateur d'affectation entre objets - Versatile & operator = (const Versatile & V) throw(TypeMismatchException); - - // Conversion de type vers un type de "base" - operator long() const throw(TypeMismatchException); - operator std::string() const throw(TypeMismatchException); - operator Couple() const throw(TypeMismatchException); - std::string str() const throw(TypeMismatchException); - - // Operateur pour l'affichage sur un stream - friend std::ostream & operator << (std::ostream & os, const Versatile & ); - - // Positionnement et recuperation du type de l'element interne - void setType(DiscriminatorType) throw(TypeMismatchException); - DiscriminatorType getType() const; - - // Positionnement et recuperation du nombre d'elements internes - void setMaxSize(int i); - int getMaxSize() const { return _maxsize; } - - // Positionnement et recuperation du nom de l'objet - std::string getName() const; - void setName(const std::string & name); - - protected: - // Efface tous les elements internes de l'objet - virtual void eraseAll(); - - DiscriminatorType _discriminator; // type de l'element interne - int _maxsize; // nombre max d'elements internes - std::string _name; // nom de l'objet (sert pour les exceptions) - - private: - - }; - -} - -#endif - diff --git a/src/Batch/Makefile.am b/src/Batch/Makefile.am deleted file mode 100644 index 75bf277bc..000000000 --- a/src/Batch/Makefile.am +++ /dev/null @@ -1,219 +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 -# -####################################### library -# SALOME Container : implementation of container and engine for Kernel -# File : Makefile.in -# Author : EDF -# Module : SALOME -# $Header$ -# -include $(top_srcdir)/salome_adm/unix/make_common_starter.am - -# header files -LIB_INCLUDES = \ - Batch_APIInternalFailureException.hxx \ - Batch_BatchManager.hxx \ - Batch_BatchManagerCatalog.hxx \ - Batch_BoolType.hxx \ - Batch_CharType.hxx \ - Batch_ConnexionFailureException.hxx \ - Batch_Couple.hxx \ - Batch_CoupleType.hxx \ - Batch_Date.hxx \ - Batch_DateType.hxx \ - Batch_Environnement.hxx \ - Batch_FactBatchManager.hxx \ - Batch_GenericException.hxx \ - Batch_GenericType.hxx \ - Batch_IntType.hxx \ - Batch_InvalidArgumentException.hxx \ - Batch_InvalidKeyException.hxx \ - Batch_Job.hxx \ - Batch_JobId.hxx \ - Batch_JobInfo.hxx \ - Batch_ListIsFullException.hxx \ - Batch_LongType.hxx \ - Batch_MapKey.hxx \ - Batch_NotYetImplementedException.hxx \ - Batch_Parametre.hxx \ - Batch_PyVersatile.hxx \ - Batch_RunTimeException.hxx \ - Batch_StringType.hxx \ - Batch_TypeMismatchException.hxx \ - Batch_BatchManager_eClient.hxx \ - Batch_FactBatchManager_eClient.hxx \ - Batch_BatchManager_eLSF.hxx \ - Batch_FactBatchManager_eLSF.hxx \ - Batch_JobInfo_eLSF.hxx \ - Batch_BatchManager_ePBS.hxx \ - Batch_FactBatchManager_ePBS.hxx \ - Batch_JobInfo_ePBS.hxx \ - MpiImpl.hxx \ - Batch_Defines.hxx \ - Batch_BatchManager_eSGE.hxx \ - Batch_FactBatchManager_eSGE.hxx \ - Batch_JobInfo_eSGE.hxx \ - MpiImpl.hxx - - -LIB_SRC = \ - Batch_APIInternalFailureException.cxx \ - Batch_BatchManager.cxx \ - Batch_BatchManagerCatalog.cxx \ - Batch_BoolType.cxx \ - Batch_CharType.cxx \ - Batch_ConnexionFailureException.cxx \ - Batch_Couple.cxx \ - Batch_CoupleType.cxx \ - Batch_Date.cxx \ - Batch_DateType.cxx \ - Batch_Environnement.cxx \ - Batch_FactBatchManager.cxx \ - Batch_GenericException.cxx \ - Batch_GenericType.cxx \ - Batch_IntType.cxx \ - Batch_InvalidArgumentException.cxx \ - Batch_InvalidKeyException.cxx \ - Batch_Job.cxx \ - Batch_JobId.cxx \ - Batch_JobInfo.cxx \ - Batch_ListIsFullException.cxx \ - Batch_LongType.cxx \ - Batch_MapKey.cxx \ - Batch_NotYetImplementedException.cxx \ - Batch_Parametre.cxx \ - Batch_PyVersatile.cxx \ - Batch_RunTimeException.cxx \ - Batch_StringType.cxx \ - Batch_TypeMismatchException.cxx \ - Batch_BatchManager_eClient.cxx \ - Batch_FactBatchManager_eClient.cxx \ - Batch_BatchManager_eLSF.cxx \ - Batch_FactBatchManager_eLSF.cxx \ - Batch_JobInfo_eLSF.cxx \ - Batch_BatchManager_ePBS.cxx \ - Batch_FactBatchManager_ePBS.cxx \ - Batch_JobInfo_ePBS.cxx \ - Batch_BatchManager_eSGE.cxx \ - Batch_FactBatchManager_eSGE.cxx \ - Batch_JobInfo_eSGE.cxx \ - MpiImpl.cxx - -LIB_CPPFLAGS = ${PYTHON_INCLUDES} -LIB_LIBADD = $(PYTHON_LIBS) - -# -# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -# Special add for local batch system -# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -# -if WITH_LOCAL -LIB_INCLUDES +=\ - Batch_Versatile.hxx \ - Batch_BatchManager_Local.hxx \ - Batch_BatchManager_Local_RSH.hxx \ - Batch_BatchManager_Local_SH.hxx \ - Batch_BatchManager_Local_SSH.hxx \ - Batch_FactBatchManager_Local.hxx \ - Batch_FactBatchManager_Local_RSH.hxx \ - Batch_FactBatchManager_Local_SH.hxx \ - Batch_FactBatchManager_Local_SSH.hxx \ - Batch_JobInfo_Local.hxx \ - Batch_Job_Local.hxx \ - Batch_IOMutex.hxx - -LIB_SRC +=\ - Batch_Versatile.cxx \ - Batch_BatchManager_Local.cxx \ - Batch_BatchManager_Local_RSH.cxx \ - Batch_BatchManager_Local_SH.cxx \ - Batch_BatchManager_Local_SSH.cxx \ - Batch_FactBatchManager_Local.cxx \ - Batch_FactBatchManager_Local_RSH.cxx \ - Batch_FactBatchManager_Local_SH.cxx \ - Batch_FactBatchManager_Local_SSH.cxx \ - Batch_JobInfo_Local.cxx \ - Batch_Job_Local.cxx \ - Batch_IOMutex.cxx - -endif - -# -# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -# Special add for openpbs batch system -# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -# -if WITH_OPENPBS -LIB_INCLUDES += \ - Batch_BatchManager_PBS.hxx \ - Batch_FactBatchManager_PBS.hxx \ - Batch_JobInfo_PBS.hxx \ - Batch_Job_PBS.hxx - -LIB_SRC +=\ - Batch_BatchManager_PBS.cxx \ - Batch_FactBatchManager_PBS.cxx \ - Batch_JobInfo_PBS.cxx \ - Batch_Job_PBS.cxx - -LIB_CPPFLAGS += @OPENPBS_INCLUDES@ -LIB_LIBADD += @OPENPBS_LIBDIR@ @OPENPBS_LIBS@ - -endif - -# -# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -# Special add for lsf batch system -# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -# -if WITH_LSF -LIB_INCLUDES += \ - Batch_BatchManager_LSF.hxx \ - Batch_FactBatchManager_LSF.hxx \ - Batch_JobInfo_LSF.hxx \ - Batch_Job_LSF.hxx - -LIB_SRC += \ - Batch_BatchManager_LSF.cxx \ - Batch_FactBatchManager_LSF.cxx \ - Batch_JobInfo_LSF.cxx \ - Batch_Job_LSF.cxx - -LIB_CPPFLAGS += ${LSF_INCLUDES} -LIB_LIBADD += ${LSF_LDFLAGS} ${LSF_LIBS} -endif - - - - -salomeinclude_HEADERS = $(LIB_INCLUDES) - -# -# =============================================================== -# Libraries targets -# =============================================================== -# -lib_LTLIBRARIES = libSalomeBatch.la -libSalomeBatch_la_SOURCES = $(LIB_SRC) -libSalomeBatch_la_CPPFLAGS = ${LIB_CPPFLAGS} -libSalomeBatch_la_LDFLAGS = -no-undefined -version-info=0:0:0 -libSalomeBatch_la_LIBADD = $(LIB_LIBADD) diff --git a/src/Batch/MpiImpl.cxx b/src/Batch/MpiImpl.cxx deleted file mode 100644 index 549158419..000000000 --- a/src/Batch/MpiImpl.cxx +++ /dev/null @@ -1,277 +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 -// - -#include -#include -#include -#include "MpiImpl.hxx" - -using namespace std; - -// Constructor -MpiImpl::MpiImpl() -{ -} - -// Destructor -MpiImpl::~MpiImpl() -{ -} - -// lam implementation -// Constructor -MpiImpl_LAM::MpiImpl_LAM() : MpiImpl() -{ -} - -// Destructor -MpiImpl_LAM::~MpiImpl_LAM() -{ -} - -string MpiImpl_LAM::size() -{ - return "${LAMWORLD}"; -} - -string MpiImpl_LAM::rank() -{ - return "${LAMRANK}"; -} - -string MpiImpl_LAM::boot(const string machinefile, const unsigned int nbnodes) -{ - ostringstream oss; - oss << "lamboot " << machinefile << endl; - return oss.str(); -} - -string MpiImpl_LAM::run(const string machinefile, const unsigned int nbproc, const string fileNameToExecute) -{ - ostringstream oss; - oss << "mpirun -np " << nbproc << " " << fileNameToExecute << endl; - return oss.str(); -} - -string MpiImpl_LAM::halt() -{ - ostringstream oss; - oss << "lamhalt" << endl; - return oss.str(); -} - -// mpich1 implementation -// Constructor -MpiImpl_MPICH1::MpiImpl_MPICH1() : MpiImpl() -{ -} - -// Destructor -MpiImpl_MPICH1::~MpiImpl_MPICH1() -{ -} - -string MpiImpl_MPICH1::size() -{ - return "${MPIRUN_NPROCS}"; -} - -string MpiImpl_MPICH1::rank() -{ - return "${MPIRUN_RANK}"; -} - -string MpiImpl_MPICH1::boot(const string machinefile, const unsigned int nbnodes) -{ - return ""; -} - -string MpiImpl_MPICH1::run(const string machinefile, const unsigned int nbproc, const string fileNameToExecute) -{ - ostringstream oss; - oss << "mpirun -machinefile " << machinefile << " -np " << nbproc << " " << fileNameToExecute << endl; - return oss.str(); -} - -string MpiImpl_MPICH1::halt() -{ - return ""; -} - -// mpich2 implementation -// Constructor -MpiImpl_MPICH2::MpiImpl_MPICH2() : MpiImpl() -{ -} - -// Destructor -MpiImpl_MPICH2::~MpiImpl_MPICH2() -{ -} - -string MpiImpl_MPICH2::size() -{ - return "${PMI_SIZE}"; -} - -string MpiImpl_MPICH2::rank() -{ - return "${PMI_RANK}"; -} - -string MpiImpl_MPICH2::boot(const string machinefile, const unsigned int nbnodes) -{ - ostringstream oss; - oss << "mpdboot" << " -n " << nbnodes; - if (machinefile!="") - oss << " -f " << machinefile; - oss << endl; - return oss.str(); -} - -string MpiImpl_MPICH2::run(const string machinefile, const unsigned int nbproc, const string fileNameToExecute) -{ - ostringstream oss; - oss << "mpirun -np " << nbproc << " " << fileNameToExecute << endl; - return oss.str(); -} - -string MpiImpl_MPICH2::halt() -{ - ostringstream oss; - oss << "mpdallexit" << endl; - return oss.str(); -} - -// openmpi implementation -// Constructor -MpiImpl_OPENMPI::MpiImpl_OPENMPI() : MpiImpl() -{ -} - -// Destructor -MpiImpl_OPENMPI::~MpiImpl_OPENMPI() -{ -} - -string MpiImpl_OPENMPI::size() -{ - return "${OMPI_MCA_ns_nds_num_procs}"; -} - -string MpiImpl_OPENMPI::rank() -{ - return "${OMPI_MCA_ns_nds_vpid}"; -} - -string MpiImpl_OPENMPI::boot(const string machinefile, const unsigned int nbnodes) -{ - return ""; -} - -string MpiImpl_OPENMPI::run(const string machinefile, const unsigned int nbproc, const string fileNameToExecute) -{ - ostringstream oss; - oss << "mpirun -hostfile " << machinefile << " -np " << nbproc << " " << fileNameToExecute << endl; - return oss.str(); -} - -string MpiImpl_OPENMPI::halt() -{ - return ""; -} - -// slurm implementation -// Constructor -MpiImpl_SLURM::MpiImpl_SLURM() : MpiImpl() -{ -} - -// Destructor -MpiImpl_SLURM::~MpiImpl_SLURM() -{ -} - -string MpiImpl_SLURM::size() -{ - return "${SLURM_NPROCS}"; -} - -string MpiImpl_SLURM::rank() -{ - return "${SLURM_PROCID}"; -} - -string MpiImpl_SLURM::boot(const string machinefile, const unsigned int nbnodes) -{ - return ""; -} - -string MpiImpl_SLURM::run(const string machinefile, const unsigned int nbproc, const string fileNameToExecute) -{ - ostringstream oss; - oss << "srun " << fileNameToExecute << endl; - return oss.str(); -} - -string MpiImpl_SLURM::halt() -{ - return ""; -} - -// prun implementation -// Constructor -MpiImpl_PRUN::MpiImpl_PRUN() : MpiImpl() -{ -} - -// Destructor -MpiImpl_PRUN::~MpiImpl_PRUN() -{ -} - -string MpiImpl_PRUN::size() -{ - return "${RMS_NPROCS}"; -} - -string MpiImpl_PRUN::rank() -{ - return "${RMS_RANK}"; -} - -string MpiImpl_PRUN::boot(const string machinefile, const unsigned int nbnodes) -{ - return ""; -} - -string MpiImpl_PRUN::run(const string machinefile, const unsigned int nbproc, const string fileNameToExecute) -{ - ostringstream oss; - oss << "prun -n " << nbproc << " " << "-p mpi " << fileNameToExecute << endl; - return oss.str(); -} - -string MpiImpl_PRUN::halt() -{ - return ""; -} diff --git a/src/Batch/MpiImpl.hxx b/src/Batch/MpiImpl.hxx deleted file mode 100644 index 4639e6e85..000000000 --- a/src/Batch/MpiImpl.hxx +++ /dev/null @@ -1,170 +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 -// - -#ifndef _BL_MPIIMPL_H_ -#define _BL_MPIIMPL_H_ - -#include "Batch_Defines.hxx" -#include - -class BATCH_EXPORT MpiImplException -{ -public: - const std::string msg; - - MpiImplException(const std::string m) : msg(m) {} -}; - -class BATCH_EXPORT MpiImpl -{ -public: - // Constructeur et destructeur - MpiImpl(); // constrcuctor - virtual ~MpiImpl(); //Destructor - - virtual std::string size() = 0; // get number of process of current job - virtual std::string rank() = 0; // get process number of current job - virtual std::string boot(const std::string machinefile, const unsigned int nbnodes) = 0; // get boot command - virtual std::string run(const std::string machinefile, const unsigned int nbproc, const std::string fileNameToExecute) = 0; // get run command - virtual std::string halt() = 0; // get stop command - -protected: - -private: - -}; - -class BATCH_EXPORT MpiImpl_LAM : public MpiImpl -{ -public: - // Constructeur et destructeur - MpiImpl_LAM(); // constructor - virtual ~MpiImpl_LAM(); //Destructor - - std::string size(); // get number of process of current job - std::string rank(); // get process number of current job - std::string boot( const std::string machinefile, const unsigned int nbnodes); // get boot command - std::string run( const std::string machinefile, const unsigned int nbproc, const std::string fileNameToExecute); // get run command - std::string halt(); // get stop command - -protected: - -private: - -}; - -class BATCH_EXPORT MpiImpl_MPICH1 : public MpiImpl -{ -public: - // Constructeur et destructeur - MpiImpl_MPICH1(); // constructor - virtual ~MpiImpl_MPICH1(); //Destructor - - std::string size(); // get number of process of current job - std::string rank(); // get process number of current job - std::string boot( const std::string machinefile, const unsigned int nbnodes); // get boot command - std::string run( const std::string machinefile, const unsigned int nbproc, const std::string fileNameToExecute); // get run command - std::string halt(); // get stop command - -protected: - -private: - -}; - -class BATCH_EXPORT MpiImpl_MPICH2 : public MpiImpl -{ -public: - // Constructeur et destructeur - MpiImpl_MPICH2(); // constructor - virtual ~MpiImpl_MPICH2(); //Destructor - - std::string size(); // get number of process of current job - std::string rank(); // get process number of current job - std::string boot( const std::string machinefile, const unsigned int nbnodes); // get boot command - std::string run( const std::string machinefile, const unsigned int nbproc, const std::string fileNameToExecute); // get run command - std::string halt(); // get stop command - -protected: - -private: - -}; - -class BATCH_EXPORT MpiImpl_OPENMPI : public MpiImpl -{ -public: - // Constructeur et destructeur - MpiImpl_OPENMPI(); // constructor - virtual ~MpiImpl_OPENMPI(); //Destructor - - std::string size(); // get number of process of current job - std::string rank(); // get process number of current job - std::string boot( const std::string machinefile, const unsigned int nbnodes); // get boot command - std::string run( const std::string machinefile, const unsigned int nbproc, const std::string fileNameToExecute); // get run command - std::string halt(); // get stop command - -protected: - -private: - -}; - -class BATCH_EXPORT MpiImpl_SLURM : public MpiImpl -{ -public: - // Constructeur et destructeur - MpiImpl_SLURM(); // constructor - virtual ~MpiImpl_SLURM(); //Destructor - - std::string size(); // get number of process of current job - std::string rank(); // get process number of current job - std::string boot( const std::string machinefile, const unsigned int nbnodes); // get boot command - std::string run( const std::string machinefile, const unsigned int nbproc, const std::string fileNameToExecute); // get run command - std::string halt(); // get stop command - -protected: - -private: - -}; - -class BATCH_EXPORT MpiImpl_PRUN : public MpiImpl -{ -public: - // Constructeur et destructeur - MpiImpl_PRUN(); // constructor - virtual ~MpiImpl_PRUN(); //Destructor - - std::string size(); // get number of process of current job - std::string rank(); // get process number of current job - std::string boot( const std::string machinefile, const unsigned int nbnodes); // get boot command - std::string run( const std::string machinefile, const unsigned int nbproc, const std::string fileNameToExecute); // get run command - std::string halt(); // get stop command - -protected: - -private: - -}; - -#endif diff --git a/src/Batch_SWIG/Batch_test.py b/src/Batch_SWIG/Batch_test.py deleted file mode 100644 index 500ef1b04..000000000 --- a/src/Batch_SWIG/Batch_test.py +++ /dev/null @@ -1,74 +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 -# -#Batch_test.py -# pratique -# -import readline -import rlcompleter -readline.parse_and_bind('tab: complete') - -# Importation de la bibliotheque de classes Batch -from libBatch_Swig import * - -def work(): - # Definition d'un job... - job=Job() - # ... de ses parametres ... - p={} - p['EXECUTABLE']='/home/dutka/tmp/job' - p['NAME']='MonJob' - p['OUTFILE']=[('/tmp/stdout', 'stdout'), ('/tmp/stderr', 'stderr')] - job.setParametre(p) - # ... et de son environnement - job.setEnvironnement({}) - print job - - # Appel au catalogue de BatchManager pour accéder au serveur cli70cu - # Instanciation du catalogue (quasi-singleton) - c=BatchManagerCatalog() - # Instanciation d'une Factory de BatchManager de type 'PBS' - # fbm=c('PBS') - - # Creation d'un BatchManager de type PBS sur le serveur cli70cu - bm=c('PBS')('cli70cu') - - # Soumission du job au BatchManager - jobid=bm.submitJob(job) - print jobid - - # Interrogation de l'etat du job - jobid.queryJob() - - # On attend que le job soit termine - try: - while 1: jinfo = jobid.queryJob() - except: - print "Job", jobid, "is done" - - pass - -if __name__ == "__main__": - work() - pass - - - diff --git a/src/Batch_SWIG/Makefile.am b/src/Batch_SWIG/Makefile.am deleted file mode 100644 index 2d18ed2e0..000000000 --- a/src/Batch_SWIG/Makefile.am +++ /dev/null @@ -1,91 +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 -# -# File : Makefile.am -# Author : Guillaume Boulant (CSSI) -# Module : KERNEL -# $Header$ -# -include $(top_srcdir)/salome_adm/unix/make_common_starter.am - -# -# =============================================================== -# Swig targets -# =============================================================== -# (cf. http://www.geocities.com/foetsch/python/swig_linux.htm) -# -# Step 1: build the wrapping source files with swig -# -# libBatch_Swig.i -- swig --> swig_wrap.cpp -# libBatch_Swig.py -# -# Step 2: build the dynamic library from cpp built source files and -# dependant libraries. -# -# swig_wrap.cpp -- gcc --> swig_wrap.o |-- link --> _libBatch_Swig.la -# + | -# dependant libs | -# -# The file libBatch_Swig.py will be installed in -# /lib/python/site-package/salome. -# The library will be installed in the common place. -# - -BUILT_SOURCES = swig_wrap.cpp libBatch_Swig.py - -SWIG_FLAGS = @SWIG_FLAGS@ -I$(srcdir) -I$(srcdir)/../Batch -SWIGSOURCES = libBatch_Swig.i libBatch_Swig_exception.i libBatch_Swig_typemap.i - -salomepython_PYTHON = libBatch_Swig.py -salomepyexec_LTLIBRARIES = _libBatch_Swig.la -_libBatch_Swig_la_SOURCES = swig_wrap.cpp -_libBatch_Swig_la_CPPFLAGS = @PYTHON_INCLUDES@ -I$(srcdir) -I$(srcdir)/../Batch -_libBatch_Swig_la_LDFLAGS = -module -_libBatch_Swig_la_LIBADD = ../Batch/libSalomeBatch.la @PYTHON_LIBS@ - -if WITH_OPENPBS -_libBatch_Swig_la_CPPFLAGS += @OPENPBS_INCLUDES@ -_libBatch_Swig_la_LIBADD += @OPENPBS_LIBDIR@ @OPENPBS_LIBS@ -endif - -swig_wrap.cpp libBatch_Swig.py : $(SWIGSOURCES) - $(SWIG) $(SWIG_FLAGS) -o swig_wrap.cpp $< - -CLEANFILES = swig_wrap.cpp - -EXTRA_DIST = $(SWIGSOURCES) - -# -# =============================================================== -# Files to be installed -# =============================================================== -# - -# Scripts to be installed. -dist_salomescript_PYTHON = Batch_test.py - -# You don't need to specify libBatch_Swig.py. It is automatically -# installed by means of the swig target salomepython_PYTHON. - -install-data-hook: - @for f in $(dist_salomescript_PYTHON) ; do \ - chmod -f a+x $(DESTDIR)$(salomescriptdir)/$$f ; \ - done diff --git a/src/Batch_SWIG/libBatch_Swig.i b/src/Batch_SWIG/libBatch_Swig.i deleted file mode 100644 index fc610e787..000000000 --- a/src/Batch_SWIG/libBatch_Swig.i +++ /dev/null @@ -1,84 +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 -// -/* - * libBatch_Swig.i : - * - * Auteur : Ivan DUTKA-MALEN - EDF R&D - * Date : Septembre 2003 - * Projet : SALOME 2 - * - */ - -/* ATTENTION: - ========== - Certaines classes ont des methodes surchargees et SWIG ne gere pas bien - ces surcharges, d'ou un probleme d'utilisation en Python de celles-ci. - En bref, ça ne marche pas et il faudra corriger le probleme... - - TODO : corriger le probleme de surcharge des methodes en Python - - IDM. -*/ - - -/* Le nom du module Python tel qu'il est importe */ -%module libBatch_Swig - -/* generate docstrings with types */ -%feature("autodoc", "1"); - -/* Inclusion des conversions de type */ -%include libBatch_Swig_typemap.i - -/* Inclusion de la gestion des exceptions */ -%include libBatch_Swig_exception.i - -%{ -#include "Batch_Defines.hxx" -#include "Batch_Job.hxx" -#include "Batch_JobId.hxx" -#include "Batch_JobInfo.hxx" - -#include "Batch_BatchManager.hxx" -#include "Batch_BatchManagerCatalog.hxx" -#include "Batch_FactBatchManager.hxx" -%} - -/* Les classes exportees en Python */ -%include Batch_Defines.hxx -%include Batch_Job.hxx -%include Batch_JobId.hxx -%include Batch_JobInfo.hxx - -%include Batch_BatchManager.hxx -%include Batch_BatchManagerCatalog.hxx -%include Batch_FactBatchManager.hxx - - - -/* Les methodes alterJob (surchargees et mal gerees en Python) sont - remplacees par des methodes setParametre et setEnvironnement. - cf. remarque ci-dessus. -*/ -%ignore JobId::alterJob(const Parametre & param, const Environnement & env) const; -%ignore JobId::alterJob(const Parametre & param) const; -%ignore JobId::alterJob(const Environnement & env) const; diff --git a/src/Batch_SWIG/libBatch_Swig_exception.i b/src/Batch_SWIG/libBatch_Swig_exception.i deleted file mode 100644 index 03c2b0e44..000000000 --- a/src/Batch_SWIG/libBatch_Swig_exception.i +++ /dev/null @@ -1,45 +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 -// -/* - * _exception.i : - * - * Auteur : Ivan DUTKA-MALEN - EDF R&D - * Date : Septembre 2003 - * Projet : SALOME 2 - * - */ - -%exception { - try { - $action - } - catch (Batch::GenericException & ex) { - std::string msg = ex.type + " : " + ex.message; - PyErr_SetString(PyExc_RuntimeWarning, msg.c_str()); - return NULL; - } - catch (...) { - PyErr_SetString(PyExc_RuntimeWarning, "unknown exception"); - return NULL; - } -} - diff --git a/src/Batch_SWIG/libBatch_Swig_typemap.i b/src/Batch_SWIG/libBatch_Swig_typemap.i deleted file mode 100644 index 6b2a01123..000000000 --- a/src/Batch_SWIG/libBatch_Swig_typemap.i +++ /dev/null @@ -1,247 +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 -// -/* - * _typemap.i : - * - * Auteur : Ivan DUTKA-MALEN - EDF R&D - * Date : Septembre 2003 - * Projet : SALOME 2 - * - */ - -%{ -#include -#include -#include -#include "Batch_Parametre.hxx" -#include "Batch_PyVersatile.hxx" -#include "Batch_JobId.hxx" -#include "Batch_FactBatchManager.hxx" -#if PY_VERSION_HEX < 0x02050000 && !defined(PY_SSIZE_T_MIN) -typedef int Py_ssize_t; -#define PY_SSIZE_T_MAX INT_MAX -#define PY_SSIZE_T_MIN INT_MIN -#endif -%} - -# // supprime toutes les definitions par defaut => sert au debug -# %typemap(in) SWIGTYPE ; - - -# // construction d'un dictionnaire Python a partir d'un objet BatchManagerCatalog C++ -%typemap(out) std::map * -{ - $result = PyDict_New(); - - // on itere sur toutes les clefs de la map - for(std::map::const_iterator it=(* $1).begin(); it!=(* $1).end(); it++) { - std::string key = (*it).first; - PyObject * obj = SWIG_NewPointerObj((void *) (*it).second, SWIGTYPE_p_Batch__FactBatchManager, 0); - PyDict_SetItem($result, PyString_FromString(key.c_str()), obj); - } -} - -%typemap(typecheck,precedence=SWIG_TYPECHECK_POINTER) Batch::Parametre -{ - $1 = PyDict_Check($input)? 1 : 0; -} - -# // construction d'un dictionnaire Python a partir d'un objet Parametre C++ -%typemap(out) Batch::Parametre -{ - $result = PyDict_New(); - - // on itere sur toutes les clefs de la map, et on passe par la classe PyVersatile - // qui convertit un Versatile en PyObject et vice versa - for(Batch::Parametre::const_iterator it=$1.begin(); it!=$1.end(); it++) { - std::string key = (*it).first; - Batch::PyVersatile PyV = (*it).second; - PyDict_SetItem($result, PyString_FromString(key.c_str()), PyV); - } -} - - -# // construction d'un objet Parametre C++ a partir d'un dictionnaire Python -%typemap(in) Batch::Parametre & (Batch::Parametre PM) -{ - if (!PyDict_Check($input)) { - PyErr_SetString(PyExc_ValueError,"Expected a dictionnary"); - return NULL; - } - - try { - // on itere sur toutes les clefs du dictionnaire, et on passe par la classe PyVersatile - // qui convertit un Versatile en PyObject et vice versa - PyObject *key, *value; - Py_ssize_t pos = 0; - while (PyDict_Next($input, &pos, &key, &value)) { - std::string mk = PyString_AsString(key); - Batch::PyVersatile PyV = value; - PyV.setName(mk); - PM[mk] = PyV; - } - - $1 = &PM; // $1 est une reference donc on lui passe une adresse - } - catch (Batch::GenericException & ex) { - std::string msg = ex.type + " : " + ex.message; - PyErr_SetString(PyExc_RuntimeWarning, msg.c_str()); - return NULL; - } - catch (...) { - PyErr_SetString(PyExc_RuntimeWarning, "unknown exception"); - return NULL; - } -} - - -# // construction d'un objet Parametre C++ a partir d'un dictionnaire Python -%typemap(in) Batch::Parametre (Batch::Parametre PM) -{ - if (!PyDict_Check($input)) { - PyErr_SetString(PyExc_ValueError,"Expected a dictionnary"); - return NULL; - } - - try { - // on itere sur toutes les clefs du dictionnaire, et on passe par la classe PyVersatile - // qui convertit un Versatile en PyObject et vice versa - PyObject *key, *value; - Py_ssize_t pos = 0; - while (PyDict_Next($input, &pos, &key, &value)) { - std::string mk = PyString_AsString(key); - Batch::PyVersatile PyV = value; - PyV.setName(mk); - PM[mk] = PyV; - } - - $1 = PM; - } - catch (Batch::GenericException & ex) { - std::string msg = ex.type + " : " + ex.message; - PyErr_SetString(PyExc_RuntimeWarning, msg.c_str()); - return NULL; - } - catch (...) { - PyErr_SetString(PyExc_RuntimeWarning, "unknown exception"); - return NULL; - } -} - -%typemap(typecheck,precedence=SWIG_TYPECHECK_POINTER) Batch::Environnement -{ - $1 = PyDict_Check($input)? 1 : 0; -} - -# // construction d'un dictionnaire Python a partir d'un objet Environnement C++ -%typemap(out) Batch::Environnement -{ - $result = PyDict_New(); - - // on itere sur toutes les clefs de la map - for(Batch::Environnement::const_iterator it=$1.begin(); it!=$1.end(); it++) { - std::string key = (*it).first; - std::string val = (*it).second; - PyDict_SetItem($result, - PyString_FromString(key.c_str()), - PyString_FromString(val.c_str())); - } -} - - -# // construction d'un objet Environnement C++ a partir d'un dictionnaire Python -%typemap(in) Batch::Environnement & (Batch::Environnement E) -{ - if (!PyDict_Check($input)) { - PyErr_SetString(PyExc_ValueError,"Expected a dictionnary"); - return NULL; - } - - // on itere sur toutes les clefs du dictionnaire - PyObject *key, *value; - Py_ssize_t pos = 0; - while (PyDict_Next($input, &pos, &key, &value)) { - std::string mk = PyString_AsString(key); - std::string val = PyString_AsString(value); - E[mk] = val; - } - - $1 = &E; // $1 est une reference donc on lui passe une adresse -} - - - -# // construction d'un objet Environnement C++ a partir d'un dictionnaire Python -%typemap(in) Batch::Environnement (Batch::Environnement E) -{ - if (!PyDict_Check($input)) { - PyErr_SetString(PyExc_ValueError,"Expected a dictionnary"); - return NULL; - } - - // on itere sur toutes les clefs du dictionnaire - PyObject *key, *value; - Py_ssize_t pos = 0; - while (PyDict_Next($input, &pos, &key, &value)) { - std::string mk = PyString_AsString(key); - std::string val = PyString_AsString(value); - E[mk] = val; - } - - $1 = E; -} - - - -# // construction d'une string Python a partir d'une string STL -%typemap(python,out) std::string -{ - $result = PyString_FromString($1.c_str()); -} - - - -# // construction d'une string STL a partir d'une string Python -#%typemap(in) string & (string S) -#{ -## if (!PyString_Check($input)) { -# PyErr_SetString(PyExc_ValueError,"Expected a string"); -# return NULL; -# } -# -# S = string(PyString_AsString($input)); -# $1 = &S; // $1 est une reference donc on lui passe une adresse -#} - - - -# // construction d'une string STL a partir d'une string Python -#%typemap(in) string (string S) -#{ -## if (!PyString_Check($input)) { -# PyErr_SetString(PyExc_ValueError,"Expected a string"); -# return NULL; -# } -# -# S = string(PyString_AsString($input)); -# $1 = S; -#} diff --git a/src/Container/Makefile.am b/src/Container/Makefile.am index a80fc288e..331023d77 100644 --- a/src/Container/Makefile.am +++ b/src/Container/Makefile.am @@ -62,7 +62,6 @@ dist_salomescript_SCRIPTS=\ COMMON_CPPFLAGS=\ @PYTHON_INCLUDES@ \ @HDF5_INCLUDES@ \ - -I$(srcdir)/../Batch \ -I$(srcdir)/../Basics \ -I$(srcdir)/../SALOMELocalTrace \ -I$(srcdir)/../NamingService \ @@ -85,7 +84,6 @@ COMMON_LIBS =\ ../SALOMELocalTrace/libSALOMELocalTrace.la \ ../Basics/libSALOMEBasics.la \ ../HDFPersist/libSalomeHDFPersist.la \ - ../Batch/libSalomeBatch.la \ $(top_builddir)/idl/libSalomeIDLKernel.la \ @CORBA_LIBS@ \ $(PYTHON_LIBS) diff --git a/src/Container/SALOME_ContainerManager.cxx b/src/Container/SALOME_ContainerManager.cxx index d1e401c85..8afbc5f2f 100644 --- a/src/Container/SALOME_ContainerManager.cxx +++ b/src/Container/SALOME_ContainerManager.cxx @@ -31,7 +31,6 @@ #endif #include #include "Utils_CorbaException.hxx" -#include "Batch_Date.hxx" #include #ifdef WITH_PACO_PARALLEL diff --git a/src/Launcher/BatchTest.cxx b/src/Launcher/BatchTest.cxx index 727cedc5f..bf0e88e64 100644 --- a/src/Launcher/BatchTest.cxx +++ b/src/Launcher/BatchTest.cxx @@ -21,8 +21,8 @@ // #include "BatchTest.hxx" -#include "Batch_Date.hxx" -#include "MpiImpl.hxx" +#include +#include #include "utilities.h" #include diff --git a/src/Launcher/Launcher.cxx b/src/Launcher/Launcher.cxx index b6a6ea2ca..9cdd800a4 100644 --- a/src/Launcher/Launcher.cxx +++ b/src/Launcher/Launcher.cxx @@ -19,13 +19,12 @@ // // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // -#include "Launcher.hxx" -#include "Batch_Date.hxx" -#include "Batch_FactBatchManager_eLSF.hxx" -#include "Batch_FactBatchManager_ePBS.hxx" -#include "Batch_BatchManager_eClient.hxx" -#include "Batch_FactBatchManager_eSGE.hxx" +#include +#include +#include +#include +#include #include "SALOME_Launcher_Handler.hxx" #include "Launcher.hxx" #include @@ -171,7 +170,7 @@ long Launcher_cpp::submitJob( const std::string xmlExecuteFile, _jobmap[ pair(cname,jobId) ] = job; } catch(const Batch::EmulationException &ex){ - throw LauncherException(ex.msg.c_str()); + throw LauncherException(ex.message.c_str()); } return jobId; @@ -276,7 +275,7 @@ long Launcher_cpp::submitSalomeJob( const string fileToExecute , _jobmap[ pair(clustername,jobId) ] = job; } catch(const Batch::EmulationException &ex){ - throw LauncherException(ex.msg.c_str()); + throw LauncherException(ex.message.c_str()); } return jobId; @@ -315,7 +314,7 @@ string Launcher_cpp::queryJob( long id, par = jinfo.getParametre(); } catch(const Batch::EmulationException &ex){ - throw LauncherException(ex.msg.c_str()); + throw LauncherException(ex.message.c_str()); } return par[STATE]; @@ -413,16 +412,17 @@ void Launcher_cpp::getResultsJob( const std::string directory, Batch::BatchManager_eClient *Launcher_cpp::FactoryBatchManager( const ParserResourcesType& params ) throw(LauncherException) { - std::string hostname, protocol, mpi; + std::string hostname, mpi; + Batch::CommunicationProtocolType protocol; Batch::FactBatchManager_eClient* fact; hostname = params.Alias; switch(params.Protocol){ case rsh: - protocol = "rsh"; + protocol = Batch::RSH; break; case ssh: - protocol = "ssh"; + protocol = Batch::SSH; break; default: throw LauncherException("unknown protocol"); @@ -482,7 +482,7 @@ Batch::BatchManager_eClient *Launcher_cpp::FactoryBatchManager( const ParserReso #endif throw LauncherException("no batchmanager for that cluster"); } - return (*fact)(hostname.c_str(),protocol.c_str(),mpi.c_str()); + return (*fact)(hostname.c_str(), protocol, mpi.c_str()); } string Launcher_cpp::buildSalomeCouplingScript(const string fileToExecute, const string dirForTmpFiles, const ParserResourcesType& params) diff --git a/src/Launcher/Makefile.am b/src/Launcher/Makefile.am index 574c04b33..d3e94733e 100644 --- a/src/Launcher/Makefile.am +++ b/src/Launcher/Makefile.am @@ -52,7 +52,7 @@ COMMON_CPPFLAGS=\ @PYTHON_INCLUDES@ \ @MPI_INCLUDES@ \ @LIBXML_INCLUDES@ \ - -I$(srcdir)/../Batch \ + @LIBBATCH_INCLUDES@ \ -I$(srcdir)/../Basics \ -I$(srcdir)/../SALOMELocalTrace \ -I$(srcdir)/../NamingService \ @@ -74,8 +74,8 @@ COMMON_LIBS =\ ../Utils/libOpUtil.la \ ../SALOMELocalTrace/libSALOMELocalTrace.la \ ../Basics/libSALOMEBasics.la \ - ../Batch/libSalomeBatch.la \ $(top_builddir)/idl/libSalomeIDLKernel.la \ + @LIBBATCH_LIBS@ \ @MPI_LIBS@ \ @CORBA_LIBS@ \ @LIBXML_LIBS@ \ @@ -111,8 +111,8 @@ libLauncher_la_SOURCES=\ Launcher.cxx libLauncher_la_CPPFLAGS =\ - -I$(srcdir)/../Batch \ -I$(srcdir)/../ResourcesManager \ + @LIBBATCH_INCLUDES@ \ @MPI_INCLUDES@ \ @LIBXML_INCLUDES@ @@ -121,8 +121,8 @@ libLauncher_la_LDFLAGS =\ @LDEXPDYNFLAGS@ libLauncher_la_LIBADD =\ - ../Batch/libSalomeBatch.la \ ../ResourcesManager/libResourcesManager.la \ + @LIBBATCH_LIBS@ \ @MPI_LIBS@ \ @LIBXML_LIBS@ @@ -144,6 +144,7 @@ SALOME_LauncherServer_CPPFLAGS=\ SALOME_LauncherServer_LDADD =\ libSalomeLauncher.la \ ../Basics/libSALOMEBasics.la \ + $(LIBBATCH_LIBS) \ $(MPI_LIBS) \ $(CORBA_LIBS) \ $(LIBXML_LIBS) \ diff --git a/src/Makefile.am b/src/Makefile.am index 32cf716f6..44deb4332 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -77,10 +77,6 @@ SUBDIR_MPI = \ MPIContainer \ TestMPIContainer -SUBDIR_BATCH= \ - Batch \ - Batch_SWIG - SUBDIR_PARALLEL= ParallelContainer @@ -89,7 +85,6 @@ DIST_SUBDIRS = \ $(SUBDIR_CORBA) \ $(SUBDIR_MPI) \ $(SUBDIR_PARALLEL) \ - $(SUBDIR_BATCH) \ $(SUBDIR_CPPUNIT_BASE) \ $(SUBDIR_CPPUNIT_CORBA) \ $(SUBDIR_CPPUNIT_GENERAL) @@ -101,15 +96,11 @@ DIST_SUBDIRS = \ # if WITHONLYLAUNCHER - SUBDIRS = Basics Batch Batch_SWIG ResourcesManager Launcher + SUBDIRS = Basics ResourcesManager Launcher else SUBDIRS = $(SUBDIR_BASE) -if WITH_BATCH - SUBDIRS += $(SUBDIR_BATCH) -endif - if CORBA_GEN SUBDIRS += $(SUBDIR_CORBA) endif -- 2.39.2