wrench::ServerlessComputeNode

class ServerlessComputeNode

A class that stores the state of a serverless compute node.

Public Functions

ServerlessComputeNode(std::string h, ServerlessComputeService *service)

Constructor.

Parameters:
void acknowledgeInvocationCompletion(const std::shared_ptr<Invocation> &invocation)

Make the compute node aware that an invocation has completed.

Parameters:

invocation – An invocation

void acknowledgeInvocationStart(const std::shared_ptr<Invocation> &invocation)

Make the compute node aware that an invocation has started.

Parameters:

invocation – An invocation

bool areAllContainersAtInvocationLimit() const

Determine whether all initialized containers on the compute node are at their invocation limit.

Returns:

true if no new invocation could be started on any container on this node, false otherwise

bool couldInvocationRunRightNow(const std::shared_ptr<Invocation> &invocation, const std::shared_ptr<Container> &target_container) const

Helper method to ensure that an invocation can be dispatched.

Parameters:
  • invocation – the invocation to start

  • target_container – the target container (nullptr if none)

Returns:

true if the invocation can be dispatched, false otherwise

std::shared_ptr<SimpleStorageService> getDiskStorage() const

Get the compute node’s disk storage.

Returns:

A storage service

sg_size_t getFreeDiskSpace() const

Get the compute node’s free disk space.

Returns:

a number of bytes

sg_size_t getFreeRAMSpace() const

Get the compute node’s free RAM space.

Returns:

a number of bytes

const std::set<std::shared_ptr<Container>> &getInitializedContainers() const

Retrieve the set of initialized containers.

Returns:

A set of containers

const std::set<std::shared_ptr<Container>> &getInitializingContainers() const

Retrieve the set of initializing containers.

Returns:

A set of containers

double getLayerLastAccessDateInRAM(const std::shared_ptr<ImageLayer> &layer) const

Get the last access date for an in-RAM layer.

Parameters:

layer – The layer

Returns:

a date

double getLayerLastAccessDateOnDisk(const std::shared_ptr<ImageLayer> &layer) const

Get the last access date for an in-disk layer.

Parameters:

layer – The layer

Returns:

a date

unsigned long getMaxNumContainers() const

Get the maximum number of containers for this compute node.

Returns:

The maximum number of containers for this compute node

unsigned long getMaxNumInvocations() const

Get the maximum number of invocations for this compute node.

Returns:

The maximum number of invocations for this compute node

std::shared_ptr<SimpleStorageService> getMemoryStorage() const

Get the compute node’s RAM storage.

Returns:

A storage service

unsigned long getTotalNumContainers() const

Get the total number of containers (initializing and initialized) on this compute node.

Returns:

The current number of containers

bool isAtPerNodeContainerLimit() const

Determine whether the compute node is at its container limit.

Returns:

true if no container could be started on this node, false otherwise

bool isAtPerNodeInvocationLimit() const

Determine whether the compute node is at its invocation limit (this counts invocations assigned to initializing containers).

Returns:

true if no new invocation could be started on this node, false otherwise

bool isImageLayerInRAM(const std::shared_ptr<ImageLayer> &layer) const

Is an image layer in RAM?

Parameters:

layer – an image layer

Returns:

True if the image layer is in RAM

bool isImageLayerOnDisk(const std::shared_ptr<ImageLayer> &layer) const

Is an image layer on disk?

Parameters:

layer – an image layer

Returns:

True if the image is on disk

void shutdownContainer(const std::shared_ptr<Container> &container)

Shutdown a container.

Parameters:

container – a container

std::shared_ptr<Container> spawnContainer(const std::shared_ptr<Function> &function)

Spawn a container (and try to kill idle containers if it helps).

Parameters:

function – a function

Returns:

A container

Public Members

const std::string hostname

The hostname of the compute node.