Salome HOME
Removed CASCatch
[modules/kernel.git] / src / Batch / BatchLight_BatchManager.hxx
1 // Copyright (C) 2005  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
2 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
3 // 
4 // This library is free software; you can redistribute it and/or
5 // modify it under the terms of the GNU Lesser General Public
6 // License as published by the Free Software Foundation; either 
7 // version 2.1 of the License.
8 // 
9 // This library is distributed in the hope that it will be useful 
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of 
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU 
12 // Lesser General Public License for more details.
13 //
14 // You should have received a copy of the GNU Lesser General Public  
15 // License along with this library; if not, write to the Free Software 
16 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
17 //
18 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
19 //
20 /*
21  * BatchManager.hxx : 
22  *
23  * Auteur : Bernard SECHER - CEA/DEN
24  * Date   : Juillet 2007
25  * Projet : SALOME
26  *
27  */
28
29 #ifndef _BL_BATCHMANAGER_H_
30 #define _BL_BATCHMANAGER_H_
31
32 #include <vector>
33 #include <map>
34 #include <string>
35 #include "Utils_SALOME_Exception.hxx"
36 #include <SALOMEconfig.h>
37 #include <stdlib.h>
38 #include CORBA_CLIENT_HEADER(SALOME_ContainerManager)
39 #include "MpiImpl.hxx"
40
41 namespace BatchLight {
42
43   class Job;
44
45   struct batchParams{
46     std::string hostname; // serveur ou tourne le BatchManager
47     std::string protocol; // protocole d'acces au serveur: ssh ou rsh
48     std::string username; // username d'acces au serveur
49     std::string applipath; // path of apllication directory on server
50     std::vector<std::string> modulesList; // list of Salome modules installed on server
51     unsigned int nbnodes; // number of nodes on cluster
52     unsigned int nbprocpernode; // number of processors on each node
53     std::string mpiImpl; // mpi implementation
54   };
55
56   class BatchManager
57   {
58   public:
59     // Constructeur et destructeur
60     BatchManager(const batchParams& p) throw(SALOME_Exception); // connexion a la machine host
61     virtual ~BatchManager();
62
63     // Methodes pour le controle des jobs : virtuelles pures
64     const int submitJob(BatchLight::Job* job); // soumet un job au gestionnaire
65     virtual void deleteJob(const int & jobid) = 0; // retire un job du gestionnaire
66     virtual std::string queryJob(const int & jobid) = 0; // renvoie l'etat du job
67     void importOutputFiles( const char *directory, const CORBA::Long jobId ) throw(SALOME_Exception);
68
69   protected:
70     batchParams _params;
71     MpiImpl *_mpiImpl;
72
73     std::map <int,const BatchLight::Job *> _jobmap;
74     std::string _dirForTmpFiles; // repertoire temporaire sur le serveur
75     std::string _TmpFileName;
76     std::string _fileNameToExecute;
77
78     virtual int submit() throw(SALOME_Exception) = 0;
79     void setDirForTmpFiles();
80     void exportInputFiles( const char *fileToExecute, const Engines::FilesList filesToExportList ) throw(SALOME_Exception);
81     virtual void buildSalomeCouplingScript( const char *fileToExecute ) throw(SALOME_Exception) = 0;
82     virtual void buildSalomeBatchScript( const int nbproc ) throw(SALOME_Exception) = 0;
83
84     std::string BuildTemporaryFileName() const;
85     void RmTmpFile();
86     MpiImpl *FactoryMpiImpl(std::string mpiImpl) throw(SALOME_Exception);
87
88   private:
89
90   };
91
92 }
93
94 #endif