Salome HOME
Changed year in copyrights
[tools/libbatch.git] / src / Core / Batch_BatchManager.hxx
1 //  Copyright (C) 2007-2011  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.hxx : 
24  *
25  * Auteur : Ivan DUTKA-MALEN - EDF R&D
26  * Date   : Septembre 2003
27  * Projet : SALOME 2
28  *
29  */
30
31 #ifndef _BATCHMANAGER_H_
32 #define _BATCHMANAGER_H_
33
34 #include "Batch_Defines.hxx"
35
36 #include <string>
37 #include <map>
38 #include "Batch_Job.hxx"
39 #include "Batch_JobId.hxx"
40 #include "Batch_JobInfo.hxx"
41 #include "Batch_InvalidArgumentException.hxx"
42
43 namespace Batch {
44
45   class Job;
46   class JobId;
47   class JobInfo;
48   class FactBatchManager;
49
50   class BATCH_EXPORT BatchManager
51   {
52   public:
53     // Constructeur et destructeur
54     //BatchManager(std::string host="localhost") throw(InvalidArgumentException); // connexion a la machine host
55     BatchManager(const Batch::FactBatchManager * parent, const char * host="localhost") throw(InvalidArgumentException); // connexion a la machine host
56     virtual ~BatchManager();
57     virtual std::string __repr__() const;
58
59     // Recupere le l'identifiant d'un job deja soumis au BatchManager
60     //virtual const JobId getJobIdByReference(const std::string & ref);
61     virtual const Batch::JobId getJobIdByReference(const char * ref);
62
63     // Methodes pour le controle des jobs : virtuelles pures
64     virtual const Batch::JobId submitJob(const Batch::Job & job) = 0; // soumet un job au gestionnaire
65     virtual void deleteJob(const Batch::JobId & jobid) = 0; // retire un job du gestionnaire
66     virtual void holdJob(const Batch::JobId & jobid) = 0; // suspend un job en file d'attente
67     virtual void releaseJob(const Batch::JobId & jobid) = 0; // relache un job suspendu
68     virtual void alterJob(const Batch::JobId & jobid, const Batch::Parametre & param, const Batch::Environnement & env) = 0; // modifie un job en file d'attente
69     virtual void alterJob(const Batch::JobId & jobid, const Batch::Parametre & param) = 0; // modifie un job en file d'attente
70     virtual void alterJob(const Batch::JobId & jobid, const Batch::Environnement & env) = 0; // modifie un job en file d'attente
71     virtual Batch::JobInfo queryJob(const Batch::JobId & jobid) = 0; // renvoie l'etat du job
72     virtual const Batch::JobId addJob(const Batch::Job & job, const std::string reference) = 0; // ajoute un nouveau job sans le soumettre
73     virtual std::string waitForJobEnd(const Batch::JobId & jobid, long timeout = -1,
74                                       long initSleepTime = 1, long maxSleepTime = 600);
75
76   protected:
77     std::string _hostname; // serveur ou tourne le BatchManager
78     // std::map< const std::string, const Batch::JobId * > jobid_map; // table des jobs deja soumis
79     std::map< std::string, const Batch::JobId * > jobid_map; // table des jobs deja soumis
80     const Batch::FactBatchManager * _parent;
81
82   private:
83
84   };
85
86 }
87
88 #endif