WRENCH  1.11
Cyberinfrastructure Simulation Workbench
Overview Installation Getting Started WRENCH 101 WRENCH 102
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 
26  class HTCondorCentralManagerService : public ComputeService {
27  private:
28  WRENCH_PROPERTY_COLLECTION_TYPE default_property_values = {};
29 
30 WRENCH_MESSAGE_PAYLOADCOLLECTION_TYPE default_messagepayload_values = {
31  {HTCondorCentralManagerServiceMessagePayload::STOP_DAEMON_MESSAGE_PAYLOAD, 1024},
32  {HTCondorCentralManagerServiceMessagePayload::DAEMON_STOPPED_MESSAGE_PAYLOAD, 1024},
33  {HTCondorCentralManagerServiceMessagePayload::SUBMIT_STANDARD_JOB_REQUEST_MESSAGE_PAYLOAD, 1024},
34  {HTCondorCentralManagerServiceMessagePayload::SUBMIT_STANDARD_JOB_ANSWER_MESSAGE_PAYLOAD, 1024},
35  {HTCondorCentralManagerServiceMessagePayload::SUBMIT_COMPOUND_JOB_REQUEST_MESSAGE_PAYLOAD, 1024},
36  {HTCondorCentralManagerServiceMessagePayload::SUBMIT_COMPOUND_JOB_ANSWER_MESSAGE_PAYLOAD, 1024},
37  {HTCondorCentralManagerServiceMessagePayload::SUBMIT_PILOT_JOB_REQUEST_MESSAGE_PAYLOAD, 1024},
38  {HTCondorCentralManagerServiceMessagePayload::SUBMIT_PILOT_JOB_ANSWER_MESSAGE_PAYLOAD, 1024},
39  {HTCondorCentralManagerServiceMessagePayload::RESOURCE_DESCRIPTION_REQUEST_MESSAGE_PAYLOAD, 1024},
40  {HTCondorCentralManagerServiceMessagePayload::RESOURCE_DESCRIPTION_ANSWER_MESSAGE_PAYLOAD, 1024},
41  {HTCondorCentralManagerServiceMessagePayload::STANDARD_JOB_DONE_MESSAGE_PAYLOAD, 1024},
42  {HTCondorCentralManagerServiceMessagePayload::COMPOUND_JOB_DONE_MESSAGE_PAYLOAD, 1024},
43  {HTCondorCentralManagerServiceMessagePayload::PILOT_JOB_STARTED_MESSAGE_PAYLOAD, 1024},
44  {HTCondorCentralManagerServiceMessagePayload::PILOT_JOB_EXPIRED_MESSAGE_PAYLOAD, 1024}
45  };
46 
47  public:
48 
49 
50  HTCondorCentralManagerService(const std::string &hostname,
51  double negotiator_startup_overhead,
52  std::set<std::shared_ptr<ComputeService>> compute_services,
53  WRENCH_PROPERTY_COLLECTION_TYPE property_list = {},
54  WRENCH_MESSAGE_PAYLOADCOLLECTION_TYPE messagepayload_list = {});
55 
56  virtual bool supportsStandardJobs() override;
57  virtual bool supportsCompoundJobs() override;
58  virtual bool supportsPilotJobs() override;
59 
60  void addComputeService(std::shared_ptr<ComputeService> compute_service);
61 
62 // void submitStandardJob(std::shared_ptr<StandardJob> job,
63 // const std::map<std::string, std::string> &service_specific_arguments);
64 
65  void submitCompoundJob(std::shared_ptr<CompoundJob> job,
66  const std::map<std::string, std::string> &service_specific_arguments) override;
67 
68 // void submitPilotJob(std::shared_ptr<PilotJob> job, const std::map<std::string, std::string> &service_specific_arguments) override;
69 
70 
71  ~HTCondorCentralManagerService() override;
72 
73 // void terminateStandardJob(std::shared_ptr<StandardJob> job) override;
74 
75  void terminateCompoundJob(std::shared_ptr<CompoundJob> job) override { } ;
76 
77 // void terminatePilotJob(std::shared_ptr<PilotJob> job) override;
78 
79  bool jobKindIsSupported(const std::shared_ptr<Job>& job, std::map<std::string, std::string> service_specific_arguments);
80 
81  bool jobCanRunSomewhere(std::shared_ptr<CompoundJob> job, std::map<std::string, std::string> service_specific_arguments);
82 
83  private:
84 
85  friend class HTCondorComputeService;
86 
87  int main() override;
88 
89  bool processNextMessage();
90 
91  void processSubmitCompoundJob(simgrid::s4u::Mailbox *answer_mailbox, std::shared_ptr<CompoundJob> job,
92  std::map<std::string, std::string> &service_specific_args);
93 
94  void processSubmitPilotJob(simgrid::s4u::Mailbox *answer_mailbox, std::shared_ptr<PilotJob> job,
95  std::map<std::string, std::string> &service_specific_args);
96 
97  void processPilotJobStarted(std::shared_ptr<PilotJob>job);
98 
99  void processPilotJobCompletion(std::shared_ptr<PilotJob>job);
100 
101  void processCompoundJobCompletion(std::shared_ptr<CompoundJob>job);
102 
103  void processNegotiatorCompletion(std::vector<std::shared_ptr<Job>> &pending_jobs);
104 
105  void terminate();
106 
107 
109  std::set<std::shared_ptr<ComputeService>> compute_services;
111  std::vector<std::tuple<std::shared_ptr<CompoundJob>, std::map<std::string, std::string>>> pending_jobs;
113  std::map<std::shared_ptr<CompoundJob>, std::shared_ptr<ComputeService>> running_jobs;
115  bool dispatching_jobs = false;
117  bool resources_unavailable = false;
119  double negotiator_startup_overhead = 0.0;
120 
121  };
122 
123  /***********************/
125  /***********************/
126 
127 }
128 
129 #endif //WRENCH_HTCONDORCENTRALMANAGERSERVICE_H
wrench
Definition: Action.cpp:28