JobManager.h
1 
11 #ifndef WRENCH_PILOTJOBMANAGER_H
12 #define WRENCH_PILOTJOBMANAGER_H
13 
14 #include <vector>
15 #include <set>
16 
17 #include "wrench/services/Service.h"
18 
19 namespace wrench {
20 
21  class WMS;
22  class Workflow;
23  class WorkflowTask;
24  class WorkflowFile;
25  class WorkflowJob;
26  class PilotJob;
27  class StandardJob;
28  class ComputeService;
29  class StorageService;
30 
31  /***********************/
33  /***********************/
34 
35 
40  class JobManager : public Service {
41 
42  public:
43 
44 
45  void stop();
46 
47  void kill();
48 
49  StandardJob *createStandardJob(std::vector<WorkflowTask *> tasks,
50  std::map<WorkflowFile *, StorageService *> file_locations,
51  std::set<std::tuple<WorkflowFile *, StorageService *, StorageService *>> pre_file_copies,
52  std::set<std::tuple<WorkflowFile *, StorageService *, StorageService *>> post_file_copies,
53  std::set<std::tuple<WorkflowFile *, StorageService *>> cleanup_file_deletions);
54 
55  StandardJob *createStandardJob(std::vector<WorkflowTask *> tasks,
56  std::map<WorkflowFile *,
57  StorageService *> file_locations);
58 
60  std::map<WorkflowFile *,
61  StorageService *> file_locations);
62 
64 
65  void submitJob(WorkflowJob *job, ComputeService *compute_service, std::map<std::string, std::string> service_specific_args = {});
66 
67  void terminateJob(WorkflowJob *);
68 
69  void forgetJob(WorkflowJob *job);
70 
71  std::set<PilotJob *> getPendingPilotJobs();
72 
73  std::set<PilotJob *> getRunningPilotJobs();
74  /***********************/
76  /***********************/
77 
78  ~JobManager();
79 
80  protected:
81 
82  friend class WMS;
83 
84  JobManager(WMS *wms);
85 
86  /***********************/
88  /***********************/
89 
90  private:
91 
92  int main();
93 
94  // Relevant WMS
95  WMS *wms;
96 
97  // Job map
98  std::map<WorkflowJob*, std::unique_ptr<WorkflowJob>> jobs;
99 
100  // Job lists
101  std::set<StandardJob *> pending_standard_jobs;
102  std::set<StandardJob *> running_standard_jobs;
103  std::set<StandardJob *> completed_standard_jobs;
104  std::set<StandardJob *> failed_standard_jobs;
105 
106  std::set<PilotJob *> pending_pilot_jobs;
107  std::set<PilotJob *> running_pilot_jobs;
108  std::set<PilotJob *> completed_pilot_jobs;
109 
110  };
111 
112  /***********************/
114  /***********************/
115 
116 };
117 
118 #endif //WRENCH_PILOTJOBMANAGER_H
void stop()
Stop the job manager.
Definition: JobManager.cpp:73
A computational task in a Workflow.
Definition: WorkflowTask.h:26
A service that can be added to the simulation and that can be used by a WMS when executing a workflow...
Definition: Service.h:26
void submitJob(WorkflowJob *job, ComputeService *compute_service, std::map< std::string, std::string > service_specific_args={})
Submit a job to compute service.
Definition: JobManager.cpp:255
Abstraction of a job used for executing tasks in a Workflow.
Definition: WorkflowJob.h:31
A data file used/produced by a WorkflowTask in a Workflow.
Definition: WorkflowFile.h:26
std::set< PilotJob * > getRunningPilotJobs()
Get the list of currently running pilot jobs.
Definition: JobManager.cpp:413
std::set< PilotJob * > getPendingPilotJobs()
Get the list of currently pending pilot jobs.
Definition: JobManager.cpp:421
A pilot (i.e., non-standard) workflow job that can be submitted to a ComputeService by a WMS (via a J...
Definition: PilotJob.h:29
A standard (i.e., non-pilot) workflow job that can be submitted to a ComputeService by a WMS (via a J...
Definition: StandardJob.h:38
The compute service base class.
Definition: ComputeService.h:35
PilotJob * createPilotJob()
Create a pilot job.
Definition: JobManager.cpp:225
void terminateJob(WorkflowJob *)
Terminate a job (standard or pilot) that hasn&#39;t completed/expired/failed yet.
Definition: JobManager.cpp:355
void forgetJob(WorkflowJob *job)
Forget a job (to free memory, only once a job has completed or failed)
Definition: JobManager.cpp:433
void kill()
Kill the job manager (brutally terminate the daemon, clears all jobs)
Definition: JobManager.cpp:62
A helper daemon (co-located with and explicitly started by a WMS), which is used to handle all job ex...
Definition: JobManager.h:40
A workflow management system (WMS)
Definition: WMS.h:33
The storage service base class.
Definition: StorageService.h:35
Definition: TerminalOutput.cpp:15
StandardJob * createStandardJob(std::vector< WorkflowTask *> tasks, std::map< WorkflowFile *, StorageService *> file_locations, std::set< std::tuple< WorkflowFile *, StorageService *, StorageService *>> pre_file_copies, std::set< std::tuple< WorkflowFile *, StorageService *, StorageService *>> post_file_copies, std::set< std::tuple< WorkflowFile *, StorageService *>> cleanup_file_deletions)
Create a standard job.
Definition: JobManager.cpp:101