swarming

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: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// SSWPath is the default path for skylab_swarming_worker
	SSWPath = "/opt/infra-tools/skylab_swarming_worker"

	// DeployTaskExecutionTimeout is the default timeout for deploy tasks.
	DeployTaskExecutionTimeout = 18000
	// DeployTaskExpiryTimeout is the default timeout for task expiry.
	DeployTaskExpiryTimeout = 7200
	// DeployTaskPriority is the default priority for the task.
	DeployTaskPriority = 29
)
View Source
const (
	// LuciProject is used to tag the chromeos tasks.
	LuciProject = "chromeos"

	// ReserveDUTTaskPriority is the priority used for ReserveDUT task.
	ReserveDUTTaskPriority = 25

	// RepairDUTTaskPriority Priority is the priority used for ReserveDUT task.
	RepairDUTTaskPriority = 25

	// DUTIDDimensionKey is the dimension key for dut ID.
	DUTIDDimensionKey = "dut_id"

	// DUTNameDimensionKey is the dimension key for dut hostname.
	DUTNameDimensionKey = "dut_name"

	// IDDimensionKey is the dimension key for ID.
	IDDimensionKey = "id"

	// PoolDimensionKey is the dimension key for pool.
	PoolDimensionKey = "pool"
)

Variables

This section is empty.

Functions

func MapToSwarmingDimensions

func MapToSwarmingDimensions(dims map[string]string) []*swarming.SwarmingRpcsStringPair

MapToSwarmingDimensions converts from a go map to SwarmingRpcsStringPair

Types

type TaskCreator

type TaskCreator struct {

	// LogdogService is the logdog service for the task logs
	LogdogService string

	// SwarmingServiceAccount is the service account to be used.
	SwarmingServiceAccount string
	// LUCIProject is the name of the project used to create the task.
	LUCIProject string
	// contains filtered or unexported fields
}

TaskCreator creates Swarming tasks

func NewTaskCreator

func NewTaskCreator(ctx context.Context, authFlags *authcli.Flags, swarmingService string) (*TaskCreator, error)

NewTaskCreator creates and initialize the TaskCreator.

func (*TaskCreator) AuditTask

func (tc *TaskCreator) AuditTask(ctx context.Context, serviceAccount, host string, expirationSec int, cmd []string, logDogURL string) (*TaskInfo, error)

AuditTask creates admin_audit task for particular DUT

func (*TaskCreator) DeployDut

func (tc *TaskCreator) DeployDut(ctx context.Context, hostname, dutID, pool string, timeout int64, actions, tags []string, dimensions map[string]string) (*TaskInfo, error)

DeployDut creates a task request for deploy task based on the input.

func (*TaskCreator) GenerateLogdogTaskCode

func (tc *TaskCreator) GenerateLogdogTaskCode()

GenerateLogdogTaskCode generate new unique code for each task used in logdog URL.

func (*TaskCreator) LogdogURL

func (tc *TaskCreator) LogdogURL() string

LogdogURL returns the logdog URL for task logs, empty string if logdog service not set.

The logdogURL has to be unique for each task and to guaranty it please call GenerateLogdogTaskCode() before create new task.

func (*TaskCreator) PrintResults

func (tc *TaskCreator) PrintResults(wr io.Writer, successMap map[string]*TaskInfo, errorMap map[string]error)

PrintResults prints results of the task creation.

func (*TaskCreator) RepairTask

func (tc *TaskCreator) RepairTask(ctx context.Context, serviceAccount, host string, expirationSec int, cmd []string, logDogURL string) (*TaskInfo, error)

RepairTask creates admin_repair task for particular DUT

func (*TaskCreator) ReserveDUT

func (tc *TaskCreator) ReserveDUT(ctx context.Context, serviceAccount, host, user string) (*TaskInfo, error)

ReserveDUT schedule task to change DUT state to reserved

func (*TaskCreator) SessionTasksURL

func (tc *TaskCreator) SessionTasksURL() string

SessionTasksURL gets URL to see all created tasks belong to the session.

func (*TaskCreator) VerifyTask

func (tc *TaskCreator) VerifyTask(ctx context.Context, serviceAccount, host string, expirationSec int, cmd []string, logDogURL string) (*TaskInfo, error)

VerifyTask creates admin_repair task for particular DUT

type TaskInfo

type TaskInfo struct {
	// ID of the created task in the Swarming.
	ID string
	// TaskURL provides the URL to the created task in Swarming.
	TaskURL string
}

TaskInfo contains information of the created task.

Jump to

Keyboard shortcuts

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