HTCondorComputeService.h
1 
10 #ifndef WRENCH_HTCONDOR_H
11 #define WRENCH_HTCONDOR_H
12 
13 #include "wrench/services/compute/ComputeServiceMessage.h"
14 #include "wrench/services/compute/ComputeService.h"
15 #include "wrench/services/compute/htcondor/HTCondorCentralManagerService.h"
16 #include "wrench/services/compute/htcondor/HTCondorComputeServiceProperty.h"
17 #include "wrench/services/compute/htcondor/HTCondorComputeServiceMessagePayload.h"
18 #include "wrench/workflow/job/PilotJob.h"
19 #include "wrench/workflow/job/StandardJob.h"
20 
21 namespace wrench {
22 
28  private:
29  std::map<std::string, std::string> default_property_values = {
33  };
34 
35  std::map<std::string, double> default_messagepayload_values = {
44  };
45 
46  public:
47  HTCondorComputeService(const std::string &hostname,
48  const std::string &pool_name,
49  std::set<ComputeService *> compute_resources,
50  std::map<std::string, std::string> property_list = {},
51  std::map<std::string, double> messagepayload_list = {},
52  ComputeService *grid_universe_batch_service = nullptr);
53 
54  /***********************/
56  /***********************/
57 
58  void submitStandardJob(std::shared_ptr<StandardJob> job,
59  const std::map<std::string, std::string> &service_specific_arguments) override;
60 
61  void submitPilotJob(std::shared_ptr<PilotJob> job, const std::map<std::string, std::string> &service_specific_arguments) override;
62 
63  std::shared_ptr<StorageService> getLocalStorageService() const;
64 
65  void setLocalStorageService(std::shared_ptr<StorageService> local_storage_service);
66 
67  bool supportsGridUniverse();
68 
69  /***********************/
71  /***********************/
72 
73 
74  /***********************/
76  /***********************/
77 
78  ~HTCondorComputeService() override;
79 
80  void terminateStandardJob(std::shared_ptr<StandardJob> job) override;
81 
82  void terminatePilotJob(std::shared_ptr<PilotJob> job) override;
83 
84  /***********************/
86  /***********************/
87 
88  private:
89  int main() override;
90 
91  bool processNextMessage();
92 
93  void processSubmitStandardJob(const std::string &answer_mailbox, std::shared_ptr<StandardJob>job,
94  const std::map<std::string, std::string> &service_specific_args);
95 
96  void processSubmitPilotJob(const std::string &answer_mailbox, std::shared_ptr<PilotJob>job,
97  const std::map<std::string, std::string> &service_specific_args);
98 
99  void terminate();
100 
101  std::string pool_name;
102  std::shared_ptr<StorageService> local_storage_service;
103  std::shared_ptr<HTCondorCentralManagerService> central_manager;
104  };
105 }
106 
107 #endif //WRENCH_HTCONDOR_H
static const std::string SUPPORTS_GRID_UNIVERSE
Whether the condor service supports grid jobs that are offloaded to batch service.
Definition: HTCondorComputeServiceProperty.h:25
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: HTCondorComputeService.cpp:195
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
A workload management framework compute service.
Definition: HTCondorComputeService.h:27
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
HTCondorComputeService(const std::string &hostname, const std::string &pool_name, 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: HTCondorComputeService.cpp:39
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: HTCondorComputeService.cpp:248
The compute service base class.
Definition: ComputeService.h:33
Definition: Alarm.cpp:20
void setLocalStorageService(std::shared_ptr< StorageService > local_storage_service)
Set the service's local storage service.
Definition: HTCondorComputeService.cpp:264
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
void terminateStandardJob(std::shared_ptr< StandardJob > job) override
Terminate a standard job to the compute service (virtual)
Definition: HTCondorComputeService.cpp:238
std::map< std::string, double > messagepayload_list
The service's messagepayload list.
Definition: Service.h:112
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
std::string hostname
The name of the host on which the daemon is running.
Definition: S4U_Daemon.h:51
~HTCondorComputeService() override
Destructor.
Definition: HTCondorComputeService.cpp:123
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
bool supportsGridUniverse()
Get whether Condor supports Grid Universe for jobs.
Definition: HTCondorComputeService.cpp:134
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
static const std::string SUPPORTS_PILOT_JOBS
Whether the compute service supports pilot jobs (true or false)
Definition: ComputeServiceProperty.h:26
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: HTCondorComputeService.cpp:147
std::shared_ptr< StorageService > getLocalStorageService() const
Get the service's local storage service.
Definition: HTCondorComputeService.cpp:256
std::map< std::string, std::string > property_list
The service's property list.
Definition: Service.h:109
static const std::string SUPPORTS_STANDARD_JOBS
Whether the compute service supports standard jobs (true or false)
Definition: ComputeServiceProperty.h:24