FirstFitStrategy#

class eclypse.placement.strategies.first_fit.FirstFitStrategy[source]#

Bases: PlacementStrategy

FirstFitStrategy class.

A placement strategy that places services onto the first node that satisfies the requirements.

Methods

__init__([sort_fn])

Initializes the FirstFit placement strategy.

place(infrastructure, application, _, ...)

Performs the placement according to a first-fit logic.

__init__(sort_fn=None)[source]#

Initializes the FirstFit placement strategy.

Parameters:

sort_fn (Callable[[Any], Any] | None, optional) – A function to sort the infrastructure nodes. Defaults to None.

place(infrastructure, application, _, placement_view)[source]#

Performs the placement according to a first-fit logic.

Places the services of an application on the infrastructure nodes based on the first node that satisfies the requirements of the service.

Parameters:
  • infrastructure (Infrastructure) – The infrastructure to place the application on.

  • application (Application) – The application to place on the infrastructure.

  • _ (dict[str, Placement]) – The placement of all the applications in the simulations.

  • placement_view (PlacementView) – The snapshot of the current state of the infrastructure.

Returns:

A mapping of services to infrastructure nodes.

Return type:

dict[str, str]