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 std::map<std::string, std::string> default_property_values = {};
30 std::map<std::string, double> 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_PILOT_JOB_REQUEST_MESSAGE_PAYLOAD, 1024},
36 {HTCondorCentralManagerServiceMessagePayload::SUBMIT_PILOT_JOB_ANSWER_MESSAGE_PAYLOAD, 1024},
37 {HTCondorCentralManagerServiceMessagePayload::RESOURCE_DESCRIPTION_REQUEST_MESSAGE_PAYLOAD, 1024},
38 {HTCondorCentralManagerServiceMessagePayload::RESOURCE_DESCRIPTION_ANSWER_MESSAGE_PAYLOAD, 1024},
39 {HTCondorCentralManagerServiceMessagePayload::STANDARD_JOB_DONE_MESSAGE_PAYLOAD, 1024},
40 {HTCondorCentralManagerServiceMessagePayload::PILOT_JOB_STARTED_MESSAGE_PAYLOAD, 1024},
41 {HTCondorCentralManagerServiceMessagePayload::PILOT_JOB_EXPIRED_MESSAGE_PAYLOAD, 1024}
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 = {});
53 void addComputeService(std::shared_ptr<ComputeService> compute_service);
55 void submitStandardJob(std::shared_ptr<StandardJob> job,
56 const std::map<std::string, std::string> &service_specific_arguments)
override;
58 void submitPilotJob(std::shared_ptr<PilotJob> job,
const std::map<std::string, std::string> &service_specific_arguments)
override;
61 ~HTCondorCentralManagerService()
override;
63 void terminateStandardJob(std::shared_ptr<StandardJob> job)
override;
65 void terminatePilotJob(std::shared_ptr<PilotJob> job)
override;
67 bool jobKindIsSupported(
const std::shared_ptr<WorkflowJob>& job, std::map<std::string, std::string> service_specific_arguments);
69 bool jobCanRunSomewhere(std::shared_ptr<WorkflowJob> job, std::map<std::string, std::string> service_specific_arguments);
75 bool processNextMessage();
77 void processSubmitStandardJob(
const std::string &answer_mailbox, std::shared_ptr<StandardJob> job,
78 std::map<std::string, std::string> &service_specific_args);
80 void processSubmitPilotJob(
const std::string &answer_mailbox, std::shared_ptr<PilotJob> job,
81 std::map<std::string, std::string> &service_specific_args);
83 void processPilotJobStarted(std::shared_ptr<PilotJob>job);
85 void processPilotJobCompletion(std::shared_ptr<PilotJob>job);
87 void processStandardJobCompletion(std::shared_ptr<StandardJob>job);
89 void processNegotiatorCompletion(std::vector<std::shared_ptr<WorkflowJob>> &pending_jobs);
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;
115 #endif //WRENCH_HTCONDORCENTRALMANAGERSERVICE_H