types

package
v0.0.0-...-075ee23 Latest Latest
Warning

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

Go to latest
Published: Jun 29, 2024 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// VersionMajor is for an API incompatible changes
	VersionMajor = 0

	// VersionMinor is for functionality in a backwards-compatible manner
	VersionMinor = 1

	// VersionPatch is for backwards-compatible bug fixes
	VersionPatch = 1

	// VersionDraft indicates development branch. Releases will be empty string.
	VersionDraft = "-draft"
)

Variables

View Source
var (
	// cluster == containment == nodes
	DefaultDominantSubsystem = "cluster"
	ContainsRelation         = "contains"
)

Version is the specification version that the package types support.

Functions

This section is empty.

Types

type ClusterState

type ClusterState map[string]interface{}

A Cluster state is a key value interface. The algorithms are required to know what they are looking for

type Edge

type Edge struct {
	Weight    int     `json:"weight"`
	Vertex    *Vertex `json:"vertex"`
	Relation  string  `json:"relation"`
	Subsystem string  `json:"subsystem"`
}

An edge in the graph has a source vertex (where it's defined from) and a destination (the Vertex field below)

type JobSpec

type JobSpec struct {
	Name    string
	Command string
	Nodes   int32
	Tasks   int32
}

JobSpec holds basic metadata about a job

type MatchAlgorithmNeeds

type MatchAlgorithmNeeds map[string]map[string]bool
  1. a slot, in which case we use the Found/Needed fields, and lookups buy many types.
  2. A single resource type, in which case we define Type and ignore Found/Needed

subsystem -> attribute -> isSatisfied

type Resource

type Resource struct {
	Size int32
	Type string
	Unit string
	// The request coming in can know about the type
	Metadata metadata.Metadata
}

A Resource is a collection of attributes we load from a node intending to put into the graph, and associated functions

func NewResource

func NewResource(node jgf.Node) *Resource

Generate a new resource from a JGF node A resource is associated with a dominant subsystem resource

func NewSubsystemResource

func NewSubsystemResource(node jgf.Node) *Resource

New SubsystemResource creates a resource, but also adds arbitrary metadata

type ResourceNeeds

type ResourceNeeds struct {
	SubsystemSatisfied bool
	ResourceSatisfied  bool

	// Lookup by vertex type
	// type -> subsystem -> attribute -> isSatisfied
	Subsystems map[string]MatchAlgorithmNeeds
	Resources  map[string]int32

	// Needed vs found
	Found  int32
	Needed int32

	// Only needed of the ResourceNeeds is for a single type of resource
	Type string

	// Caches to use for reset
	SubsystemsOriginal map[string]MatchAlgorithmNeeds
	ResourcesOriginal  map[string]int32
}

Serialize slot resource needs into a struct that is easier to parse

func (*ResourceNeeds) AllSatisfied

func (s *ResourceNeeds) AllSatisfied() bool

func (*ResourceNeeds) AreResourcesSatisfied

func (s *ResourceNeeds) AreResourcesSatisfied() bool

func (*ResourceNeeds) AreSubsystemsSatisfied

func (s *ResourceNeeds) AreSubsystemsSatisfied() bool

func (*ResourceNeeds) Reset

func (s *ResourceNeeds) Reset()

func (*ResourceNeeds) Satisfied

func (s *ResourceNeeds) Satisfied() bool

func (*ResourceNeeds) SummarizeRemaining

func (s *ResourceNeeds) SummarizeRemaining() string

type Vertex

type Vertex struct {
	Identifier int           `json:"identifier"`
	Edges      map[int]*Edge `json:"edges"`
	Size       int32         `json:"size"`
	Unit       string        `json:"unit"`
	Type       string        `json:"type"`

	// Link to another subsystem vertex
	Subsystems map[string]map[int]*Edge `json:"subsystems"`

	// Less commonly accessed (and standardized) metadaa
	Metadata metadata.Metadata
}

A vertex is defined by an identifier. We use an int instead of a string because it's faster. Edges are other vertices (and their identifiers) it's connected to.

Jump to

Keyboard shortcuts

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