state

package
v0.0.0-...-128afb8 Latest Latest
Warning

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

Go to latest
Published: Nov 30, 2024 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Overview

Package state defines the model for a Run state.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type RunState

type RunState struct {
	run.Run
	LogEntries []*run.LogEntry

	// NewLongOpIDs which should be scheduled transactionally with the state
	// transition.
	NewLongOpIDs []string
	// SubmissionScheduled is true if a submission will be attempted after state
	// transition completes.
	SubmissionScheduled bool
}

RunState represents the current state of a Run.

func (*RunState) CheckTree

func (rs *RunState) CheckTree(ctx context.Context, tc tree.Client) (bool, error)

CheckTree returns whether Tree is open for this Run.

Returns true if no Tree or Options.SkipTreeChecks is configured for this Run. Updates the latest result to `rs.Submission`. In case fetching the status results in error for the first time, it records the time in the appropriate field in Submission. Records a new LogEntry.

func (*RunState) CloneSubmission

func (rs *RunState) CloneSubmission()

CloneSubmission clones the `Submission` property.

Initializes the property if this is nil.

func (*RunState) DeepCopy

func (rs *RunState) DeepCopy() *RunState

DeepCopy returns a deep copy of this RunState.

This is an expensive operation. It should only be called in tests.

func (*RunState) EnqueueLongOp

func (rs *RunState) EnqueueLongOp(op *run.OngoingLongOps_Op) string

EnqueueLongOp adds a new long op to the Run state and returns its ID.

The actual long operation will be scheduled transactioncally with the Run mutation.

func (*RunState) LogInfo

func (rs *RunState) LogInfo(ctx context.Context, label, message string)

LogInfo adds a generic LogEntry visible in debug UI as is.

Don't use for adding a complicated info formatted into the message string, use a specialized LogEntry type instead.

func (*RunState) LogInfoAt

func (rs *RunState) LogInfoAt(at time.Time, label, message string)

LogInfoAt is LogInfo with a custom timestamp.

func (*RunState) LogInfof

func (rs *RunState) LogInfof(ctx context.Context, label, format string, args ...any)

LogInfof is like LogInfo but formats the message according to format specifier.

func (*RunState) LogInfofAt

func (rs *RunState) LogInfofAt(at time.Time, label, format string, args ...any)

LogInfofAt is like LogInfoAt but formats the message according to format specifier.

func (*RunState) RemoveCompletedLongOp

func (rs *RunState) RemoveCompletedLongOp(opID string)

RemoveCompletedLongOp removes long op from the ongoing ones.

func (*RunState) RequestLongOpCancellation

func (rs *RunState) RequestLongOpCancellation(opID string)

RequestLongOpCancellation records soft request to cancel a long running op.

This request is asynchronous but it's stored in the Run state.

func (*RunState) ShallowCopy

func (rs *RunState) ShallowCopy() *RunState

ShallowCopy returns a shallow copy of this RunState.

Jump to

Keyboard shortcuts

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