dependencygraph

package
v0.0.0-...-b702281 Latest Latest
Warning

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

Go to latest
Published: Apr 19, 2024 License: Apache-2.0 Imports: 11 Imported by: 38

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// CredentialsNotResolvedErr is the error where a container needs to wait for
	// credentials before it can process by agent
	CredentialsNotResolvedErr = &dependencyError{err: errors.New("dependency graph: container execution credentials not available")}
	// DependentContainerNotResolvedErr is the error where a dependent container isn't in expected state
	DependentContainerNotResolvedErr = &dependencyError{err: errors.New("dependency graph: dependent container not in expected state")}
	// ContainerPastDesiredStatusErr is the error where the container status is bigger than desired status
	ContainerPastDesiredStatusErr = &dependencyError{err: errors.New("container transition: container status is equal or greater than desired status")}
	// ErrContainerDependencyNotResolved is when the container's dependencies
	// on other containers are not resolved
	ErrContainerDependencyNotResolved = &dependencyError{err: errors.New("dependency graph: dependency on containers not resolved")}
	// ErrResourceDependencyNotResolved is when the container's dependencies
	// on task resources are not resolved
	ErrResourceDependencyNotResolved = &dependencyError{err: errors.New("dependency graph: dependency on resources not resolved")}
	// ResourcePastDesiredStatusErr is the error where the task resource known status is bigger than desired status
	ResourcePastDesiredStatusErr = &dependencyError{err: errors.New("task resource transition: task resource status is equal or greater than desired status")}
	// ErrContainerDependencyNotResolvedForResource is when the resource's dependencies
	// on other containers are not resolved
	ErrContainerDependencyNotResolvedForResource = &dependencyError{err: errors.New("dependency graph: resource's dependency on containers not resolved")}
)

Functions

func TaskResourceDependenciesAreResolved

func TaskResourceDependenciesAreResolved(target taskresource.TaskResource,
	by []*apicontainer.Container) error

TaskResourceDependenciesAreResolved validates that the `target` resource can be transitioned given the current known state of the containers in `by`. If this function returns true, `target` should be technically able to transit without issues. Transitions are between known statuses (whether the resource can move to the next known status), not desired statuses; the desired status typically is either CREATED or REMOVED.

func ValidDependencies

func ValidDependencies(task *apitask.Task, cfg *config.Config) bool

ValidDependencies takes a task and verifies that it is possible to allow all containers within it to reach the desired status by proceeding in some order.

Types

type DependencyError

type DependencyError interface {
	Error() string
	IsTerminal() bool
}

DependencyError represents an error of a container dependency. These errors can be either terminal or non-terminal. Terminal dependency errors indicate that a given dependency can never be fulfilled (e.g. a container with a SUCCESS dependency has stopped with an exit code other than zero).

func DependenciesAreResolved

func DependenciesAreResolved(target *apicontainer.Container,
	by []*apicontainer.Container,
	id string,
	manager credentials.Manager,
	resources []taskresource.TaskResource,
	cfg *config.Config) (*apicontainer.DependsOn, DependencyError)

DependenciesAreResolved validates that the `target` container can be transitioned given the current known state of the containers in `by`. If this function returns true, `target` should be technically able to launch without issues. Transitions are between known statuses (whether the container can move to the next known status), not desired statuses; the desired status typically is either RUNNING or STOPPED.

Jump to

Keyboard shortcuts

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