taskmodel

package
v0.0.0-...-3511abf Latest Latest
Warning

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

Go to latest
Published: Nov 2, 2023 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CleanupResourcesState

func CleanupResourcesState() error

CleanupResourcesState deletes resources for all closed allocations.

func WipeResourcesState

func WipeResourcesState() error

WipeResourcesState deletes all database contents.

Types

type ResourcesWithState

type ResourcesWithState struct {
	bun.BaseModel `bun:"table:allocation_resources,alias:al_res"`

	sproto.Resources `bun:"-"`
	Rank             int                      `bun:"rank"`
	Started          *sproto.ResourcesStarted `bun:"started"`
	Exited           *sproto.ResourcesStopped `bun:"exited"`
	Daemon           bool                     `bun:"daemon"`
	ResourceID       sproto.ResourcesID       `bun:"resource_id,pk,type:text"` // db only
	AllocationID     model.AllocationID       `bun:"allocation_id,type:text"`  // db only

	// The Container state, if we're using a RM that uses containers and it was given to us.
	// This is a rip in the abstraction, remove eventually. Do not add usages.
	Container *cproto.Container `bun:"-"`
}

ResourcesWithState is an sproto.Resources, along with its state that is tracked by the allocation. The state is primarily just the updates that come in about the resources.

func NewResourcesState

func NewResourcesState(r sproto.Resources, rank int) ResourcesWithState

NewResourcesState creates an instance from `sproto.Resources`.

func (*ResourcesWithState) Persist

func (r *ResourcesWithState) Persist() error

Persist saves the data to the database.

Jump to

Keyboard shortcuts

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