HTCondorCentralManagerService.h
1 
10 #ifndef WRENCH_HTCONDORCENTRALMANAGERSERVICE_H
11 #define WRENCH_HTCONDORCENTRALMANAGERSERVICE_H
12 
13 #include <set>
14 #include <deque>
15 #include "wrench/services/compute/ComputeService.h"
16 #include "wrench/services/compute/htcondor/HTCondorCentralManagerServiceMessagePayload.h"
17 
18 namespace wrench {
19 
24  private:
25  std::map<std::string, std::string> default_property_values = {};
26 
27  std::map<std::string, double> default_messagepayload_values = {
39  };
40 
41  public:
42  HTCondorCentralManagerService(const std::string &hostname,
43  std::set<ComputeService *> compute_resources,
44  std::map<std::string, std::string> property_list = {},
45  std::map<std::string, double> messagepayload_list = {},
46  ComputeService *grid_universe_batch_service = nullptr);
47 
48  /***********************/
50  /***********************/
51 
52  void submitStandardJob(std::shared_ptr<StandardJob> job,
53  const std::map<std::string, std::string> &service_specific_arguments) override;
54 
55  void submitPilotJob(std::shared_ptr<PilotJob> job, const std::map<std::string, std::string> &service_specific_arguments) override;
56 
57 
58  /***********************/
60  /***********************/
61 
62  /***********************/
64  /***********************/
65 
67 
68  void terminateStandardJob(std::shared_ptr<StandardJob> job) override;
69 
70  void terminatePilotJob(std::shared_ptr<PilotJob> job) override;
71 
72 
73  /***********************/
75  /***********************/
76 
77  private:
78  int main() override;
79 
80  bool processNextMessage();
81 
82  void processSubmitStandardJob(const std::string &answer_mailbox, std::shared_ptr<StandardJob> job,
83  std::map<std::string, std::string> &service_specific_args);
84 
85  void processSubmitPilotJob(const std::string &answer_mailbox, std::shared_ptr<PilotJob> job,
86  std::map<std::string, std::string> &service_specific_args);
87 
88  void processPilotJobStarted(std::shared_ptr<PilotJob>job);
89 
90  void processPilotJobCompletion(std::shared_ptr<PilotJob>job);
91 
92  void processStandardJobCompletion(std::shared_ptr<StandardJob>job);
93 
94  void processNegotiatorCompletion(std::vector<std::shared_ptr<WorkflowJob>> &pending_jobs);
95 
96  void terminate();
97 
99  std::set<ComputeService *> compute_resources;
101  ComputeService *grid_universe_batch_service;
103  std::shared_ptr<ComputeService> grid_universe_batch_service_shared_ptr;
105  std::vector<std::tuple<std::shared_ptr<WorkflowJob>, std::map<std::string, std::string>>> pending_jobs;
107  bool dispatching_jobs = false;
109  bool resources_unavailable = false;
111  std::map<std::shared_ptr<ComputeService>, unsigned long> compute_resources_map;
113  std::map<std::shared_ptr<WorkflowJob>, std::shared_ptr<ComputeService>> running_jobs;
114  };
115 
116 }
117 
118 #endif //WRENCH_HTCONDORCENTRALMANAGERSERVICE_H
static const std::string PILOT_JOB_EXPIRED_MESSAGE_PAYLOAD
The number of bytes in the control message sent by the daemon to state that a pilot job has expired.
Definition: ComputeServiceMessagePayload.h:44
static const std::string SUBMIT_STANDARD_JOB_REQUEST_MESSAGE_PAYLOAD
The number of bytes in the control message sent to the daemon to submit a standard job.
Definition: ComputeServiceMessagePayload.h:26
static const std::string DAEMON_STOPPED_MESSAGE_PAYLOAD
The number of bytes in the control message sent by the daemon to confirm it has terminated.
Definition: ServiceMessagePayload.h:33
static const std::string RESOURCE_DESCRIPTION_REQUEST_MESSAGE_PAYLOAD
The number of bytes in the control message sent to the daemon to ask it for information on its resour...
Definition: ComputeServiceMessagePayload.h:56
The compute service base class.
Definition: ComputeService.h:33
static const std::string STANDARD_JOB_DONE_MESSAGE_PAYLOAD
The number of bytes in the control message sent by the daemon to state that it has completed a standa...
Definition: ComputeServiceMessagePayload.h:30
Definition: Alarm.cpp:20
static const std::string SUBMIT_PILOT_JOB_ANSWER_MESSAGE_PAYLOAD
The number of bytes in the control message sent from the daemon to acknowledge a pilot job submission...
Definition: ComputeServiceMessagePayload.h:40
HTCondorCentralManagerService(const std::string &hostname, std::set< ComputeService * > compute_resources, std::map< std::string, std::string > property_list={}, std::map< std::string, double > messagepayload_list={}, ComputeService *grid_universe_batch_service=nullptr)
Constructor.
Definition: HTCondorCentralManagerService.cpp:38
A HTCondor central manager service implementation.
Definition: HTCondorCentralManagerService.h:23
static const std::string RESOURCE_DESCRIPTION_ANSWER_MESSAGE_PAYLOAD
The number of bytes in the control message sent by the daemon to state information on its resources.
Definition: ComputeServiceMessagePayload.h:58
static const std::string STOP_DAEMON_MESSAGE_PAYLOAD
The number of bytes in the control message sent to the daemon to terminate it.
Definition: ServiceMessagePayload.h:31
static const std::string PILOT_JOB_STARTED_MESSAGE_PAYLOAD
The number of bytes in the control message sent by the daemon to state that a pilot job has started.
Definition: ComputeServiceMessagePayload.h:42
static const std::string SUBMIT_STANDARD_JOB_ANSWER_MESSAGE_PAYLOAD
The number of bytes in the control message sent by the daemon to acknowledge a standard job submissio...
Definition: ComputeServiceMessagePayload.h:28
static const std::string SUBMIT_PILOT_JOB_REQUEST_MESSAGE_PAYLOAD
The number of bytes in the control message sent to the daemon to submit a pilot job.
Definition: ComputeServiceMessagePayload.h:38