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
Are all layers of an image in RAM at a compute node?
Helper Functions
- Parameters:
image – an image
node – the compute node
- Returns:
True if all necessary layers are in RAM
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
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
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
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
Exclude a compute node from all future planning.
- Parameters:
node –
-
const std::vector<std::shared_ptr<ServerlessComputeNode>> &getActivatedComputeNodes()
Get the activated compute nodes.
- Returns:
A list of compute nodes
-
const std::map<std::shared_ptr<Image>, std::vector<std::shared_ptr<Invocation>>> &getAdmittedInvocations() const
Get the admitted invocations (images not yet downloaded to the head node).
Accessor Functions
- Returns:
A (reference to) the map of admitted invocations (keyed by Image)
Get the disk space (in bytes) available at a compute node.
- Parameters:
node – A compute node
- Returns:
A number of bytes
Get the set of idle containers at a compute node.
- Parameters:
node – the compute node
- Returns:
a set of idle containers
Get the image layers in RAM at a compute node.
- Parameters:
node – A compute node
- Returns:
A set of image layers
Get the image layers on disk at a compute node.
- Parameters:
node – A compute node
- Returns:
A set of image layers
Get the image layers on their way to disk at a compute node.
- Parameters:
node – A compute node
- Returns:
A set of image layers
Get the image layers on their way to RAM at a compute node.
- Parameters:
node – A compute node
- Returns:
A set of image layers
Get the initialized containers at a compute node.
- Parameters:
node – A compute node
- Returns:
A set of containers
Get the initializing containers at a compute node.
- Parameters:
node – A compute node
- Returns:
A set of containers
-
unsigned long getNumBeingActivatedComputeNodes() const
Get the number of compute nodes that are being activated.
- Returns:
A number of nodes
-
unsigned long getNumDeactivatedComputeNodes() const
Get the number of deactivated compute nodes.
- Returns:
A number of nodes
Get the number of (planned) in-flight invocations at a container.
- Parameters:
container – A container
- Returns:
A number of invocations
Get the number of possible new containers at a compute node.
- Parameters:
node – A compute node
- Returns:
A remaining container capacity in this planning snapshot
Get the node capacity remaining for invocation selections in this round.
Starts with the node’s invocation limit minus its observed in-flight invocations. Selected dispatches, image preparations, and waits for image preparation each consume one unit during planning.
- Parameters:
node – A compute node
- Returns:
A remaining invocation capacity in this planning snapshot
Get the number of possible new invocations on a container.
- Parameters:
container – A container
- Returns:
A remaining invocation capacity in this planning snapshot
-
const std::map<std::shared_ptr<Function>, unsigned long> &getPendingInvocationCounts() const
Get the pending invocation counts.
- Returns:
The map of pending invocations
Get the protected image layers at a compute node.
- Parameters:
node – A compute node
- Returns:
A set of image layers
Get the RAM space (in bytes) available at a compute node.
- Parameters:
node – A compute node
- Returns:
A number of bytes
-
std::vector<std::shared_ptr<Invocation>> &getSchedulableInvocations()
Get the schedulable invocations.
- Returns:
A (reference to) the list of schedulable invocations
Plan for a container prewarm.
- Parameters:
node – The compute node at which to prewarm a container
Plan for the termination of an idle container.
- Parameters:
container – the container
Plan for a new invocation.
- Parameters:
inv – The invocation to place
node – The node on which to place it
container – The container to use (if non-nullptr)
Plan to fail some invocations.
- Parameters:
invocations – A set of invocations to fail
Plan a layer eviction from Disk.
- Parameters:
node – The compute node where the eviction will take place
layer – The layer that will be evicted
Plan a layer eviction from RAM.
- Parameters:
node – The compute node where the eviction will take place
layer – The layer that will be evicted
Plan for a layer load to RAM.
- Parameters:
node – The node at which to load
layer – The layer to load
Plan for a layer staging to disk.
- Parameters:
node – The node at which to stage
layer – The layer to stage
Make all of an image’s layer protected at a compute node.
- Parameters:
node – The compute node
image – The image
Claim one unit of a node’s invocation capacity in this planning round.
Update this planning snapshot after operations or waiting choices have been selected.
These methods do not select operations, append scheduling decisions, execute simulated work, or modify runtime objects. The caller appends any required runtime operations separately. Capacity claims and layer protection may account for a waiting choice that emits no operation.
Updates only the planning snapshot. Does not assign an invocation to the node, reserve a container or its private resources, change pending invocation counts, or append a scheduling decision.
Each invocation selecting a node must consume exactly one unit of node capacity. Do not make a separate claim if dispatch accounting already includes it.
- Parameters:
node – A compute node
-
explicit ServerlessSchedulingState(const ServerlessStateOfTheSystem *state)