Version: 9.16.0
Launcher.hxx
Go to the documentation of this file.
1// Copyright (C) 2007-2026 CEA, EDF, 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, or (at your option) any later version.
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
23#ifndef __LAUNCHER_HXX__
24#define __LAUNCHER_HXX__
25
26#include "Launcher_Utils.hxx"
27#include "Launcher_Job.hxx"
28
29#include "ResourcesManager.hxx"
31
33
34#include <string>
35#include <vector>
36#include <list>
37#include <memory>
38
39class MpiImpl;
40
41namespace Batch{
42 class BatchManager;
43 class Job;
44}
45
47{
48 std::string job_name;
49 std::string job_type;
50 std::string job_file;
51 std::string pre_command;
52 std::string env_file;
53 std::list<std::string> in_files;
54 std::list<std::string> out_files;
55 std::string work_directory;
56 std::string local_directory;
57 std::string result_directory;
58 std::string maximum_duration;
60 std::string queue;
61 std::string partition;
64 unsigned int mem_per_cpu;
65 std::string wckey;
66 std::string extra_params;
67 std::map<std::string, std::string> specific_parameters;
68 std::string launcher_file;
69 std::string launcher_args;
70};
71
73{
74public:
76 virtual ~Launcher_cpp();
77
78 // Main interface
79 void createJob(Launcher::Job * new_job);
80 int createJob(const JobParameters_cpp& job_parameters);
81 void launchJob(int job_id);
82 std::string getJobState(int job_id);
83 std::string getAssignedHostnames(int job_id); // Get names or ids of hosts assigned to the job
84 void exportInputFiles(int job_id);
85 void getJobResults(int job_id, std::string directory);
86 void clearJobWorkingDir(int job_id);
87 bool getJobDumpState(int job_id, std::string directory);
88 bool getJobWorkFile(int job_id, std::string work_file, std::string directory);
89 long getMaximumDurationInSecond(int job_id);
90 void stopJob(int job_id);
91 void removeJob(int job_id);
92 std::string dumpJob(int job_id);
93 int restoreJob(const std::string& dumpedJob);
94 JobParameters_cpp getJobParameters(int job_id);
95
99 std::list<int> loadJobs(const char* jobs_file);
100
102 void saveJobs(const char* jobs_file);
103
104 // Useful methods
105 long createJobWithFile(std::string xmlExecuteFile, std::string clusterName);
106 std::map<int, Launcher::Job *> getJobs();
107 void addJobDirectlyToMap(Launcher::Job * new_job);
108 Launcher::Job * findJob(int job_id);
109
110 // Lib methods
111 void SetResourcesManager( std::shared_ptr<ResourcesManager_cpp>& rm ) {_ResManager = rm;}
112
113protected:
114
115 // Used by SALOME_Launcher
116 std::shared_ptr<ResourcesManager_cpp> _ResManager;
117
118 virtual void notifyObservers(const std::string & /*event_name*/, const std::string & /*event_data*/) {}
119 int addJob(Launcher::Job * new_job);
120
121 // Methods used by user interface methods
122#ifdef WITH_LIBBATCH
123 Batch::BatchManager *FactoryBatchManager(ParserResourcesType& params);
124 std::map <int, Batch::BatchManager*> _batchmap;
125 Batch::BatchManager* getBatchManager(Launcher::Job * job);
126#endif
127 ParserLauncherType ParseXmlFile(std::string xmlExecuteFile);
128
129 std::map <int, Launcher::Job *> _launcher_job_map;
130 int _job_cpt; // job number counter
131};
132
133#endif
#define LAUNCHER_EXPORT
Definition: Launcher_Utils.hxx:39
Definition: Launcher_Job.hxx:49
Definition: Launcher.hxx:73
std::shared_ptr< ResourcesManager_cpp > _ResManager
Definition: Launcher.hxx:116
int _job_cpt
Definition: Launcher.hxx:130
std::map< int, Launcher::Job * > _launcher_job_map
Definition: Launcher.hxx:129
void SetResourcesManager(std::shared_ptr< ResourcesManager_cpp > &rm)
Definition: Launcher.hxx:111
virtual void notifyObservers(const std::string &, const std::string &)
Definition: Launcher.hxx:118
Definition: SALOME_ResourcesCatalog_Parser.hxx:90
Definition: Launcher.hxx:41
job_id
Definition: launcher_use_case.py:49
rm
Definition: salome.py:122
Definition: Launcher.hxx:47
std::string pre_command
Definition: Launcher.hxx:51
std::string launcher_args
Definition: Launcher.hxx:69
std::string work_directory
Definition: Launcher.hxx:55
std::list< std::string > in_files
Definition: Launcher.hxx:53
std::string local_directory
Definition: Launcher.hxx:56
std::string launcher_file
Definition: Launcher.hxx:68
std::string extra_params
Definition: Launcher.hxx:66
std::map< std::string, std::string > specific_parameters
Definition: Launcher.hxx:67
resourceParams resource_required
Definition: Launcher.hxx:59
unsigned int mem_per_cpu
Definition: Launcher.hxx:64
std::string result_directory
Definition: Launcher.hxx:57
std::string wckey
Definition: Launcher.hxx:65
std::string verbose_py_log_level
Definition: Launcher.hxx:62
std::string job_name
Definition: Launcher.hxx:48
bool exclusive
Definition: Launcher.hxx:63
std::string job_type
Definition: Launcher.hxx:49
std::string queue
Definition: Launcher.hxx:60
std::string env_file
Definition: Launcher.hxx:52
std::string partition
Definition: Launcher.hxx:61
std::string maximum_duration
Definition: Launcher.hxx:58
std::string job_file
Definition: Launcher.hxx:50
std::list< std::string > out_files
Definition: Launcher.hxx:54
Definition: SALOME_Launcher_Parser.hxx:46
Definition: ResourcesManager.hxx:52