1 // Copyright (C) 2007-2013 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
23 #ifndef __LAUNCHER_HXX__
24 #define __LAUNCHER_HXX__
26 #include "Launcher_Utils.hxx"
27 #include "Launcher_Job.hxx"
29 #include "ResourcesManager.hxx"
30 #include <SALOME_ResourcesCatalog_Parser.hxx>
32 #include "SALOME_Launcher_Parser.hxx"
47 std::string batch_directory;
48 std::string expected_during_time;
50 unsigned long nb_proc;
52 // Parameters for COORM
53 std::string launcher_file;
54 std::string launcher_args;
57 class LAUNCHER_EXPORT Launcher_cpp
62 virtual ~Launcher_cpp();
65 void createJob(Launcher::Job * new_job);
66 void launchJob(int job_id);
67 const char * getJobState(int job_id);
68 const char * getAssignedHostnames(int job_id); // Get names or ids of hosts assigned to the job
69 void getJobResults(int job_id, std::string directory);
70 bool getJobDumpState(int job_id, std::string directory);
71 void stopJob(int job_id);
72 void removeJob(int job_id);
75 long createJobWithFile(std::string xmlExecuteFile, std::string clusterName);
76 std::map<int, Launcher::Job *> getJobs();
77 void createBatchManagerForJob(Launcher::Job * job);
78 void addJobDirectlyToMap(Launcher::Job * new_job, const std::string job_reference);
81 void SetResourcesManager( ResourcesManager_cpp* rm ) {_ResManager = rm;}
83 // Used by SALOME_Launcher
84 ResourcesManager_cpp *_ResManager;
87 virtual void notifyObservers(const std::string & event_name, const std::string & event_data) {}
89 // Methods used by user interface methods
91 Batch::BatchManager *FactoryBatchManager(ParserResourcesType& params);
92 std::map <int, Batch::BatchManager*> _batchmap;
94 ParserLauncherType ParseXmlFile(std::string xmlExecuteFile);
96 std::map <int, Launcher::Job *> _launcher_job_map;
97 int _job_cpt; // job number counter
98 pthread_mutex_t * _job_cpt_mutex; // mutex for job counter