wrench::ServerlessSchedulingState

class ServerlessSchedulingState

A class to encode a “scheduling state”, that is a clone of the system state that a scheduler can work with and modify at will for planning purposes.

Public Functions

explicit ServerlessSchedulingState(const ServerlessStateOfTheSystem *state)

Constructor.

Parameters:

state – current system state

bool areAllImageLayersInRAM(const std::shared_ptr<Image> &image, const std::shared_ptr<ServerlessComputeNode> &node) const

Are all layers of an image in RAM at a compute node?

Parameters:
  • image – an image

  • node – the compute node

Returns:

True if all necessary layers are in RAM

bool areAllImageLayersInRAMOrOnTheirWayToRAM(const std::shared_ptr<Image> &image, const std::shared_ptr<ServerlessComputeNode> &node) const

Are all layers either in ram or on their way to ram at a compute node?

Parameters:
  • image – an image

  • node – the compute node

Returns:

True or false

bool areAllImageLayersOnDisk(const std::shared_ptr<Image> &image, const std::shared_ptr<ServerlessComputeNode> &node) const

Are all layers either on disk or on their way to ram at a compute node?

Parameters:
  • image – an image

  • node – the compute node

Returns:

True or false

bool areAllImageLayersOnDiskOrOnTheirWayToDisk(const std::shared_ptr<Image> &image, const std::shared_ptr<ServerlessComputeNode> &node) const

Are all layers either on disk or on their way to ram at a compute node?

Parameters:
  • image – an image

  • node – the compute node

Returns:

True or false

bool areAllImageLayersOnDiskOrOnTheirWayToRAM(const std::shared_ptr<Image> &image, const std::shared_ptr<ServerlessComputeNode> &node) const

Are all layers either on disk or on their way to ram at a compute node?

Parameters:
  • image – an image

  • node – the compute node

Returns:

True or false

std::set<std::shared_ptr<Container>> getIdleContainersAtComputeNode(const std::shared_ptr<ServerlessComputeNode> &node) const

Get the set of idle containers at a compute node.

Parameters:

node – the compute node

Returns:

a set of idle containers

Public Members

std::vector<std::shared_ptr<ServerlessComputeNode>> _activated_compute_nodes

The activated compute nodes.

std::map<std::shared_ptr<Image>, std::vector<std::shared_ptr<Invocation>>> _admitted_invocations

The admitted invocations, i.e., whose image layers have not all yet been downloaded.

std::map<std::shared_ptr<ServerlessComputeNode>, sg_size_t> _disk_available

Map of disk availability.

std::map<std::shared_ptr<ServerlessComputeNode>, std::set<std::shared_ptr<ImageLayer>>> _image_layers_in_ram

Map of in-RAM image layers.

std::map<std::shared_ptr<ServerlessComputeNode>, std::set<std::shared_ptr<ImageLayer>>> _image_layers_on_disk

Map of on-disk image layers.

std::map<std::shared_ptr<ServerlessComputeNode>, std::set<std::shared_ptr<ImageLayer>>> _image_layers_on_their_way_to_disk

Map of soon-to-be-on-disk image layers.

std::map<std::shared_ptr<ServerlessComputeNode>, std::set<std::shared_ptr<ImageLayer>>> _image_layers_on_their_way_to_ram

Map of soon-to-be-in-RAM image layers.

std::map<std::shared_ptr<ServerlessComputeNode>, std::set<std::shared_ptr<Container>>> _initialized_containers

Map of initialized containers.

std::map<std::shared_ptr<ServerlessComputeNode>, std::set<std::shared_ptr<Container>>> _initializing_containers

Map of initializing containers.

unsigned long _num_being_activated_compute_nodes

The number of compute nodes in the process of being activated.

unsigned long _num_deactivated_compute_nodes

The number of deactivated compute nodes.

std::map<std::shared_ptr<Container>, unsigned long> _num_in_flight_invocations_on_container

Planned in-flight invocation counts for existing initialized containers. Includes observed invocations and dispatches selected earlier in this scheduling round.

Does not contain initializing containers or containers whose creation has only been proposed in this round.

std::map<std::shared_ptr<ServerlessComputeNode>, unsigned long> _num_possible_new_containers_on_compute_node

Number of possible new containers that could be started on compute node.

std::map<std::shared_ptr<ServerlessComputeNode>, unsigned long> _num_possible_new_invocations_on_compute_node

Number of possible new invocations that could be started on compute node.

std::map<std::shared_ptr<Container>, unsigned long> _num_possible_new_invocations_on_container

Number of possible new invocations that could be started on a current container.

std::map<std::shared_ptr<Function>, unsigned long> _pending_invocation_counts

The per-function pending invocation counts (outstanding minus assigned to containers).

std::map<std::shared_ptr<ServerlessComputeNode>, std::set<std::shared_ptr<ImageLayer>>> _protected_layers

Map of layers that should not be evicted, due to previous scheduling decisions.

std::map<std::shared_ptr<ServerlessComputeNode>, sg_size_t> _ram_available

Map of RAM availability.

std::vector<std::shared_ptr<Invocation>> _schedulable_invocations

The schedulable invocations.