Salome HOME
Initial import: adding files
[tools/libbatch.git] / src / SGE / Batch_BatchManager_eSGE.hxx
1 //  Copyright (C) 2007-2008  CEA/DEN, EDF R&D, OPEN CASCADE
2 //
3 //  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 //  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
5 //
6 //  This library is free software; you can redistribute it and/or
7 //  modify it under the terms of the GNU Lesser General Public
8 //  License as published by the Free Software Foundation; either
9 //  version 2.1 of the License.
10 //
11 //  This library is distributed in the hope that it will be useful,
12 //  but WITHOUT ANY WARRANTY; without even the implied warranty of
13 //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14 //  Lesser General Public License for more details.
15 //
16 //  You should have received a copy of the GNU Lesser General Public
17 //  License along with this library; if not, write to the Free Software
18 //  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
19 //
20 //  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
21 //
22 /*
23  * BatchManager_eSGE.hxx : emulation of SGE client
24  *
25  * Auteur : Bernard SECHER - CEA DEN
26  * Mail   : mailto:bernard.secher@cea.fr
27  * Date   : Thu Apr 24 10:17:22 2008
28  * Projet : PAL Salome
29  *
30  */
31
32 #ifndef _BATCHMANAGER_eLSF_H_
33 #define _BATCHMANAGER_eLSF_H_
34
35 #include "Batch_Defines.hxx"
36 #include "Batch_JobId.hxx"
37 #include "Batch_JobInfo.hxx"
38 #include "Batch_JobInfo_eSGE.hxx"
39 #include "Batch_InvalidArgumentException.hxx"
40 #include "Batch_ConnexionFailureException.hxx"
41 #include "Batch_APIInternalFailureException.hxx"
42 #include "Batch_NotYetImplementedException.hxx"
43 #include "Batch_BatchManager.hxx"
44 #include "Batch_BatchManager_eClient.hxx"
45
46 namespace Batch {
47
48   class Job;
49   class JobId;
50   class JobInfo;
51   class FactBatchManager;
52
53   class BATCH_EXPORT BatchManager_eSGE : public BatchManager_eClient
54   {
55   public:
56     // Constructeur et destructeur
57     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
58     virtual ~BatchManager_eSGE();
59
60     // Recupere le nom du serveur par defaut
61     // static string BatchManager_LSF::getDefaultServer();
62
63     // Methodes pour le controle des jobs
64     virtual const JobId submitJob(const Job & job); // soumet un job au gestionnaire
65     virtual void deleteJob(const JobId & jobid); // retire un job du gestionnaire
66     virtual void holdJob(const JobId & jobid); // suspend un job en file d'attente
67     virtual void releaseJob(const JobId & jobid); // relache un job suspendu
68     virtual void alterJob(const JobId & jobid, const Parametre & param, const Environnement & env); // modifie un job en file d'attente
69     virtual void alterJob(const JobId & jobid, const Parametre & param); // modifie un job en file d'attente
70     virtual void alterJob(const JobId & jobid, const Environnement & env); // modifie un job en file d'attente
71     virtual JobInfo queryJob(const JobId & jobid); // renvoie l'etat du job
72     virtual bool isRunning(const JobId & jobid); // teste si un job est present en machine
73
74     virtual void setParametre(const JobId & jobid, const Parametre & param) { return alterJob(jobid, param); } // modifie un job en file d'attente
75     virtual void setEnvironnement(const JobId & jobid, const Environnement & env) { return alterJob(jobid, env); } // modifie un job en file d'attente
76
77
78   protected:
79     void buildBatchScript(const Job & job);
80     std::string getWallTime(const long edt);
81
82   private:
83
84 #ifdef SWIG
85   public:
86     // Recupere le l'identifiant d'un job deja soumis au BatchManager
87     //virtual const JobId getJobIdByReference(const string & ref) { return BatchManager::getJobIdByReference(ref); }
88     virtual const JobId getJobIdByReference(const char * ref) { return BatchManager::getJobIdByReference(ref); }
89 #endif
90
91   };
92
93 }
94
95 #endif