]> SALOME platform Git repositories - modules/kernel.git/blob - src/Launcher/Launcher.hxx
Salome HOME
merge from branch BR_V511_PR 15 12 2009
[modules/kernel.git] / src / Launcher / Launcher.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 #ifndef __LAUNCHER_HXX__
23 #define __LAUNCHER_HXX__
24
25 #include "Launcher_Utils.hxx"
26 #include "Launcher_Job.hxx"
27
28 #include "ResourcesManager.hxx"
29 #include <SALOME_ResourcesCatalog_Parser.hxx>
30
31 #include "SALOME_Launcher_Parser.hxx"
32
33 #include <string>
34 #include <vector>
35
36 #include <pthread.h>
37
38 class MpiImpl;
39
40 namespace Batch{
41   class BatchManager_eClient;
42   class Job;
43 }
44
45 struct batchParams{
46   std::string batch_directory;
47   std::string expected_during_time;
48   std::string mem;
49   unsigned long nb_proc;
50 };
51
52 class LAUNCHER_EXPORT Launcher_cpp
53 {
54
55 public:
56   Launcher_cpp();
57   ~Launcher_cpp();
58
59   // Main interface
60   void         createJob(Launcher::Job * new_job);
61   void         launchJob(int job_id);
62   const char * getJobState(int job_id);
63   void         getJobResults(int job_id, std::string directory);
64   void         removeJob(int job_id);
65
66   // Useful methods
67   long createJobWithFile(std::string xmlExecuteFile, std::string clusterName);
68
69   // Lib methods
70   void SetResourcesManager( ResourcesManager_cpp* rm ) {_ResManager = rm;}
71
72 protected:
73
74   // Methods used by user interface methods
75 #ifdef WITH_LIBBATCH
76   Batch::BatchManager_eClient *FactoryBatchManager(ParserResourcesType& params);
77   std::map <std::string,Batch::BatchManager_eClient*> _batchmap;
78 #endif
79   ParserLauncherType ParseXmlFile(std::string xmlExecuteFile);
80
81   ResourcesManager_cpp *_ResManager;
82   std::map <int, Launcher::Job *> _launcher_job_map;  
83   int _job_cpt; // job number counter
84   pthread_mutex_t * _job_cpt_mutex; // mutex for job counter
85 };
86
87 #endif