10 #ifndef WRENCH_HTCONDORCENTRALMANAGERSERVICE_H
11 #define WRENCH_HTCONDORCENTRALMANAGERSERVICE_H
15 #include "wrench/services/compute/ComputeService.h"
16 #include "wrench/services/compute/htcondor/HTCondorCentralManagerServiceMessagePayload.h"
26 class HTCondorCentralManagerService :
public ComputeService {
28 WRENCH_PROPERTY_COLLECTION_TYPE default_property_values = {};
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}
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 = {});
56 virtual bool supportsStandardJobs()
override;
57 virtual bool supportsCompoundJobs()
override;
58 virtual bool supportsPilotJobs()
override;
60 void addComputeService(std::shared_ptr<ComputeService> compute_service);
65 void submitCompoundJob(std::shared_ptr<CompoundJob> job,
66 const std::map<std::string, std::string> &service_specific_arguments)
override;
71 ~HTCondorCentralManagerService()
override;
75 void terminateCompoundJob(std::shared_ptr<CompoundJob> job)
override { } ;
79 bool jobKindIsSupported(
const std::shared_ptr<Job>& job, std::map<std::string, std::string> service_specific_arguments);
81 bool jobCanRunSomewhere(std::shared_ptr<CompoundJob> job, std::map<std::string, std::string> service_specific_arguments);
85 friend class HTCondorComputeService;
89 bool processNextMessage();
91 void processSubmitCompoundJob(simgrid::s4u::Mailbox *answer_mailbox, std::shared_ptr<CompoundJob> job,
92 std::map<std::string, std::string> &service_specific_args);
94 void processSubmitPilotJob(simgrid::s4u::Mailbox *answer_mailbox, std::shared_ptr<PilotJob> job,
95 std::map<std::string, std::string> &service_specific_args);
97 void processPilotJobStarted(std::shared_ptr<PilotJob>job);
99 void processPilotJobCompletion(std::shared_ptr<PilotJob>job);
101 void processCompoundJobCompletion(std::shared_ptr<CompoundJob>job);
103 void processNegotiatorCompletion(std::vector<std::shared_ptr<Job>> &pending_jobs);
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;
129 #endif //WRENCH_HTCONDORCENTRALMANAGERSERVICE_H