execute

package
v0.0.0-...-d3da680 Latest Latest
Warning

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

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

Documentation

Overview

Package execute implements logic to execute tryjob requirement for Runs.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Executor

type Executor struct {
	// Env is the environment that LUCI runs in.
	Env *common.Env
	// Backend is the Tryjob backend that Executor will search reusable Tryjobs
	// from and launch new Tryjobs.
	Backend TryjobBackend
	// RM is used to notify Run about changes in Tryjob states.
	RM rm
	// ShouldStop returns whether Executor should stop the execution.
	ShouldStop func() bool
	// contains filtered or unexported fields
}

Executor reacts to changes in the external world and tries to fulfill the Tryjob requirement.

func (*Executor) Do

func (e *Executor) Do(ctx context.Context, r *run.Run, payload *tryjob.ExecuteTryjobsPayload) error

Do executes the Tryjob Requirement for a Run.

This function is idempotent, so it is safe to retry.

type TryjobBackend

type TryjobBackend interface {
	Kind() string
	Search(ctx context.Context, cls []*run.RunCL, definitions []*tryjob.Definition, luciProject string, cb func(*tryjob.Tryjob) bool) error
	Launch(ctx context.Context, tryjobs []*tryjob.Tryjob, r *run.Run, cls []*run.RunCL) []*tryjob.LaunchResult
}

TryjobBackend encapsulates the interactions with a Tryjob backend.

Jump to

Keyboard shortcuts

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