10 #ifndef SIMULATION_COMPUTESERVICE_H
11 #define SIMULATION_COMPUTESERVICE_H
19 #include "wrench/services/Service.h"
20 #include "wrench/job/Job.h"
21 #include "wrench/job/StandardJob.h"
22 #include "wrench/job/PilotJob.h"
23 #include "wrench/job/CompoundJob.h"
52 static constexpr
unsigned long ALL_CORES = ULONG_MAX;
57 static constexpr
double ALL_RAM = DBL_MAX;
67 enum TerminationCause {
69 TERMINATION_COMPUTE_SERVICE_TERMINATED,
70 TERMINATION_JOB_KILLED,
71 TERMINATION_JOB_TIMEOUT
79 virtual void stop(
bool send_failure_notifications, ComputeService::TerminationCause termination_cause);
81 void terminateJob(std::shared_ptr<CompoundJob> job);
87 virtual bool supportsStandardJobs() = 0;
93 virtual bool supportsCompoundJobs() = 0;
99 virtual bool supportsPilotJobs() = 0;
101 virtual bool hasScratch()
const;
103 unsigned long getNumHosts();
105 std::vector<std::string> getHosts();
107 std::map<std::string, unsigned long> getPerHostNumCores();
109 unsigned long getTotalNumCores();
111 std::map<std::string, unsigned long> getPerHostNumIdleCores();
113 virtual unsigned long getTotalNumIdleCores();
115 virtual bool isThereAtLeastOneHostWithIdleResources(
unsigned long num_cores,
double ram);
117 std::map<std::string, double> getMemoryCapacity();
119 std::map<std::string, double> getPerHostAvailableMemoryCapacity();
121 std::map<std::string, double> getCoreFlopRate();
125 double getTotalScratchSpaceSize();
127 double getFreeScratchSpaceSize();
146 submitCompoundJob(std::shared_ptr<CompoundJob> job,
const std::map<std::string, std::string> &service_specific_arguments) = 0;
153 virtual void terminateCompoundJob(std::shared_ptr<CompoundJob> job) = 0;
155 std::shared_ptr<StorageService> getScratch();
159 ComputeService(
const std::string &hostname,
160 std::string service_name,
161 std::string scratch_space_mount_point);
166 friend class JobManager;
168 void submitJob(std::shared_ptr<CompoundJob> job,
const std::map<std::string, std::string>& = {});
170 virtual void validateServiceSpecificArguments(std::shared_ptr<CompoundJob> job,
171 std::map<std::string, std::string> &service_specific_args) ;
173 virtual void validateJobsUseOfScratch(std::map<std::string, std::string> &service_specific_args);
175 ComputeService(
const std::string &hostname,
176 std::string service_name,
177 std::shared_ptr<StorageService> scratch_space);
180 std::shared_ptr<StorageService> scratch_space_storage_service;
191 std::shared_ptr<StorageService> getScratchSharedPtr();
199 std::shared_ptr<StorageService> scratch_space_storage_service_shared_ptr;
201 std::map<std::string, double> getServiceResourceInformation(
const std::string &desired_entries);
208 #endif //SIMULATION_COMPUTESERVICE_H