Salome HOME
Initial commit
[modules/jobmanager.git] / src / engine / BL_Job.hxx
1 //  Copyright (C) 2009 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.
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_Traces.hxx"
24
25 #include <string>
26 #include <list>
27
28 namespace BL{
29
30   class Job
31   {
32     public:
33       Job();
34       Job(const std::string & name);
35       virtual ~Job();
36
37       void setName(const std::string & name);
38       std::string getName();
39
40       enum JobType {YACS_SCHEMA, COMMAND};
41       void setType(BL::Job::JobType type);
42       BL::Job::JobType getType();
43
44       void setYACSFile(std::string & yacs_file);
45       std::string & getYACSFile();
46
47       void setCommand(std::string & command);
48       std::string & getCommand();
49
50       struct BatchParam
51       {
52         std::string batch_directory;
53         std::string expected_during_time;
54         std::string expected_memory;
55         int nb_proc;
56       };
57       void setBatchParameters(BL::Job::BatchParam & param);
58       BL::Job::BatchParam & getBatchParameters();
59
60       struct FilesParam
61       {
62         std::string result_directory;
63         std::list<std::string> input_files_list;
64         std::list<std::string> output_files_list;
65       };
66       void setFilesParameters(BL::Job::FilesParam & param);
67       BL::Job::FilesParam & getFilesParameters();
68
69       void setMachine(std::string & machine);
70       std::string & getMachine();
71
72       enum State {CREATED, IN_PROCESS, QUEUED, RUNNING, PAUSED, FINISHED, ERROR};
73       void setState(BL::Job::State state);
74       BL::Job::State getState();
75
76       enum ThreadState {NOTHING, STARTING}; 
77       void setThreadState(BL::Job::ThreadState state);
78       BL::Job::ThreadState getThreadState();
79
80       void setSalomeLauncherId(int id);
81       int getSalomeLauncherId();
82
83
84     private:
85       BL::Job::State _state;
86       BL::Job::ThreadState _thread_state;
87
88       std::string _name;
89
90       BL::Job::JobType _type;
91       std::string _yacs_file;
92       std::string _command;
93   
94       BL::Job::BatchParam _batch_params;
95       BL::Job::FilesParam _files_params;
96       std::string _machine_choosed;
97
98       int _salome_launcher_id;
99   };
100
101 }
102
103 #endif