Documentation ¶
Index ¶
- Constants
- func MapToSwarmingDimensions(dims map[string]string) []*swarming.SwarmingRpcsStringPair
- type TaskCreator
- func (tc *TaskCreator) AuditTask(ctx context.Context, serviceAccount, host string, expirationSec int, ...) (*TaskInfo, error)
- func (tc *TaskCreator) DeployDut(ctx context.Context, hostname, dutID, pool string, timeout int64, ...) (*TaskInfo, error)
- func (tc *TaskCreator) GenerateLogdogTaskCode()
- func (tc *TaskCreator) LogdogURL() string
- func (tc *TaskCreator) PrintResults(wr io.Writer, successMap map[string]*TaskInfo, errorMap map[string]error)
- func (tc *TaskCreator) RepairTask(ctx context.Context, serviceAccount, host string, expirationSec int, ...) (*TaskInfo, error)
- func (tc *TaskCreator) ReserveDUT(ctx context.Context, serviceAccount, host, user string) (*TaskInfo, error)
- func (tc *TaskCreator) SessionTasksURL() string
- func (tc *TaskCreator) VerifyTask(ctx context.Context, serviceAccount, host string, expirationSec int, ...) (*TaskInfo, error)
- type TaskInfo
Constants ¶
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 )
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.