]> SALOME platform Git repositories - modules/kernel.git/blob - src/Launcher/Launcher.hxx
Salome HOME
Porting functionality on Win32 Platform
[modules/kernel.git] / src / Launcher / Launcher.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 #ifndef __LAUNCHER_HXX__
21 #define __LAUNCHER_HXX__
22
23 #ifdef WIN32
24 # ifdef LAUNCHER_EXPORTS
25 #  define LAUNCHER_EXPORT __declspec(dllexport)
26 # else
27 #  define LAUNCHER_EXPORT __declspec(dllimport)
28 # endif
29 #else
30 # define LAUNCHER_EXPORT
31 #endif
32
33 #include <SALOME_ResourcesCatalog_Parser.hxx>
34 #include "ResourcesManager.hxx"
35
36 #include <string>
37 #include <vector>
38
39 class MpiImpl;
40
41 namespace Batch{
42   class BatchManager_eClient;
43   class Job;
44 }
45
46 struct batchParams{
47   std::string batch_directory;
48   std::string expected_during_time;
49   std::string mem;
50   unsigned long nb_proc;
51 };
52
53 class LAUNCHER_EXPORT LauncherException
54 {
55 public:
56   const std::string msg;
57
58   LauncherException(const std::string m) : msg(m) {}
59 };
60
61 class LAUNCHER_EXPORT Launcher_cpp
62 {
63
64 public:
65   Launcher_cpp();
66   ~Launcher_cpp();
67
68   long submitSalomeJob(const std::string fileToExecute ,
69                        const std::vector<std::string>& filesToExport ,
70                        const std::vector<std::string>& filesToImport ,
71                        const batchParams& batch_params,
72                        const machineParams& params) throw(LauncherException);
73
74   std::string querySalomeJob( const long jobId, const machineParams& params) throw(LauncherException);
75   void deleteSalomeJob( const long jobId, const machineParams& params) throw(LauncherException);
76   void getResultSalomeJob( const std::string directory, const long jobId, const machineParams& params ) throw(LauncherException);
77
78   void SetResourcesManager( ResourcesManager_cpp* rm ) { _ResManager = rm; }
79
80 protected:
81
82   std::string buildSalomeCouplingScript(const std::string fileToExecute, const std::string dirForTmpFiles, const ParserResourcesType& params);
83   MpiImpl *FactoryMpiImpl(MpiImplType mpiImpl) throw(LauncherException);
84   Batch::BatchManager_eClient *FactoryBatchManager( const ParserResourcesType& params ) throw(LauncherException);
85   std::string getTmpDirForBatchFiles();
86   std::string getRemoteFile( std::string remoteDir, std::string localFile );
87   std::string getHomeDir(const ParserResourcesType& p, const std::string & tmpdir);  
88
89   std::map <std::string,Batch::BatchManager_eClient*> _batchmap;
90   std::map < std::pair<std::string,long> , Batch::Job* > _jobmap;
91   ResourcesManager_cpp *_ResManager;
92   bool check(const batchParams& batch_params);
93   long getWallTime(std::string edt);
94   long getRamSize(std::string mem);
95 };
96
97 #endif