swmbot

package
v0.0.0-...-e560ebb Latest Latest
Warning

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

Go to latest
Published: Jul 13, 2021 License: BSD-3-Clause Imports: 17 Imported by: 0

Documentation

Overview

Package swmbot provides interaction with the Swarming bot running the Skylab worker process. This includes information about the Swarming bot as well as any Swarming bot local state.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func InventoryClient

func InventoryClient(ctx context.Context, b *Info) (fleet.InventoryClient, error)

InventoryClient returns an InventoryClient for the current Swarming bot task. The context should use an explicit service account using WithTaskAccount or WithSystemAccount; otherwise the default service account is used.

func InventoryV2Client

func InventoryV2Client(ctx context.Context, b *Info) (invV2.InventoryClient, error)

InventoryV2Client returns an InventoryClient for the current Swarming bot task. The context should use an explicit service account using WithTaskAccount or WithSystemAccount; otherwise the default service account is used.

func Marshal

func Marshal(lds *LocalDUTState) ([]byte, error)

Marshal returns the encoding of the LocalDUTState.

func SetupContext

func SetupContext(ctx context.Context, namespace string) context.Context

SetupContext set up the outgoing context for API calls.

func UFSClient

func UFSClient(ctx context.Context, b *Info) (ufsAPI.FleetClient, error)

UFSClient returns a FleetClient to communicate with UFS service. The context should use an explicit service account using WithTaskAccount or WithSystemAccount; otherwise the default service account is used.

func Unmarshal

func Unmarshal(data []byte, lds *LocalDUTState) error

Unmarshal decodes LocalDUTState from the encoded data.

func WithSystemAccount

func WithSystemAccount(ctx context.Context) (context.Context, error)

WithSystemAccount returns acontext to using the Swarming bot system service account.

func WithTaskAccount

func WithTaskAccount(ctx context.Context) (context.Context, error)

WithTaskAccount returns a context using the Swarming task service account.

Types

type Info

type Info struct {
	AdminService     string
	AutotestPath     string
	BotDUTID         string
	InventoryService string
	UFSService       string
	LuciferBinDir    string
	ParserPath       string
	SwarmingService  string
	LabpackDir       string
	IsSchedulingUnit bool
	Task             Task
}

Info contains information about the current Swarming bot.

func GetInfo

func GetInfo() *Info

GetInfo returns the Info for the current Swarming bot, built from environment variables.

Per-bot variables:

ADMIN_SERVICE: Admin service host, e.g. foo.appspot.com.
INVENTORY_SERVICE: Inventory V2 service host, e.g. foo.appspot.com.
AUTOTEST_DIR: Path to the autotest checkout on server.
LUCIFER_TOOLS_DIR: Path to the lucifer installation.
PARSER_PATH: Path to the autotest_status_parser installation.
FLEET_RESOURCE_NAME: The name to locate a fleet resource, for now we
                     use swarming dut_id dimension for this purpose.
SWARMING_SERVICE: Swarming service host, e.g. https://foo.appspot.com.
FLEET_MULTIDUTS_FLAG: Indicates if the bot is hosting a Scheduling Unit.

Per-task variables:

SWARMING_TASK_ID: task id of the swarming task being serviced.

func (*Info) LuciferConfig

func (b *Info) LuciferConfig() lucifer.Config

LuciferConfig returns the lucifer.Config for the Swarming bot.

func (*Info) ResultsDir

func (b *Info) ResultsDir() string

ResultsDir returns the path to the results directory used by the bot task.

func (*Info) TaskRunURL

func (b *Info) TaskRunURL() string

TaskRunURL returns the URL for the current Swarming task execution.

type LocalDUTState

type LocalDUTState struct {
	HostState               dutstate.State          `json:"-"`
	ProvisionableLabels     ProvisionableLabels     `json:"provisionable_labels"`
	ProvisionableAttributes ProvisionableAttributes `json:"provisionable_attributes"`
}

LocalDUTState contains persistent DUT information that is cached on the Skylab drone.

type ProvisionableAttributes

type ProvisionableAttributes map[string]string

ProvisionableAttributes stores provisionable attributes for a DUT.

type ProvisionableLabels

type ProvisionableLabels map[string]string

ProvisionableLabels stores provisionable labels for a DUT.

type Task

type Task struct {
	RunID string
}

Task describes the bot's current task.

func (*Task) GsURL

func (t *Task) GsURL(gsBucket string) string

GsURL returns the URL for the Google Storage location of the logs offloaded from this task.

func (*Task) StainlessURL

func (t *Task) StainlessURL() string

StainlessURL returns the URL to the stainless logs browser for logs offloaded from this task.

Directories

Path Synopsis
Package harness manages the setup and teardown of various Swarming bot resources for running lab tasks, like results directories and host info.
Package harness manages the setup and teardown of various Swarming bot resources for running lab tasks, like results directories and host info.
hostinfo
Package hostinfo implements the parts of harness management pertaining to Autotest hostinfo.
Package hostinfo implements the parts of harness management pertaining to Autotest hostinfo.
localdutinfo
Package localdutinfo implements opening and closing a DUT's local dut info stored on local disk(e.g.
Package localdutinfo implements opening and closing a DUT's local dut info stored on local disk(e.g.
resultsdir
Package resultsdir implements Autotest results directory creation and sealing.
Package resultsdir implements Autotest results directory creation and sealing.
ufsdutinfo
Package ufsdutinfo implement loading Skylab DUT inventory(UFS) info for the worker.
Package ufsdutinfo implement loading Skylab DUT inventory(UFS) info for the worker.

Jump to

Keyboard shortcuts

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