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

Overview

Package swarming implements a client for creating skylab-swarming tasks and getting their results.

Index

Constants

View Source
const SkylabPool = "ChromeOSSkylab"

SkylabPool is the swarming pool for all skylab bots.

Variables

This section is empty.

Functions

func LookupDimension

func LookupDimension(dims []*swarming_api.SwarmingRpcsStringListPair, key string) (string, error)

LookupDimension gets a single string value associated with a dimension

func TaskListURLForTags

func TaskListURLForTags(swarmingService string, tags []string) string

TaskListURLForTags returns a tasklist URL filtered by the given tags.

func TaskURL

func TaskURL(swarmingService string, taskID string) string

TaskURL returns a URL to inspect a task with the given ID.

Types

type Client

type Client struct {
	SwarmingService *swarming_api.Service
	// contains filtered or unexported fields
}

Client is a swarming client for creating tasks and waiting for their results.

func NewClient

func NewClient(h *http.Client, server string) (*Client, error)

NewClient creates a new Client.

func (*Client) BotExists

func (c *Client) BotExists(ctx context.Context, dims []*swarming_api.SwarmingRpcsStringPair) (bool, error)

BotExists checks if an bot exists with the given dimensions.

func (*Client) CancelTask

func (c *Client) CancelTask(ctx context.Context, taskID string) error

CancelTask cancels a swarming task by taskID, retrying transient errors.

func (*Client) CreateTask

CreateTask creates a swarming task based on the given request, retrying transient errors.

func (*Client) DutNameToBotID

func (c *Client) DutNameToBotID(ctx context.Context, host string) (string, error)

DutNameToBotID gets the bot id associated with a particular dut by its hostname.

func (*Client) GetActiveLeaseTasksForBoard

func (c *Client) GetActiveLeaseTasksForBoard(ctx context.Context, board string) ([]*swarming_api.SwarmingRpcsTaskResult, error)

GetActiveLeaseTasksForBoard gets active leases *specifically* targeted to a board.

func (*Client) GetActiveLeaseTasksForModel

func (c *Client) GetActiveLeaseTasksForModel(ctx context.Context, model string) ([]*swarming_api.SwarmingRpcsTaskResult, error)

GetActiveLeaseTasksForModel gets active leases *specifically* targeted to a model. Leases that apply to a specific hostname are not counted here. TODO(gregorynisbet): Count leases that target specific hostnames as well.

func (*Client) GetBotIDs

func (c *Client) GetBotIDs(ctx context.Context, dims []*swarming_api.SwarmingRpcsStringPair) ([]string, error)

GetBotIDs returns slice of bot IDs by given dimensions.

func (*Client) GetBots

GetBots returns a slice of bots

func (*Client) GetFlatBotDimensionsForTask

func (c *Client) GetFlatBotDimensionsForTask(ctx context.Context, taskID string) (map[string]string, error)

GetFlatBotDimensionsForTask takes a task id and returns the dimensions of the bot that is currently running the task. The output map has exactly one value per dimension. Dimensions where a key k maps to multiple values v1, v2, v3 ... correspond to the pair (k, v1) in the output map. Keys that are present but have no values associated with them get the magical sentinel value "". If the bot does not exist, then an error is returned instead.

func (*Client) GetListedBots

func (c *Client) GetListedBots(ctx context.Context, dims []*swarming_api.SwarmingRpcsStringPair) ([]*ListedHost, error)

GetListedBots returns information about the DUTs managed by bots satisfying particular dimensions.

func (*Client) GetRequests

func (c *Client) GetRequests(ctx context.Context, IDs []string) ([]*swarming_api.SwarmingRpcsTaskRequest, error)

GetRequests gets the task requests for the given task IDs, retrying transient errors.

func (*Client) GetResults

func (c *Client) GetResults(ctx context.Context, IDs []string) ([]*swarming_api.SwarmingRpcsTaskResult, error)

GetResults gets results for the tasks with given IDs, retrying transient errors.

func (*Client) GetResultsForTags

func (c *Client) GetResultsForTags(ctx context.Context, tags []string) ([]*swarming_api.SwarmingRpcsTaskResult, error)

GetResultsForTags gets results for tasks that match all the given tags, retrying transient errors.

func (*Client) GetTaskOutputs

func (c *Client) GetTaskOutputs(ctx context.Context, IDs []string) ([]*swarming_api.SwarmingRpcsTaskOutput, error)

GetTaskOutputs gets the task outputs for the given IDs, retrying transient errors.

func (*Client) GetTaskState

func (c *Client) GetTaskState(ctx context.Context, ID string) (*swarming_api.SwarmingRpcsTaskStates, error)

GetTaskState gets the state of the given task, retrying transient errors.

func (*Client) GetTaskURL

func (c *Client) GetTaskURL(taskID string) string

GetTaskURL gets a URL for the task with the given ID.

type ListedHost

type ListedHost struct {
	Hostname string
}

ListedHost is a collection of information about the DUT managed by a particular bot.

func (*ListedHost) String

func (l *ListedHost) String() string

Jump to

Keyboard shortcuts

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