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  /***********************/
21  /***********************/
22 
27  private:
28  std::map<std::string, std::string> default_property_values = {};
29 
30  std::map<std::string, double> default_messagepayload_values = {
42  };
43 
44  public:
45 
46 
47  HTCondorCentralManagerService(const std::string &hostname,
48  double negotiator_startup_overhead,
49  std::set<std::shared_ptr<ComputeService>> compute_services,
50  std::map<std::string, std::string> property_list = {},
51  std::map<std::string, double> messagepayload_list = {});
52 
53  void addComputeService(std::shared_ptr<ComputeService> compute_service);
54 
55  void submitStandardJob(std::shared_ptr<StandardJob> job,
56  const std::map<std::string, std::string> &service_specific_arguments) override;
57 
58  void submitPilotJob(std::shared_ptr<PilotJob> job, const std::map<std::string, std::string> &service_specific_arguments) override;
59 
60 
62 
63  void terminateStandardJob(std::shared_ptr<StandardJob> job) override;
64 
65  void terminatePilotJob(std::shared_ptr<PilotJob> job) override;
66 
67  bool jobKindIsSupported(const std::shared_ptr<WorkflowJob>& job, std::map<std::string, std::string> service_specific_arguments);
68 
69  bool jobCanRunSomewhere(std::shared_ptr<WorkflowJob> job, std::map<std::string, std::string> service_specific_arguments);
70 
71 
72  private:
73  int main() override;
74 
75  bool processNextMessage();
76 
77  void processSubmitStandardJob(const std::string &answer_mailbox, std::shared_ptr<StandardJob> job,
78  std::map<std::string, std::string> &service_specific_args);
79 
80  void processSubmitPilotJob(const std::string &answer_mailbox, std::shared_ptr<PilotJob> job,
81  std::map<std::string, std::string> &service_specific_args);
82 
83  void processPilotJobStarted(std::shared_ptr<PilotJob>job);
84 
85  void processPilotJobCompletion(std::shared_ptr<PilotJob>job);
86 
87  void processStandardJobCompletion(std::shared_ptr<StandardJob>job);
88 
89  void processNegotiatorCompletion(std::vector<std::shared_ptr<WorkflowJob>> &pending_jobs);
90 
91  void terminate();
92 
93 
95  std::set<std::shared_ptr<ComputeService>> compute_services;
97  std::vector<std::tuple<std::shared_ptr<WorkflowJob>, std::map<std::string, std::string>>> pending_jobs;
99  std::map<std::shared_ptr<WorkflowJob>, std::shared_ptr<ComputeService>> running_jobs;
101  bool dispatching_jobs = false;
103  bool resources_unavailable = false;
105  double negotiator_startup_overhead = 0.0;
106 
107  };
108 
109  /***********************/
111  /***********************/
112 
113 }
114 
115 #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
bool jobKindIsSupported(const std::shared_ptr< WorkflowJob > &job, std::map< std::string, std::string > service_specific_arguments)
Helper function to check whether a job kind is supported.
Definition: HTCondorCentralManagerService.cpp:459
~HTCondorCentralManagerService() override
Destructor.
Definition: HTCondorCentralManagerService.cpp:62
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
bool jobCanRunSomewhere(std::shared_ptr< WorkflowJob > job, std::map< std::string, std::string > service_specific_arguments)
Helper function to check whether a job can run on at least one child compute service.
Definition: HTCondorCentralManagerService.cpp:494
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
void terminatePilotJob(std::shared_ptr< PilotJob > job) override
Terminate a pilot job to the compute service.
Definition: HTCondorCentralManagerService.cpp:197
void submitPilotJob(std::shared_ptr< PilotJob > job, const std::map< std::string, std::string > &service_specific_arguments) override
Asynchronously submit a pilot job to the cloud service.
Definition: HTCondorCentralManagerService.cpp:144
The compute service base class.
Definition: ComputeService.h:33
void addComputeService(std::shared_ptr< ComputeService > compute_service)
Add a new 'child' compute service.
Definition: HTCondorCentralManagerService.cpp:73
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
std::map< std::string, double > messagepayload_list
The service's messagepayload list.
Definition: Service.h:112
A HTCondor central manager service implementation.
Definition: HTCondorCentralManagerService.h:26
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
std::string hostname
The name of the host on which the daemon is running.
Definition: S4U_Daemon.h:51
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
HTCondorCentralManagerService(const std::string &hostname, double negotiator_startup_overhead, std::set< std::shared_ptr< ComputeService >> compute_services, std::map< std::string, std::string > property_list={}, std::map< std::string, double > messagepayload_list={})
Constructor.
Definition: HTCondorCentralManagerService.cpp:40
void submitStandardJob(std::shared_ptr< StandardJob > job, const std::map< std::string, std::string > &service_specific_arguments) override
Submit a standard job to the HTCondor service.
Definition: HTCondorCentralManagerService.cpp:94
void terminateStandardJob(std::shared_ptr< StandardJob > job) override
Terminate a standard job to the compute service (virtual)
Definition: HTCondorCentralManagerService.cpp:187
std::map< std::string, std::string > property_list
The service's property list.
Definition: Service.h:109