Cloud
Developer Documentation

Overview

A cloud service is an abstraction of a compute service that corresponds to a cloud platform that provides access to virtualized compute resources, i.e., virtual machines (VMs). The cloud service provides all necessary abstractions to manage VMs, including creation, suspension, resume, etc. Compute jobs submitted to the cloud service run on previously created VM instances. If a VM that meets a job's requirements cannot be found, the service will throw an exception. In the cloud service, a VM instance behaves as a bare-metal service.

The main difference between a cloud service and a virtualized cluster service is that the latter does expose the underlying physical infrastructure (e.g., it is possible to instantiate a VM on a particular physical host, or to migrate a VM between two particular physical hosts).

Creating a cloud compute service

In WRENCH, a cloud service represents a compute service (wrench::ComputeService), which is defined by the wrench::CloudService class. An instantiation of a cloud service requires the following parameters:

  • A hostname on which to start the service (this is the entry point to the service)
  • A list (std::vector) of hostnames (all cores and all RAM of each host is available to the cloud service)
  • A scratch space size, i.e., the size in bytes of storage local to the cloud service (used to store workflow files, as needed, during job executions)
  • Maps (std::map) of configurable properties (wrench::CloudServiceProperty) and configurable message payloads (wrench::CloudServiceMessagePayload).

The example below shows how to create an instance of a cloud service that runs on host "cloud_gateway", provides access to 4 execution hosts, and has a scratch space of 1TiB:

auto cloud_cs = simulation.add(
new wrench::CloudService("cloud_gateway", {"host1", "host2", "host3", "host4"}, pow(2,40),

Cloud service properties

In addition to properties inherited from wrench::ComputeServiceProperty, a cloud service supports the following properties:

Managing a cloud compute service

The cloud service provides several mechanisms to manage the set of VMs instantiated on the execution hosts. Currently, it is possible to create, shutdown, start, suspend, and resume VMs (see a complete list of functions available in the wrench::CloudService API documentation). The figure below shows the different states a VM can be:

wrench-guide-cloud-state-diagram.png


Submitting Jobs to a cloud compute service

As expected, a cloud service provides implementations of the methods in the wrench::ComputeService base class. The wrench::ComputeService::submitJob() method takes as argument service-specific arguments as a std::map<std::string, std::string> of key-value pairs. For a cloud service, these arguments are optional and to be specified as follows:

If no argument is specified, the cloud service will pick the VM on which to execute the job.

Here is an example job submission to the cloud service:

// Create a VM with 2 cores and 1 GiB of RAM
auto vm1 = cloud_cs->createVM(2, pow(2,30));
// Create a VM with 4 cores and 2 GiB of RAM
auto vm2 = cloud_cs->createVM(4, pow(2,31));
// Create a job manager
auto job_manager = this->createJobManager();
// Create a job
auto job = job_manager->createStandardJob(tasks, {});
// Create service-specific arguments so that the job will run on the second vm
std::map<std::string, std::string> service_specific_args;
service_specific_args["-vm"] = vm2;
// Submit the job
job_manager->submitJob(job, cloud_cs, service_specific_args);