10 #ifndef SIMULATION_COMPUTESERVICE_H
11 #define SIMULATION_COMPUTESERVICE_H
19 #include "wrench/services/Service.h"
20 #include "wrench/workflow/job/WorkflowJob.h"
21 #include "wrench/workflow/job/StandardJob.h"
22 #include "wrench/workflow/job/PilotJob.h"
39 friend class StandardJobExecutorTest;
52 static constexpr
unsigned long ALL_CORES = ULONG_MAX;
57 static constexpr
double ALL_RAM = DBL_MAX;
69 void terminateJob(std::shared_ptr<WorkflowJob> job);
71 bool supportsStandardJobs();
73 bool supportsPilotJobs();
77 unsigned long getNumHosts();
79 std::vector<std::string> getHosts();
81 std::map<std::string, unsigned long> getPerHostNumCores();
83 unsigned long getTotalNumCores();
85 std::map<std::string, unsigned long> getPerHostNumIdleCores();
87 virtual unsigned long getTotalNumIdleCores();
89 virtual bool isThereAtLeastOneHostWithIdleResources(
unsigned long num_cores,
double ram);
91 std::map<std::string, double> getMemoryCapacity();
93 std::map<std::string, double> getPerHostAvailableMemoryCapacity();
95 std::map<std::string, double> getCoreFlopRate();
99 double getTotalScratchSpaceSize();
101 double getFreeScratchSpaceSize();
119 submitStandardJob(std::shared_ptr<StandardJob> job,
const std::map<std::string, std::string> &service_specific_arguments) = 0;
127 virtual void submitPilotJob(std::shared_ptr<PilotJob> job,
const std::map<std::string, std::string> &service_specific_arguments) = 0;
133 virtual void terminateStandardJob(std::shared_ptr<StandardJob> job) = 0;
139 virtual void terminatePilotJob(std::shared_ptr<PilotJob> job) = 0;
145 std::shared_ptr<StorageService> getScratch();
149 std::string service_name,
150 std::string mailbox_name_prefix,
151 std::string scratch_space_mount_point);
155 friend class JobManager;
157 void submitJob(std::shared_ptr<WorkflowJob> job,
const std::map<std::string, std::string>& = {});
159 ComputeService(
const std::string &hostname,
160 std::string service_name,
161 std::string mailbox_name_prefix,
162 std::shared_ptr<StorageService> scratch_space);
165 std::shared_ptr<StorageService> scratch_space_storage_service;
175 std::shared_ptr<StorageService> getScratchSharedPtr();
184 std::shared_ptr<StorageService> scratch_space_storage_service_shared_ptr;
186 std::map<std::string, std::map<std::string, double>> getServiceResourceInformation();
193 #endif //SIMULATION_COMPUTESERVICE_H