RandomStrategy#

class eclypse.placement.strategies.random.RandomStrategy[source]#

Bases: PlacementStrategy

A placement strategy that places services randomly onto nodes.

Methods

__init__([spread, seed])

Initializes the Random placement strategy.

place(_, application, __, placement_view)

Places the services of an application on the infrastructure nodes, randomly.

__init__(spread=False, seed=None)[source]#

Initializes the Random placement strategy.

Parameters:
  • spread (bool, optional) – Whether to spread the services across different nodes. Defaults to False.

  • seed (int | None, optional) – The seed for the random number generator. Defaults to None.

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

Places the services of an application on the infrastructure nodes, randomly.

Parameters:
  • _ (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]