Salome HOME
You can now add options to the "driver" command of a YACS job.
[modules/jobmanager.git] / src / engine / BL_Job.hxx
1 // Copyright (C) 2009-2015  CEA/DEN, EDF R&D
2 //
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License, or (at your option) any later version.
7 //
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
11 // Lesser General Public License for more details.
12 //
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
16 //
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
18 //
19
20 #ifndef _BL_JOB_HXX_
21 #define _BL_JOB_HXX_
22
23 #include "BL_Engine.hxx"
24 #include "BL_Traces.hxx"
25
26 #include <string>
27 #include <list>
28
29 #ifdef WNT
30 #undef ERROR
31 #endif
32
33 namespace BL{
34
35   class BL_Engine_EXPORT Job
36   {
37     public:
38       Job();
39       Job(const std::string & name);
40       virtual ~Job();
41
42       void setName(const std::string & name);
43       std::string getName();
44
45       enum JobType {YACS_SCHEMA, COMMAND, PYTHON_SALOME};
46       void setType(BL::Job::JobType type);
47       void setType(const std::string & type);
48       BL::Job::JobType getType();
49
50       void setJobFile(const std::string & job_file);
51       std::string & getJobFile();
52
53       void setEnvFile(const std::string & env_file);
54       std::string & getEnvFile();
55
56       void setDumpYACSState(const int & dump_yacs_state);
57       int getDumpYACSState();
58
59       void setYacsDriverOptions(const std::string& options);
60       const std::string& getYacsDriverOptions()const;
61
62       enum MemReqType {MEM_PER_NODE, MEM_PER_CPU};
63
64       struct BatchParam
65       {
66         std::string batch_directory;
67         std::string maximum_duration;
68         long mem_limit;
69         MemReqType mem_req_type;
70         int nb_proc;
71         bool exclusive;
72
73                 // Parameters for COORM
74                 std::string launcher_file;
75                 std::string launcher_args;
76       };
77       void setBatchParameters(const BL::Job::BatchParam & param);
78       const BL::Job::BatchParam & getBatchParameters();
79
80       struct FilesParam
81       {
82         std::string result_directory;
83         std::list<std::string> input_files_list;
84         std::list<std::string> output_files_list;
85       };
86       void setFilesParameters(BL::Job::FilesParam & param);
87       BL::Job::FilesParam & getFilesParameters();
88
89       void setResource(const std::string & resource);
90       std::string & getResource();
91
92       void setBatchQueue(const std::string & queue);
93       std::string & getBatchQueue();
94
95       void setWCKey(const std::string & wckey);
96       const std::string & getWCKey();
97
98       void setExtraParams(const std::string & extra_params);
99       const std::string & getExtraParams();
100
101       void setLoadLevelerJobType(const std::string & jobtype);
102       std::string & getLoadLevelerJobType();
103
104       enum State {CREATED, IN_PROCESS, QUEUED, RUNNING, PAUSED, FINISHED, ERROR, FAILED, NOT_CREATED};
105       void setState(BL::Job::State state);
106       BL::Job::State getState();
107       std::string setStringState(const std::string & state);
108
109       enum ThreadState {NOTHING, STARTING}; 
110       void setThreadState(BL::Job::ThreadState state);
111       BL::Job::ThreadState getThreadState();
112
113       void setSalomeLauncherId(int id);
114       int getSalomeLauncherId();
115
116     private:
117       BL::Job::State _state;
118       BL::Job::ThreadState _thread_state;
119       int _dump_yacs_state;
120       std::string _yacs_driver_options;
121
122       std::string _name;
123
124       BL::Job::JobType _type;
125       std::string _job_file;
126       std::string _env_file;
127
128       BL::Job::BatchParam _batch_params;
129       BL::Job::FilesParam _files_params;
130       std::string _resource_choosed;
131       std::string _batch_queue;
132       std::string _wckey;
133       std::string _extra_params;
134       std::string _ll_jobtype;
135
136       int _salome_launcher_id;
137   };
138
139 }
140
141 #endif