1 // Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
3 // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
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.
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.
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
20 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
22 #ifndef __LAUNCHER_HXX__
23 #define __LAUNCHER_HXX__
26 # if defined LAUNCHER_EXPORTS || defined Launcher_EXPORTS
27 # define LAUNCHER_EXPORT __declspec(dllexport)
29 # define LAUNCHER_EXPORT __declspec(dllimport)
32 # define LAUNCHER_EXPORT
35 #include <SALOME_ResourcesCatalog_Parser.hxx>
36 #include "ResourcesManager.hxx"
37 #include "SALOME_Launcher_Parser.hxx"
45 class BatchManager_eClient;
50 std::string batch_directory;
51 std::string expected_during_time;
53 unsigned long nb_proc;
56 class LAUNCHER_EXPORT LauncherException
59 const std::string msg;
61 LauncherException(const std::string m) : msg(m) {}
64 class LAUNCHER_EXPORT Launcher_cpp
71 long submitJob(const std::string xmlExecuteFile,
72 const std::string clusterName) throw(LauncherException);
74 long submitSalomeJob(const std::string fileToExecute ,
75 const std::vector<std::string>& filesToExport ,
76 const std::vector<std::string>& filesToImport ,
77 const batchParams& batch_params,
78 const machineParams& params) throw(LauncherException);
80 std::string queryJob( const long jobId, const machineParams& params) throw(LauncherException);
81 std::string queryJob( const long jobId, const std::string clusterName) throw(LauncherException);
82 void deleteJob( const long jobId, const machineParams& params) throw(LauncherException);
83 void deleteJob( const long jobId, const std::string clusterName) throw(LauncherException);
84 void getResultsJob( const std::string directory, const long jobId, const machineParams& params ) throw(LauncherException);
85 void getResultsJob( const std::string directory, const long jobId, const std::string clusterName ) throw (LauncherException);
87 void SetResourcesManager( ResourcesManager_cpp* rm ) { _ResManager = rm; }
91 std::string buildSalomeCouplingScript(const std::string fileToExecute, const std::string dirForTmpFiles, const ParserResourcesType& params);
92 MpiImpl *FactoryMpiImpl(MpiImplType mpiImpl) throw(LauncherException);
93 Batch::BatchManager_eClient *FactoryBatchManager( const ParserResourcesType& params ) throw(LauncherException);
94 std::string getTmpDirForBatchFiles();
95 std::string getRemoteFile( std::string remoteDir, std::string localFile );
96 std::string getHomeDir(const ParserResourcesType& p, const std::string & tmpdir);
98 std::map <std::string,Batch::BatchManager_eClient*> _batchmap;
99 std::map < std::pair<std::string,long> , Batch::Job* > _jobmap;
100 ResourcesManager_cpp *_ResManager;
101 bool check(const batchParams& batch_params);
102 long getWallTime(std::string edt);
103 long getRamSize(std::string mem);
104 void ParseXmlFile(std::string xmlExecuteFile);
106 //! will contain the informations on the data type catalog(after parsing)
107 ParserLauncherType _launch;