reserver

package
v0.0.0-...-a69e935 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 1, 2019 License: Apache-2.0 Imports: 19 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Reserver

type Reserver interface {
	// Adding daemon interface for Reserver
	async.Daemon

	// GetReservationQueue returns the reservation queue
	GetReservationQueue() queue.Queue

	// Reserve reserves the task to host in hostmanager
	Reserve(ctx context.Context) (time.Duration, error)

	// Places the assignments which are ready for host reservation into reservationQueue
	ProcessHostReservation(ctx context.Context, assignments []models.Task) error

	// EnqueueReservation enqueues the hostsvc.reservation to
	// the reservation queue
	EnqueueReservation(reservation *hostsvc.Reservation) error

	// GetCompletedReservation gets the completed tasks with offers
	// by that placement can be created
	GetCompletedReservation(ctx context.Context) ([]*hostsvc.CompletedReservation, error)
}

Reserver represents a placement engine's reservation module It gets all the hosts based on filter passed to host manager it chooses the random host from the list and call reserve the chosen host based on the task.

func NewReserver

func NewReserver(
	metrics *tally_metrics.Metrics,
	cfg *config.PlacementConfig,
	hostsService hosts.Service,
	taskService tasks.Service) Reserver

NewReserver creates a new reserver which gets the tasks from the reservationQueue and based on the requirements from the task get the hosts list and randomly choose the host and make the reservation on that host for the task.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL