frontend

package
v0.0.0-...-0a4d78a Latest Latest
Warning

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

Go to latest
Published: Feb 22, 2025 License: BSD-3-Clause Imports: 66 Imported by: 0

Documentation

Index

Constants

View Source
const SupportedClientMajorVersionNumber = 2

SupportedClientMajorVersionNumber indicates the minimum major client version

Variables

This section is empty.

Functions

func BotForDUT

func BotForDUT(id string, state string, dims string) *swarmingv2.BotInfo

BotForDUT returns BotInfos for DUTs with the given dut id.

state is the bot's state dimension. dims is a convenient way to specify other bot dimensions. "a:x,y;b:z" will set the dimensions of the bot to ["a": ["x", "y"], "b":

["z"]]

func CheckAccess

func CheckAccess(c context.Context, _ string, _ proto.Message) (context.Context, error)

CheckAccess verifies that the request is from an authorized user.

Servers should use checkAccess as a Prelude while handling requests to uniformly check access across the API.

func CreateAuditTask

func CreateAuditTask(ctx context.Context, dutName, pool, taskname, actions string, randFloat float64) (string, error)

CreateAuditTask kicks off an audit job.

func CreateRepairTask

func CreateRepairTask(ctx context.Context, dutName string, expectedState string, pools []string, randFloat float64, poolCfg *config.Swarming_PoolCfg) (string, error)

CreateRepairTask kicks off a repair job.

This function will either schedule a legacy repair task or a PARIS repair task. Note that the ufs client can be nil.

func ExtractDutToPush

func ExtractDutToPush(ctx context.Context, b *swarmingv2.BotInfo, dims strpair.Map, skipHostMap map[string]bool) (dut string)

ExtractDutToPush returns the dut name to push for repair or audit

func GetPoolCfg

func GetPoolCfg(ctx context.Context, poolName string) *config.Swarming_PoolCfg

GetPoolCfg finds a PoolCfg for a given swarming pool if available, otherwise returns nil.

func InstallHandlers

func InstallHandlers(r *router.Router, mwBase router.MiddlewareChain)

InstallHandlers installs the handlers implemented by the frontend package.

func IsLabstationOS

func IsLabstationOS(ctx context.Context, botID string, dims strpair.Map) (err error)

func RouteTask

func RouteTask(ctx context.Context, p RouteTaskParams, randFloat float64) (heuristics.TaskType, error)

RouteTask routes a task for a given bot.

The possible return values are: - "legacy" (for legacy, which is the default) - "" (indicates an error, should be treated as equivalent to "legacy" by callers) - "paris" (for PARIS, which is new) - "latest" (indicates the latest version of paris)

Types

type RouteTaskParams

type RouteTaskParams struct {
	// contains filtered or unexported fields
}

RouteTaskParams are the parameters needed to route a task between legacy and paris and between the paris prod version and paris prod canary.

RouteTaskParams deliberately excludes the context and randFloat, the entropy required.

type ServerImpl

type ServerImpl struct {
	// StableVersionGitClientFactory
	StableVersionGitClientFactory StableVersionGitClientFactory
}

ServerImpl implements the fleet.InventoryServer interface.

func (*ServerImpl) DeleteSatlabStableVersion

DeleteSatlabStableVersion deletes a satlab stable version entry.

func (*ServerImpl) DumpStableVersionToDatastore

DumpStableVersionToDatastore takes stable version info from the git repo where it lives and dumps it to datastore

func (*ServerImpl) GetRecoveryVersion

func (is *ServerImpl) GetRecoveryVersion(ctx context.Context, req *fleet.GetRecoveryVersionRequest) (resp *fleet.GetRecoveryVersionResponse, err error)

GetRecoveryVersion implements the method from fleet.InventoryServer interface

func (*ServerImpl) GetStableVersion

func (is *ServerImpl) GetStableVersion(ctx context.Context, req *fleet.GetStableVersionRequest) (resp *fleet.GetStableVersionResponse, err error)

GetStableVersion implements the method from fleet.InventoryServer interface

func (*ServerImpl) SetSatlabStableVersion

SetSatlabStableVersion replaces a satlab stable version with a new entry.

type StableVersionGitClientFactory

type StableVersionGitClientFactory func(c context.Context) (git.ClientInterface, error)

StableVersionGitClientFactory is a constructor for a git client pointed at the source of truth for the stable version information

type SwarmingFactory

type SwarmingFactory func(c context.Context, host string) (clients.SwarmingClient, error)

SwarmingFactory is a constructor for a SwarmingClient.

type TrackerServerImpl

type TrackerServerImpl struct {
	// SwarmingFactory is an optional factory function for creating clients.
	//
	// If SwarmingFactory is nil, clients.NewSwarmingClient is used.
	SwarmingFactory SwarmingFactory
	MetricsClient   metrics.Metrics
}

TrackerServerImpl implements the fleet.TrackerServer interface.

func (*TrackerServerImpl) PushBotsForAdminAuditTasks

PushBotsForAdminAuditTasks implements the fleet.Tracker.pushBotsForAdminTasks() method.

func (*TrackerServerImpl) PushBotsForAdminTasks

PushBotsForAdminTasks implements the fleet.Tracker.pushBotsForAdminTasks() method.

func (*TrackerServerImpl) PushRepairJobsForLabstations

PushRepairJobsForLabstations implements the fleet.Tracker.pushLabstationsForRepair() method.

func (*TrackerServerImpl) ReportBots

func (tsi *TrackerServerImpl) ReportBots(ctx context.Context, req *fleet.ReportBotsRequest) (res *fleet.ReportBotsResponse, err error)

ReportBots reports metrics of swarming bots.

Directories

Path Synopsis
datastore
stableversion
Package stableversion provides functions to store stableversion info in datastore
Package stableversion provides functions to store stableversion info in datastore
Package swarming contains utilities for skylab swarming tasks.
Package swarming contains utilities for skylab swarming tasks.

Jump to

Keyboard shortcuts

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