class ray.tune.schedulers.resource_changing_scheduler.DistributeResourcesToTopJob(add_bundles: bool = False, increase_by: Dict[str, float] | None = None, increase_by_times: int = -1, reserve_resources: Dict[str, float] | None = None, metric: str | None = None, mode: str | None = None)[source]#

Bases: DistributeResources

This class creates a “TopJob” resource allocation function.

The function will assign all of the free resources to the best performing trial (as defined by metric and mode). The previous best trials will not have their resources deallocated, unless in the case outlined below.

If for some reason a trial ends up with more resources than there are free ones, it will adjust downwards. It will also ensure that trial as at least as many resources as it started with (base_trial_resource).

The function returns a new PlacementGroupFactory with updated resource requirements, or None. If the returned PlacementGroupFactory is equal by value to the one the trial has currently, the scheduler will skip the update process internally (same with None).

  • add_bundles – If True, create new bundles from free resources. Otherwise, spread them among base_trial_resource bundles.

  • increase_by – A dict with key-value pairs representing an atomic unit of resources (name-amount) the trial will be increased by. If not set, the trial will increase by 1 CPU/GPU.

  • increase_by_times – If set to >=1 and increase_by is set, the trial will increase by maximum of increase_by_times * increase_by resources. If set to <1, no upper limit is set. Ignored if increase_by is not set.

  • reserve_resources – A dict of resource_name-amount pairs representing the resources that will not be allocated to resized trials. is that the attribute should increase monotonically.

  • metric – The training result objective value attribute. Stopping procedures will use this attribute. If None, will use the metric of the scheduler.

  • mode – One of {min, max}. Determines whether objective is minimizing or maximizing the metric attribute. If None, will use the metric of the scheduler.

PublicAPI (beta): This API is in beta and may change before becoming stable.