Documentation
¶
Overview ¶
This service manages workers, including provisioning for dynamic worker pools.
Methods interacting with a provider may return a 503 response if that provider has not been able to start up, such as if the service to which it interfaces has an outage. Such requests can be retried as for any other 5xx response.
See:
How to use this package ¶
First create a WorkerManager object:
workerManager := tcworkermanager.New(nil)
and then call one or more of workerManager's methods, e.g.:
err := workerManager.Ping(.....)
handling any errors...
if err != nil {
// handle error...
}
Taskcluster Schema ¶
The source code of this go package was auto-generated from the API definition at <rootUrl>/references/worker-manager/v1/api.json together with the input and output schemas it references,
Index ¶
- type AwsProviderType
- type AzureProviderType
- type Credentials
- type Credentials1
- type GoogleProviderType
- type ListWorkersResponse
- type ProviderList
- type QuarantineDetails
- type RegisterWorkerRequest
- type RegisterWorkerResponse
- type ReregisterWorkerRequest
- type ReregisterWorkerResponse
- type ShouldWorkerTerminateResponse
- type Source
- type Source1
- type StaticProviderType
- type StaticProviderType1
- type TaskMetadata
- type TaskRun
- type Totals
- type Var
- type Var1
- type Var2
- type Var3
- type Var4
- type Worker
- type WorkerAction
- type WorkerCreationUpdateRequest
- type WorkerErrorReport
- type WorkerFullDefinition
- type WorkerListInAGivenWorkerPool
- type WorkerManager
- func (workerManager *WorkerManager) CreateWorker(workerPoolId, workerGroup, workerId string, ...) (*WorkerFullDefinition, error)
- func (workerManager *WorkerManager) CreateWorkerPool(workerPoolId string, payload *WorkerPoolDefinition) (*WorkerPoolFullDefinition, error)
- func (workerManager *WorkerManager) DeleteWorkerPool(workerPoolId string) (*WorkerPoolFullDefinition, error)
- func (workerManager *WorkerManager) GetWorker(provisionerId, workerType, workerGroup, workerId string) (*WorkerResponse, error)
- func (workerManager *WorkerManager) GetWorker_SignedURL(provisionerId, workerType, workerGroup, workerId string, ...) (*url.URL, error)
- func (workerManager *WorkerManager) Heartbeat() error
- func (workerManager *WorkerManager) Lbheartbeat() error
- func (workerManager *WorkerManager) ListProviders(continuationToken, limit string) (*ProviderList, error)
- func (workerManager *WorkerManager) ListProviders_SignedURL(continuationToken, limit string, duration time.Duration) (*url.URL, error)
- func (workerManager *WorkerManager) ListWorkerPoolErrors(workerPoolId, continuationToken, errorId, launchConfigId, limit string) (*WorkerPoolErrorList, error)
- func (workerManager *WorkerManager) ListWorkerPoolErrors_SignedURL(workerPoolId, continuationToken, errorId, launchConfigId, limit string, ...) (*url.URL, error)
- func (workerManager *WorkerManager) ListWorkerPoolLaunchConfigs(workerPoolId, continuationToken, includeArchived, limit string) (*WorkerPoolLaunchConfigList, error)
- func (workerManager *WorkerManager) ListWorkerPoolLaunchConfigs_SignedURL(workerPoolId, continuationToken, includeArchived, limit string, ...) (*url.URL, error)
- func (workerManager *WorkerManager) ListWorkerPools(continuationToken, limit string) (*WorkerPoolList, error)
- func (workerManager *WorkerManager) ListWorkerPoolsStats(continuationToken, limit string) (*WorkerPoolListStats, error)
- func (workerManager *WorkerManager) ListWorkerPoolsStats_SignedURL(continuationToken, limit string, duration time.Duration) (*url.URL, error)
- func (workerManager *WorkerManager) ListWorkerPools_SignedURL(continuationToken, limit string, duration time.Duration) (*url.URL, error)
- func (workerManager *WorkerManager) ListWorkers(...) (*ListWorkersResponse, error)
- func (workerManager *WorkerManager) ListWorkersForWorkerGroup(workerPoolId, workerGroup, continuationToken, limit string) (*WorkerListInAGivenWorkerPool, error)
- func (workerManager *WorkerManager) ListWorkersForWorkerGroup_SignedURL(workerPoolId, workerGroup, continuationToken, limit string, ...) (*url.URL, error)
- func (workerManager *WorkerManager) ListWorkersForWorkerPool(workerPoolId, continuationToken, launchConfigId, limit, state string) (*WorkerListInAGivenWorkerPool, error)
- func (workerManager *WorkerManager) ListWorkersForWorkerPool_SignedURL(workerPoolId, continuationToken, launchConfigId, limit, state string, ...) (*url.URL, error)
- func (workerManager *WorkerManager) ListWorkers_SignedURL(...) (*url.URL, error)
- func (workerManager *WorkerManager) Ping() error
- func (workerManager *WorkerManager) RegisterWorker(payload *RegisterWorkerRequest) (*RegisterWorkerResponse, error)
- func (workerManager *WorkerManager) RemoveWorker(workerPoolId, workerGroup, workerId string) error
- func (workerManager *WorkerManager) ReportWorkerError(workerPoolId string, payload *WorkerErrorReport) (*WorkerPoolError, error)
- func (workerManager *WorkerManager) ReregisterWorker(payload *ReregisterWorkerRequest) (*ReregisterWorkerResponse, error)
- func (workerManager *WorkerManager) ShouldWorkerTerminate(workerPoolId, workerGroup, workerId string) (*ShouldWorkerTerminateResponse, error)
- func (workerManager *WorkerManager) ShouldWorkerTerminate_SignedURL(workerPoolId, workerGroup, workerId string, duration time.Duration) (*url.URL, error)
- func (workerManager *WorkerManager) UpdateWorker(workerPoolId, workerGroup, workerId string, ...) (*WorkerFullDefinition, error)
- func (workerManager *WorkerManager) UpdateWorkerPool(workerPoolId string, payload *WorkerPoolDefinition1) (*WorkerPoolFullDefinition, error)
- func (workerManager *WorkerManager) Version() error
- func (workerManager *WorkerManager) Worker(workerPoolId, workerGroup, workerId string) (*WorkerFullDefinition, error)
- func (workerManager *WorkerManager) WorkerPool(workerPoolId string) (*WorkerPoolFullDefinition, error)
- func (workerManager *WorkerManager) WorkerPoolErrorStats(workerPoolId string) (*WorkerPoolErrorStats, error)
- func (workerManager *WorkerManager) WorkerPoolErrorStats_SignedURL(workerPoolId string, duration time.Duration) (*url.URL, error)
- func (workerManager *WorkerManager) WorkerPoolStats(workerPoolId string) (*WorkerPoolStatistics, error)
- func (workerManager *WorkerManager) WorkerPoolStats_SignedURL(workerPoolId string, duration time.Duration) (*url.URL, error)
- func (workerManager *WorkerManager) WorkerPool_SignedURL(workerPoolId string, duration time.Duration) (*url.URL, error)
- func (workerManager *WorkerManager) Worker_SignedURL(workerPoolId, workerGroup, workerId string, duration time.Duration) (*url.URL, error)
- type WorkerPoolDefinition
- type WorkerPoolDefinition1
- type WorkerPoolError
- type WorkerPoolErrorList
- type WorkerPoolErrorStats
- type WorkerPoolFullDefinition
- type WorkerPoolID
- type WorkerPoolLaunchConfigList
- type WorkerPoolList
- type WorkerPoolListStats
- type WorkerPoolStatistics
- type WorkerResponse
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AwsProviderType ¶
type AwsProviderType struct {
// Instance identity document that is obtained by
// curl http://169.254.169.254/latest/dynamic/instance-identity/document on the instance
Document string `json:"document"`
// The signature for instance identity document. Can be obtained by
// curl http://169.254.169.254/latest/dynamic/instance-identity/signature on the instance
Signature string `json:"signature"`
}
Proof that this call is coming from the worker identified by the other fields. The form of this proof varies depending on the provider type.
type AzureProviderType ¶
type AzureProviderType struct {
// Attested data document that is obtained by
// curl http://169.254.169.254/metadata/attested/document on the instance
Document string `json:"document"`
}
Proof that this call is coming from the worker identified by the other fields. The form of this proof varies depending on the provider type.
type Credentials ¶
type Credentials struct {
AccessToken string `json:"accessToken"`
// Note that a certificate may not be provided, if the credentials are not temporary.
Certificate string `json:"certificate,omitempty"`
ClientID string `json:"clientId"`
}
The credentials the worker will need to perform its work. Specifically, credentials with scopes * `assume:worker-pool:<workerPoolId>` * `assume:worker-id:<workerGroup>/<workerId>` * `queue:worker-id:<workerGroup>/<workerId>` * `secrets:get:worker-pool:<workerPoolId>` * `queue:claim-work:<workerPoolId>` * `worker-manager:remove-worker:<workerPoolId>/<workerGroup>/<workerId>`
type Credentials1 ¶
type Credentials1 struct {
AccessToken string `json:"accessToken"`
// Note that a certificate may not be provided, if the credentials are not temporary.
Certificate string `json:"certificate,omitempty"`
ClientID string `json:"clientId"`
}
The credentials the worker will need to perform its work. Specifically, credentials with scopes * `assume:worker-pool:<workerPoolId>` * `assume:worker-id:<workerGroup>/<workerId>` * `queue:worker-id:<workerGroup>/<workerId>` * `secrets:get:worker-pool:<workerPoolId>` * `queue:claim-work:<workerPoolId>` * `worker-manager:remove-worker:<workerPoolId>/<workerGroup>/<workerId>` * `worker-manager:reregister-worker:<workerPoolId>/<workerGroup>/<workerId>`
type GoogleProviderType ¶
type GoogleProviderType struct {
// A JWT token as defined in [this google documentation](https://cloud.google.com/compute/docs/instances/verifying-instance-identity)
Token string `json:"token"`
}
Proof that this call is coming from the worker identified by the other fields. The form of this proof varies depending on the provider type.
type ListWorkersResponse ¶
type ListWorkersResponse struct {
// Opaque `continuationToken` to be given as query-string option to get the
// next set of workers in the worker-type.
// This property is only present if another request is necessary to fetch all
// results. In practice the next request with a `continuationToken` may not
// return additional results, but it can. Thus, you can only be sure to have
// all the results if you've called `listWorkerTypes` with `continuationToken`
// until you get a result without a `continuationToken`.
ContinuationToken string `json:"continuationToken,omitempty"`
// List of workers in this worker-type.
Workers []Worker `json:"workers"`
}
Response from a `listWorkers` request.
type ProviderList ¶
type ProviderList struct {
// Opaque `continuationToken` to be given as query-string option to get the
// next set of workers in the worker-manager.
// This property is only present if another request is necessary to fetch all
// results. In practice the next request with a `continuationToken` may not
// return additional results, but it can. Thus, you can only be sure to have
// all the results if you've called `listWorkerPools` with `continuationToken`
// until you get a result without a `continuationToken`.
ContinuationToken string `json:"continuationToken,omitempty"`
// List of all providers
Providers []Var `json:"providers"`
}
A list of providers
type QuarantineDetails ¶
type QuarantineDetails struct {
// The clientId of the client that made the request to quarantine the worker.
ClientID string `json:"clientId"`
// Usually a reason for the quarantine.
QuarantineInfo string `json:"quarantineInfo"`
// Value of the worker's quarantineUntil property at the moment of the quarantine.
QuarantineUntil tcclient.Time `json:"quarantineUntil"`
// Time when the quarantine was updated.
UpdatedAt tcclient.Time `json:"updatedAt"`
}
Information about when and why a worker was quarantined.
type RegisterWorkerRequest ¶
type RegisterWorkerRequest struct {
// The provider that had started the worker and responsible for managing it.
// Can be different from the provider that's currently in the worker pool config.
//
// Syntax: ^([a-zA-Z0-9-_]*)$
// Min length: 1
// Max length: 38
ProviderID string `json:"providerId"`
// The time that the worker's system booted.
// This is used to increase granularity of worker
// registration time metrics.
// See https://github.com/taskcluster/taskcluster/issues/8232.
SystemBootTime tcclient.Time `json:"systemBootTime,omitzero"`
// Worker group to which this worker belongs
//
// Syntax: ^([a-zA-Z0-9-_]*)$
// Min length: 1
// Max length: 38
WorkerGroup string `json:"workerGroup"`
// Worker ID
//
// Syntax: ^([a-zA-Z0-9-_]*)$
// Min length: 1
// Max length: 38
WorkerID string `json:"workerId"`
// Proof that this call is coming from the worker identified by the other fields.
// The form of this proof varies depending on the provider type.
//
// One of:
// * GoogleProviderType
// * StaticProviderType1
// * AwsProviderType
// * AzureProviderType
WorkerIdentityProof json.RawMessage `json:"workerIdentityProof"`
// The ID of this worker pool (of the form `providerId/workerType` for compatibility)
//
// Syntax: ^[a-zA-Z0-9-_]{1,38}/[a-z]([-a-z0-9]{0,36}[a-z0-9])?$
WorkerPoolID string `json:"workerPoolId"`
}
Request body to `registerWorker`.
type RegisterWorkerResponse ¶
type RegisterWorkerResponse struct {
// The credentials the worker
// will need to perform its work. Specifically, credentials with scopes
// * `assume:worker-pool:<workerPoolId>`
// * `assume:worker-id:<workerGroup>/<workerId>`
// * `queue:worker-id:<workerGroup>/<workerId>`
// * `secrets:get:worker-pool:<workerPoolId>`
// * `queue:claim-work:<workerPoolId>`
// * `worker-manager:remove-worker:<workerPoolId>/<workerGroup>/<workerId>`
Credentials Credentials `json:"credentials"`
// Time at which the included credentials will expire. Workers must either
// re-register (for static workers) or terminate (for dynamically
// provisioned workers) before this time.
Expires tcclient.Time `json:"expires"`
// A secret value generated by worker-manager that can be used in the call to `reregisterWorker`.
// For more information, refer to https://docs.taskcluster.net/docs/reference/core/worker-manager#reregistration.
//
// Syntax: ^[a-zA-Z0-9_-]{44}$
Secret string `json:"secret"`
// This value is supplied unchanged to the worker from the worker-pool configuration.
// The expectation is that the worker will merge this information with configuration from other sources,
// and this is precisely what [worker-runner](https://docs.taskcluster.net/docs/reference/workers/worker-runner) does.
// This property must not be used for secret configuration, as it is visible both in the worker pool configuration and in the worker instance's metadata.
// Instead, put secret configuration in the [secrets service](https://docs.taskcluster.net/docs/reference/workers/worker-runner).
//
// Additional properties allowed
WorkerConfig json.RawMessage `json:"workerConfig"`
}
Response body to `registerWorker`.
type ReregisterWorkerRequest ¶
type ReregisterWorkerRequest struct {
// The secret value that was last configured in `registerWorker` (in the case of a newly registerd worker) or
// `reregisterWorker`.
// For more information, refer to https://docs.taskcluster.net/docs/reference/core/worker-manager#reregistration.
//
// Syntax: ^[a-zA-Z0-9_-]{44}$
Secret string `json:"secret"`
// Worker group to which this worker belongs
//
// Syntax: ^([a-zA-Z0-9-_]*)$
// Min length: 1
// Max length: 38
WorkerGroup string `json:"workerGroup"`
// Worker ID
//
// Syntax: ^([a-zA-Z0-9-_]*)$
// Min length: 1
// Max length: 38
WorkerID string `json:"workerId"`
// The ID of this worker pool (of the form `providerId/workerType` for compatibility)
//
// Syntax: ^[a-zA-Z0-9-_]{1,38}/[a-z]([-a-z0-9]{0,36}[a-z0-9])?$
WorkerPoolID string `json:"workerPoolId"`
}
Request body to `reregisterWorker`.
type ReregisterWorkerResponse ¶
type ReregisterWorkerResponse struct {
// The credentials the worker
// will need to perform its work. Specifically, credentials with scopes
// * `assume:worker-pool:<workerPoolId>`
// * `assume:worker-id:<workerGroup>/<workerId>`
// * `queue:worker-id:<workerGroup>/<workerId>`
// * `secrets:get:worker-pool:<workerPoolId>`
// * `queue:claim-work:<workerPoolId>`
// * `worker-manager:remove-worker:<workerPoolId>/<workerGroup>/<workerId>`
// * `worker-manager:reregister-worker:<workerPoolId>/<workerGroup>/<workerId>`
Credentials Credentials1 `json:"credentials"`
// Time at which the included credentials will expire. Workers must
// re-register before this time.
Expires tcclient.Time `json:"expires"`
// The next secret value needed to reregister the worker (in `reregisterWorker).
// For more information, refer to https://docs.taskcluster.net/docs/reference/core/worker-manager#reregistration.
//
// Syntax: ^[a-zA-Z0-9_-]{44}$
Secret string `json:"secret"`
}
Response body to `reregisterWorker`.
type ShouldWorkerTerminateResponse ¶
type ShouldWorkerTerminateResponse struct {
// Reason why worker should be terminated
//
// Min length: 1
Reason string `json:"reason"`
Terminate bool `json:"terminate"`
}
Decision returned to a worker asking whether to keep running or be terminated
type Source ¶
type Source string
Link to source of this task, should specify a file, revision and repository. This should be place someone can go an do a git/hg blame to who came up with recipe for this task.
Syntax: ^(https?://|ssh://|git@) Max length: 4096
type Source1 ¶
type Source1 string
Link to source of this task, should specify a file, revision and repository. This should be place someone can go an do a git/hg blame to who came up with recipe for this task.
Syntax: ^(https?://|ssh://|git@) Max length: 4096
type StaticProviderType ¶
type StaticProviderType struct {
// A secret value shared with the worker. This value must be passed in the `workerIdentityProof` of the `registerWorker` method.
// The ideal way to generate a secret of this form is `slugid() + slugid()`.
//
// Secrets are traded for Taskcluster credentials, and should be treated with similar care.
// Each worker should have a distinct secret.
//
// Syntax: ^[a-zA-Z0-9_-]{44}$
StaticSecret string `json:"staticSecret"`
}
Provider-specific information
type StaticProviderType1 ¶
type StaticProviderType1 struct {
// The secret value that was configured when the worker was created (in `createWorker`).
//
// Syntax: ^[a-zA-Z0-9_-]{44}$
StaticSecret string `json:"staticSecret"`
}
Proof that this call is coming from the worker identified by the other fields. The form of this proof varies depending on the provider type.
type TaskMetadata ¶
type TaskMetadata struct {
// Human readable description of the task, please **explain** what the
// task does. A few lines of documentation is not going to hurt you.
//
// Max length: 32768
Description string `json:"description"`
// Human readable name of task, used to very briefly given an idea about
// what the task does.
//
// Max length: 255
Name string `json:"name"`
// Entity who caused this task, not necessarily a person with email who did
// `hg push` as it could be automation bots as well. The entity we should
// contact to ask why this task is here.
//
// Max length: 255
Owner string `json:"owner"`
// Link to source of this task, should specify a file, revision and
// repository. This should be place someone can go an do a git/hg blame
// to who came up with recipe for this task.
//
// Syntax: ^(https?://|ssh://|git@)
// Max length: 4096
// Any of:
// * Source
// * Source1
Source string `json:"source"`
}
Required task metadata
type TaskRun ¶
type TaskRun struct {
// Id of this task run, `run-id`s always starts from `0`
//
// Mininum: 0
// Maximum: 1000
RunID int64 `json:"runId"`
// Unique task identifier, this is UUID encoded as
// [URL-safe base64](http://tools.ietf.org/html/rfc4648#section-5) and
// stripped of `=` padding.
//
// Syntax: ^[A-Za-z0-9_-]{8}[Q-T][A-Za-z0-9_-][CGKOSWaeimquy26-][A-Za-z0-9_-]{10}[AQgw]$
TaskID string `json:"taskId"`
}
A run of a task.
type Totals ¶
type Totals struct {
// Breakdown by error code where available
//
// Additional properties allowed
Code json.RawMessage `json:"code"`
// Breakdown by day
//
// Additional properties allowed
Daily json.RawMessage `json:"daily"`
// Breakdown by hour
//
// Additional properties allowed
Hourly json.RawMessage `json:"hourly"`
// Breakdown by launchConfigId where available
//
// Additional properties allowed
LaunchConfig json.RawMessage `json:"launchConfig"`
// Breakdown by title
//
// Additional properties allowed
Title json.RawMessage `json:"title"`
// Total number of errors
Total float64 `json:"total"`
// Breakdown by worker pool if workerPoolId is not specified.
// If specified, this will only include the worker pool specified.
//
// Additional properties allowed
WorkerPool json.RawMessage `json:"workerPool"`
}
type Var1 ¶
type Var1 struct {
// The launch configuration
//
// Additional properties allowed
Configuration json.RawMessage `json:"configuration"`
// Time when this launch configuration was created
Created tcclient.Time `json:"created"`
// Whether this launch configuration is archived
IsArchived bool `json:"isArchived"`
// Time when this launch configuration was last modified
LastModified tcclient.Time `json:"lastModified"`
// Unique identifier for this launch configuration
LaunchConfigID string `json:"launchConfigId"`
// The worker pool ID this launch config belongs to
WorkerPoolID string `json:"workerPoolId"`
}
type Var2 ¶
type Var2 struct {
// Total capacity available across all workers for this launch configuration that are currently not "stopped"
//
// Mininum: 0
CurrentCapacity int64 `json:"currentCapacity"`
// The ID of the launch configuration
LaunchConfigID string `json:"launchConfigId"`
// Total capacity available across all workers for this launch configuration with state "requested"
//
// Mininum: 0
RequestedCapacity int64 `json:"requestedCapacity"`
// Total worker count in "requested" state for this launch configuration
//
// Mininum: 0
RequestedCount int64 `json:"requestedCount"`
// Total capacity available across all workers for this launch configuration with state "running"
//
// Mininum: 0
RunningCapacity int64 `json:"runningCapacity"`
// Total worker count in "running" state for this launch configuration
//
// Mininum: 0
RunningCount int64 `json:"runningCount"`
// Total capacity available across all workers for this launch configuration with state "stopped"
//
// Mininum: 0
StoppedCapacity int64 `json:"stoppedCapacity"`
// Total worker count in "stopped" state for this launch configuration
//
// Mininum: 0
StoppedCount int64 `json:"stoppedCount"`
// Total capacity available across all workers for this launch configuration with state "stopping"
//
// Mininum: 0
StoppingCapacity int64 `json:"stoppingCapacity"`
// Total worker count in "stopping" state for this launch configuration
//
// Mininum: 0
StoppingCount int64 `json:"stoppingCount"`
// The ID of this worker pool
//
// Syntax: ^[a-zA-Z0-9-_]{1,38}/[a-z]([-a-z0-9]{0,36}[a-z0-9])?$
WorkerPoolID string `json:"workerPoolId"`
}
type Var3 ¶
type Var3 struct {
// Total capacity available across all workers for this worker pool that are currently not "stopped"
//
// Mininum: 0
CurrentCapacity int64 `json:"currentCapacity"`
// Total capacity available across all workers for this worker pool with state "requested"
//
// Mininum: 0
RequestedCapacity int64 `json:"requestedCapacity"`
// Total worker count in "requested" state for this worker pool
//
// Mininum: 0
RequestedCount int64 `json:"requestedCount"`
// Total capacity available across all workers for this worker pool with state "running"
//
// Mininum: 0
RunningCapacity int64 `json:"runningCapacity"`
// Total worker count in "running" state for this worker pool
//
// Mininum: 0
RunningCount int64 `json:"runningCount"`
// Total capacity available across all workers for this worker pool with state "stopped"
//
// Mininum: 0
StoppedCapacity int64 `json:"stoppedCapacity"`
// Total worker count in "stopped" state for this worker pool
//
// Mininum: 0
StoppedCount int64 `json:"stoppedCount"`
// Total capacity available across all workers for this worker pool with state "stopping"
//
// Mininum: 0
StoppingCapacity int64 `json:"stoppingCapacity"`
// Total worker count in "stopping" state for this worker pool
//
// Mininum: 0
StoppingCount int64 `json:"stoppingCount"`
// The ID of this worker pool (of the form `providerId/workerType` for compatibility)
//
// Syntax: ^[a-zA-Z0-9-_]{1,38}/[a-z]([-a-z0-9]{0,36}[a-z0-9])?$
WorkerPoolID string `json:"workerPoolId"`
}
type Worker ¶
type Worker struct {
// Number of tasks this worker can handle at once. A worker capacity of 0 means
// the worker is not managed by worker manager and is only known to the queue, the
// true capacity is not known.
//
// Mininum: 0
Capacity int64 `json:"capacity,omitempty"`
// Date of the first time this worker claimed a task.
FirstClaim tcclient.Time `json:"firstClaim,omitzero"`
// Date of the last time this worker was seen active. Updated each time a worker calls
// `queue.claimWork`, `queue.reclaimTask`, and `queue.declareWorker` for this task queue.
// `lastDateActive` is updated every half hour but may be off by up-to half an hour.
// Nonetheless, `lastDateActive` is a good indicator of when the worker was last seen active.
// This defaults to null in the database, and is set to the current time when the worker
// is first seen.
LastDateActive tcclient.Time `json:"lastDateActive,omitzero"`
// A run of a task.
LatestTask TaskRun `json:"latestTask,omitzero"`
// The ID of the launch configuration. Must be unique forever within the worker pool.
// Any change to the launch configuration (except `workerManager` fields) must use a new ID
// to ensure proper tracking of configuration metrics.
// If not provided, worker-manager will generate a unique ID.
// Must be between 1 and 38 characters long and contain only alphanumeric
// characters, dashes, and underscores.
//
// Syntax: ^([a-zA-Z0-9-_]*)$
// Min length: 1
// Max length: 38
LaunchConfigID string `json:"launchConfigId,omitempty"`
// The provider that had started the worker and responsible for managing it.
// Can be different from the provider that's currently in the worker pool config.
// A providerId of "none" is used when the worker is not managed by worker manager.
//
// Syntax: ^([a-zA-Z0-9-_]*)$
// Min length: 1
// Max length: 38
ProviderID string `json:"providerId,omitempty"`
// Quarantining a worker allows the machine to remain alive but not accept jobs.
// Once the quarantineUntil time has elapsed, the worker resumes accepting jobs.
// Note that a quarantine can be lifted by setting `quarantineUntil` to the present time (or
// somewhere in the past).
QuarantineUntil tcclient.Time `json:"quarantineUntil,omitzero"`
// A string specifying the state this worker is in so far as worker-manager knows.
// A "requested" worker is in the process of starting up, and if successful will enter
// the "running" state once it has registered with the `registerWorker` API method. A
// "stopping" worker is in the process of shutting down and deleting resources, while
// a "stopped" worker is completely stopped. Stopped workers are kept for historical
// purposes and are purged when they expire. Note that some providers transition workers
// directly from "running" to "stopped".
// An "standalone" worker is a worker that is not managed by worker-manager, these workers
// are only known by the queue.
//
// Possible values:
// * "requested"
// * "running"
// * "stopping"
// * "stopped"
// * "standalone"
State string `json:"state,omitempty"`
// Identifier for the worker group containing this worker.
//
// Syntax: ^([a-zA-Z0-9-_]*)$
// Min length: 1
// Max length: 38
WorkerGroup string `json:"workerGroup"`
// Identifier for this worker (unique within this worker group).
//
// Syntax: ^([a-zA-Z0-9-_]*)$
// Min length: 1
// Max length: 38
WorkerID string `json:"workerId"`
// Unique identifier for a worker pool
//
// Syntax: ^[a-zA-Z0-9-_]{1,38}/[a-z]([-a-z0-9]{0,36}[a-z0-9])?$
WorkerPoolID string `json:"workerPoolId,omitempty"`
}
type WorkerAction ¶
type WorkerAction struct {
// Only actions with the context `worker` are included.
//
// Possible values:
// * "worker"
Context string `json:"context"`
// Description of the provisioner.
Description string `json:"description"`
// Method to indicate the desired action to be performed for a given resource.
//
// Possible values:
// * "POST"
// * "PUT"
// * "DELETE"
// * "PATCH"
Method string `json:"method"`
// Short names for things like logging/error messages.
Name string `json:"name"`
// Appropriate title for any sort of Modal prompt.
Title json.RawMessage `json:"title"`
// When an action is triggered, a request is made using the `url` and `method`.
// Depending on the `context`, the following parameters will be substituted in the url:
//
// | `context` | Path parameters |
// |-------------|----------------------------------------------------------|
// | provisioner | <provisionerId> |
// | worker-type | <provisionerId>, <workerType> |
// | worker | <provisionerId>, <workerType>, <workerGroup>, <workerId> |
//
// _Note: The request needs to be signed with the user's Taskcluster credentials._
URL string `json:"url"`
}
Actions provide a generic mechanism to expose additional features of a provisioner, worker type, or worker to Taskcluster clients.
An action is comprised of metadata describing the feature it exposes, together with a webhook for triggering it.
The Taskcluster tools site, for example, retrieves actions when displaying provisioners, worker types and workers. It presents the provisioner/worker type/worker specific actions to the user. When the user triggers an action, the web client takes the registered webhook, substitutes parameters into the URL (see `url`), signs the requests with the Taskcluster credentials of the user operating the web interface, and issues the HTTP request.
The level to which the action relates (provisioner, worker type, worker) is called the action context. All actions, regardless of the action contexts, are registered against the provisioner when calling `queue.declareProvisioner`.
The action context is used by the web client to determine where in the web interface to present the action to the user as follows:
| `context` | Tool where action is displayed | |-------------|--------------------------------| | provisioner | Provisioner Explorer | | worker-type | Workers Explorer | | worker | Worker Explorer |
See [actions docs](/docs/reference/platform/taskcluster-queue/docs/actions) for more information.
type WorkerCreationUpdateRequest ¶
type WorkerCreationUpdateRequest struct {
// Number of tasks this worker can handle at once
//
// Mininum: 1
Capacity int64 `json:"capacity,omitempty"`
// Date and time when this worker will be deleted from the DB
Expires tcclient.Time `json:"expires"`
// Provider-specific information
//
// One of:
// * StaticProviderType
ProviderInfo json.RawMessage `json:"providerInfo,omitempty"`
}
Request to create or update a worker. Capacity will default to 1 if not specified.
type WorkerErrorReport ¶
type WorkerErrorReport struct {
// A longer description of what occured in the error.
//
// Max length: 10240
Description string `json:"description"`
// Any extra structured information about this error
//
// Additional properties allowed
Extra json.RawMessage `json:"extra"`
// A general machine-readable way to identify this sort of error.
//
// Syntax: [-a-z0-9]+
// Max length: 128
Kind string `json:"kind"`
// A human-readable version of `kind`.
//
// Max length: 128
Title string `json:"title"`
// Worker group to which this worker belongs
//
// Syntax: ^([a-zA-Z0-9-_]*)$
// Min length: 1
// Max length: 38
WorkerGroup string `json:"workerGroup"`
// Worker ID
//
// Syntax: ^([a-zA-Z0-9-_]*)$
// Min length: 1
// Max length: 38
WorkerID string `json:"workerId"`
}
A report of an error from a worker. This will be recorded with kind `worker-error`.
The worker's `workerGroup` and `workerId` will be added to `extra`.
type WorkerFullDefinition ¶
type WorkerFullDefinition struct {
// Number of tasks this worker can handle at once
//
// Mininum: 1
Capacity int64 `json:"capacity"`
// Date and time when this worker was created
Created tcclient.Time `json:"created"`
// Date and time when this worker will be deleted from the DB
Expires tcclient.Time `json:"expires"`
// Date and time when the state of this worker was verified with a cloud api.
// For providers with nothing to check, this will just be permanently set to the
// time the worker was created.
LastChecked tcclient.Time `json:"lastChecked"`
// Date and time when this worker last changed state
LastModified tcclient.Time `json:"lastModified"`
// The ID of the launch configuration. Must be unique forever within the worker pool.
// Any change to the launch configuration (except `workerManager` fields) must use a new ID
// to ensure proper tracking of configuration metrics.
// If not provided, worker-manager will generate a unique ID.
// Must be between 1 and 38 characters long and contain only alphanumeric
// characters, dashes, and underscores.
//
// Syntax: ^([a-zA-Z0-9-_]*)$
// Min length: 1
// Max length: 38
LaunchConfigID string `json:"launchConfigId,omitempty"`
// The provider that had started the worker and responsible for managing it.
// Can be different from the provider that's currently in the worker pool config.
//
// Syntax: ^([a-zA-Z0-9-_]*)$
// Min length: 1
// Max length: 38
ProviderID string `json:"providerId"`
// A string specifying the state this worker is in so far as worker-manager knows.
// A "requested" worker is in the process of starting up, and if successful will enter
// the "running" state once it has registered with the `registerWorker` API method. A
// "stopping" worker is in the process of shutting down and deleting resources, while
// a "stopped" worker is completely stopped. Stopped workers are kept for historical
// purposes and are purged when they expire. Note that some providers transition workers
// directly from "running" to "stopped".
//
// Possible values:
// * "requested"
// * "running"
// * "stopping"
// * "stopped"
State string `json:"state"`
// Worker group to which this worker belongs
//
// Syntax: ^([a-zA-Z0-9-_]*)$
// Min length: 1
// Max length: 38
WorkerGroup string `json:"workerGroup"`
// Worker ID
//
// Syntax: ^([a-zA-Z0-9-_]*)$
// Min length: 1
// Max length: 38
WorkerID string `json:"workerId"`
// The ID of this worker pool (of the form `providerId/workerType` for compatibility)
//
// Syntax: ^[a-zA-Z0-9-_]{1,38}/[a-z]([-a-z0-9]{0,36}[a-z0-9])?$
WorkerPoolID string `json:"workerPoolId"`
}
A complete worker definition.
type WorkerListInAGivenWorkerPool ¶
type WorkerListInAGivenWorkerPool struct {
// Opaque `continuationToken` to be given as query-string option to get the
// next set of workers in the worker-manager.
// This property is only present if another request is necessary to fetch all
// results. In practice the next request with a `continuationToken` may not
// return additional results, but it can. Thus, you can only be sure to have
// all the results if you've called `listWorkerPools` with `continuationToken`
// until you get a result without a `continuationToken`.
ContinuationToken string `json:"continuationToken,omitempty"`
// List of all workers in a given worker pool
Workers []WorkerFullDefinition `json:"workers"`
}
A list of workers in a given worker pool
type WorkerManager ¶
func New ¶
func New(credentials *tcclient.Credentials, rootURL string) *WorkerManager
New returns a WorkerManager client, configured to run against production. Pass in nil credentials to create a client without authentication. The returned client is mutable, so returned settings can be altered.
workerManager := tcworkermanager.New(
nil, // client without authentication
"http://localhost:1234/my/taskcluster", // taskcluster hosted at this root URL on local machine
)
err := workerManager.Ping(.....) // for example, call the Ping(.....) API endpoint (described further down)...
if err != nil {
// handle errors...
}
func NewFromEnv ¶
func NewFromEnv() *WorkerManager
NewFromEnv returns a *WorkerManager configured from environment variables.
The root URL is taken from TASKCLUSTER_PROXY_URL if set to a non-empty string, otherwise from TASKCLUSTER_ROOT_URL if set, otherwise the empty string.
The credentials are taken from environment variables:
TASKCLUSTER_CLIENT_ID TASKCLUSTER_ACCESS_TOKEN TASKCLUSTER_CERTIFICATE
If TASKCLUSTER_CLIENT_ID is empty/unset, authentication will be disabled.
func (*WorkerManager) CreateWorker ¶
func (workerManager *WorkerManager) CreateWorker(workerPoolId, workerGroup, workerId string, payload *WorkerCreationUpdateRequest) (*WorkerFullDefinition, error)
Create a new worker. This is only useful for worker pools where the provider does not create workers automatically, such as those with a `static` provider type. Providers that do not support creating workers will return a 400 error. See the documentation for the individual providers, and in particular the [static provider](https://docs.taskcluster.net/docs/reference/core/worker-manager/) for more information.
Required scopes:
worker-manager:create-worker:<workerPoolId>/<workerGroup>/<workerId>
See #createWorker
func (*WorkerManager) CreateWorkerPool ¶
func (workerManager *WorkerManager) CreateWorkerPool(workerPoolId string, payload *WorkerPoolDefinition) (*WorkerPoolFullDefinition, error)
Create a new worker pool. If the worker pool already exists, this will throw an error.
Required scopes:
All of: * worker-manager:manage-worker-pool:<workerPoolId> * worker-manager:provider:<providerId>
See #createWorkerPool
func (*WorkerManager) DeleteWorkerPool ¶
func (workerManager *WorkerManager) DeleteWorkerPool(workerPoolId string) (*WorkerPoolFullDefinition, error)
Mark a worker pool for deletion. This is the same as updating the pool to set its providerId to `"null-provider"`, but does not require scope `worker-manager:provider:null-provider`. This will also mark all launch configurations as archived.
Required scopes:
worker-manager:manage-worker-pool:<workerPoolId>
See #deleteWorkerPool
func (*WorkerManager) GetWorker ¶
func (workerManager *WorkerManager) GetWorker(provisionerId, workerType, workerGroup, workerId string) (*WorkerResponse, error)
Stability: *** EXPERIMENTAL ***
Get a worker from a worker-type.
Required scopes:
worker-manager:get-worker:<provisionerId>/<workerType>/<workerGroup>/<workerId>
See #getWorker
func (*WorkerManager) GetWorker_SignedURL ¶
func (workerManager *WorkerManager) GetWorker_SignedURL(provisionerId, workerType, workerGroup, workerId string, duration time.Duration) (*url.URL, error)
Returns a signed URL for GetWorker, valid for the specified duration.
Required scopes:
worker-manager:get-worker:<provisionerId>/<workerType>/<workerGroup>/<workerId>
See GetWorker for more details.
func (*WorkerManager) Heartbeat ¶
func (workerManager *WorkerManager) Heartbeat() error
Respond with a service heartbeat.
This endpoint is used to check on backing services this service depends on.
See #heartbeat
func (*WorkerManager) Lbheartbeat ¶
func (workerManager *WorkerManager) Lbheartbeat() error
Respond without doing anything. This endpoint is used to check that the service is up.
See #lbheartbeat
func (*WorkerManager) ListProviders ¶
func (workerManager *WorkerManager) ListProviders(continuationToken, limit string) (*ProviderList, error)
Retrieve a list of providers that are available for worker pools.
Required scopes:
worker-manager:list-providers
See #listProviders
func (*WorkerManager) ListProviders_SignedURL ¶
func (workerManager *WorkerManager) ListProviders_SignedURL(continuationToken, limit string, duration time.Duration) (*url.URL, error)
Returns a signed URL for ListProviders, valid for the specified duration.
Required scopes:
worker-manager:list-providers
See ListProviders for more details.
func (*WorkerManager) ListWorkerPoolErrors ¶
func (workerManager *WorkerManager) ListWorkerPoolErrors(workerPoolId, continuationToken, errorId, launchConfigId, limit string) (*WorkerPoolErrorList, error)
Get the list of worker pool errors.
Required scopes:
worker-manager:list-worker-pool-errors:<workerPoolId>
See #listWorkerPoolErrors
func (*WorkerManager) ListWorkerPoolErrors_SignedURL ¶
func (workerManager *WorkerManager) ListWorkerPoolErrors_SignedURL(workerPoolId, continuationToken, errorId, launchConfigId, limit string, duration time.Duration) (*url.URL, error)
Returns a signed URL for ListWorkerPoolErrors, valid for the specified duration.
Required scopes:
worker-manager:list-worker-pool-errors:<workerPoolId>
See ListWorkerPoolErrors for more details.
func (*WorkerManager) ListWorkerPoolLaunchConfigs ¶
func (workerManager *WorkerManager) ListWorkerPoolLaunchConfigs(workerPoolId, continuationToken, includeArchived, limit string) (*WorkerPoolLaunchConfigList, error)
Stability: *** EXPERIMENTAL ***
Get the list of launch configurations for a given worker pool. Include archived launch configurations by setting includeArchived=true. By default, only active launch configurations are returned.
Required scopes:
worker-manager:get-worker-pool:<workerPoolId>
See #listWorkerPoolLaunchConfigs
func (*WorkerManager) ListWorkerPoolLaunchConfigs_SignedURL ¶
func (workerManager *WorkerManager) ListWorkerPoolLaunchConfigs_SignedURL(workerPoolId, continuationToken, includeArchived, limit string, duration time.Duration) (*url.URL, error)
Returns a signed URL for ListWorkerPoolLaunchConfigs, valid for the specified duration.
Required scopes:
worker-manager:get-worker-pool:<workerPoolId>
See ListWorkerPoolLaunchConfigs for more details.
func (*WorkerManager) ListWorkerPools ¶
func (workerManager *WorkerManager) ListWorkerPools(continuationToken, limit string) (*WorkerPoolList, error)
Get the list of all the existing worker pools.
Required scopes:
worker-manager:list-worker-pools
See #listWorkerPools
func (*WorkerManager) ListWorkerPoolsStats ¶
func (workerManager *WorkerManager) ListWorkerPoolsStats(continuationToken, limit string) (*WorkerPoolListStats, error)
Stability: *** EXPERIMENTAL ***
Get the stats for all worker pools - number of requested, running, stopping and stopped capacity ¶
Required scopes:
worker-manager:list-worker-pools
See #listWorkerPoolsStats
func (*WorkerManager) ListWorkerPoolsStats_SignedURL ¶
func (workerManager *WorkerManager) ListWorkerPoolsStats_SignedURL(continuationToken, limit string, duration time.Duration) (*url.URL, error)
Returns a signed URL for ListWorkerPoolsStats, valid for the specified duration.
Required scopes:
worker-manager:list-worker-pools
See ListWorkerPoolsStats for more details.
func (*WorkerManager) ListWorkerPools_SignedURL ¶
func (workerManager *WorkerManager) ListWorkerPools_SignedURL(continuationToken, limit string, duration time.Duration) (*url.URL, error)
Returns a signed URL for ListWorkerPools, valid for the specified duration.
Required scopes:
worker-manager:list-worker-pools
See ListWorkerPools for more details.
func (*WorkerManager) ListWorkers ¶
func (workerManager *WorkerManager) ListWorkers(provisionerId, workerType, continuationToken, launchConfigId, limit, quarantined, workerState string) (*ListWorkersResponse, error)
Stability: *** EXPERIMENTAL ***
Get a list of all active workers of a workerType.
`listWorkers` allows a response to be filtered by quarantined and non quarantined workers, as well as the current state of the worker. To filter the query, you should call the end-point with one of [`quarantined`, `workerState`] as a query-string option with a true or false value.
The response is paged. If this end-point returns a `continuationToken`, you should call the end-point again with the `continuationToken` as a query-string option. By default this end-point will list up to 1000 workers in a single page. You may limit this with the query-string parameter `limit`.
Required scopes:
worker-manager:list-workers:<provisionerId>/<workerType>
See #listWorkers
func (*WorkerManager) ListWorkersForWorkerGroup ¶
func (workerManager *WorkerManager) ListWorkersForWorkerGroup(workerPoolId, workerGroup, continuationToken, limit string) (*WorkerListInAGivenWorkerPool, error)
Get the list of all the existing workers in a given group in a given worker pool.
Required scopes:
worker-manager:list-workers:<workerPoolId>/<workerGroup>
See #listWorkersForWorkerGroup
func (*WorkerManager) ListWorkersForWorkerGroup_SignedURL ¶
func (workerManager *WorkerManager) ListWorkersForWorkerGroup_SignedURL(workerPoolId, workerGroup, continuationToken, limit string, duration time.Duration) (*url.URL, error)
Returns a signed URL for ListWorkersForWorkerGroup, valid for the specified duration.
Required scopes:
worker-manager:list-workers:<workerPoolId>/<workerGroup>
See ListWorkersForWorkerGroup for more details.
func (*WorkerManager) ListWorkersForWorkerPool ¶
func (workerManager *WorkerManager) ListWorkersForWorkerPool(workerPoolId, continuationToken, launchConfigId, limit, state string) (*WorkerListInAGivenWorkerPool, error)
Get the list of all the existing workers in a given worker pool.
Required scopes:
worker-manager:list-workers:<workerPoolId>
See #listWorkersForWorkerPool
func (*WorkerManager) ListWorkersForWorkerPool_SignedURL ¶
func (workerManager *WorkerManager) ListWorkersForWorkerPool_SignedURL(workerPoolId, continuationToken, launchConfigId, limit, state string, duration time.Duration) (*url.URL, error)
Returns a signed URL for ListWorkersForWorkerPool, valid for the specified duration.
Required scopes:
worker-manager:list-workers:<workerPoolId>
See ListWorkersForWorkerPool for more details.
func (*WorkerManager) ListWorkers_SignedURL ¶
func (workerManager *WorkerManager) ListWorkers_SignedURL(provisionerId, workerType, continuationToken, launchConfigId, limit, quarantined, workerState string, duration time.Duration) (*url.URL, error)
Returns a signed URL for ListWorkers, valid for the specified duration.
Required scopes:
worker-manager:list-workers:<provisionerId>/<workerType>
See ListWorkers for more details.
func (*WorkerManager) Ping ¶
func (workerManager *WorkerManager) Ping() error
Respond without doing anything. This endpoint is used to check that the service is up.
See #ping
func (*WorkerManager) RegisterWorker ¶
func (workerManager *WorkerManager) RegisterWorker(payload *RegisterWorkerRequest) (*RegisterWorkerResponse, error)
Register a running worker. Workers call this method on worker start-up.
This call both marks the worker as running and returns the credentials the worker will require to perform its work. The worker must provide some proof of its identity, and that proof varies by provider type.
See #registerWorker
func (*WorkerManager) RemoveWorker ¶
func (workerManager *WorkerManager) RemoveWorker(workerPoolId, workerGroup, workerId string) error
Remove an existing worker. The precise behavior of this method depends on the provider implementing the given worker. Some providers do not support removing workers at all, and will return a 400 error. Others may begin removing the worker, but it may remain available via the API (perhaps even in state RUNNING) afterward.
Required scopes:
worker-manager:remove-worker:<workerPoolId>/<workerGroup>/<workerId>
See #removeWorker
func (*WorkerManager) ReportWorkerError ¶
func (workerManager *WorkerManager) ReportWorkerError(workerPoolId string, payload *WorkerErrorReport) (*WorkerPoolError, error)
Report an error that occurred on a worker. This error will be included with the other errors in `listWorkerPoolErrors(workerPoolId)`.
Workers can use this endpoint to report startup or configuration errors that might be associated with the worker pool configuration and thus of interest to a worker-pool administrator.
NOTE: errors are publicly visible. Ensure that none of the content contains secrets or other sensitive information.
Required scopes:
All of: * assume:worker-pool:<workerPoolId> * assume:worker-id:<workerGroup>/<workerId>
See #reportWorkerError
func (*WorkerManager) ReregisterWorker ¶
func (workerManager *WorkerManager) ReregisterWorker(payload *ReregisterWorkerRequest) (*ReregisterWorkerResponse, error)
Stability: *** EXPERIMENTAL ***
Reregister a running worker.
This will generate and return new Taskcluster credentials for the worker on that instance to use. The credentials will not live longer the `registrationTimeout` for that worker. The endpoint will update `terminateAfter` for the worker so that worker-manager does not terminate the instance.
Required scopes:
worker-manager:reregister-worker:<workerPoolId>/<workerGroup>/<workerId>
See #reregisterWorker
func (*WorkerManager) ShouldWorkerTerminate ¶
func (workerManager *WorkerManager) ShouldWorkerTerminate(workerPoolId, workerGroup, workerId string) (*ShouldWorkerTerminateResponse, error)
Stability: *** EXPERIMENTAL ***
Informs if worker should terminate or keep working. Worker might no longer be needed based on the set of factors:
- current capacity of the worker pool
- amount of pending and claimed tasks
- launch configuration changes
Decision is made during provision or scanning loop based on above mentioned conditions.
Required scopes:
worker-manager:should-worker-terminate:<workerPoolId>/<workerGroup>/<workerId>
See #shouldWorkerTerminate
func (*WorkerManager) ShouldWorkerTerminate_SignedURL ¶
func (workerManager *WorkerManager) ShouldWorkerTerminate_SignedURL(workerPoolId, workerGroup, workerId string, duration time.Duration) (*url.URL, error)
Returns a signed URL for ShouldWorkerTerminate, valid for the specified duration.
Required scopes:
worker-manager:should-worker-terminate:<workerPoolId>/<workerGroup>/<workerId>
See ShouldWorkerTerminate for more details.
func (*WorkerManager) UpdateWorker ¶
func (workerManager *WorkerManager) UpdateWorker(workerPoolId, workerGroup, workerId string, payload *WorkerCreationUpdateRequest) (*WorkerFullDefinition, error)
Update an existing worker in-place. Like `createWorker`, this is only useful for worker pools where the provider does not create workers automatically. This method allows updating all fields in the schema unless otherwise indicated in the provider documentation. See the documentation for the individual providers, and in particular the [static provider](https://docs.taskcluster.net/docs/reference/core/worker-manager/) for more information.
Required scopes:
worker-manager:update-worker:<workerPoolId>/<workerGroup>/<workerId>
See #updateWorker
func (*WorkerManager) UpdateWorkerPool ¶
func (workerManager *WorkerManager) UpdateWorkerPool(workerPoolId string, payload *WorkerPoolDefinition1) (*WorkerPoolFullDefinition, error)
Stability: *** EXPERIMENTAL ***
Given an existing worker pool definition, this will modify it and return the new definition.
To delete a worker pool, set its `providerId` to `"null-provider"`. After any existing workers have exited, a cleanup job will remove the worker pool. During that time, the worker pool can be updated again, such as to set its `providerId` to a real provider.
Required scopes:
All of: * worker-manager:manage-worker-pool:<workerPoolId> * worker-manager:provider:<providerId>
See #updateWorkerPool
func (*WorkerManager) Version ¶
func (workerManager *WorkerManager) Version() error
Respond with the JSON version object. https://github.com/mozilla-services/Dockerflow/blob/main/docs/version_object.md
See #version
func (*WorkerManager) Worker ¶
func (workerManager *WorkerManager) Worker(workerPoolId, workerGroup, workerId string) (*WorkerFullDefinition, error)
Get a single worker.
Required scopes:
worker-manager:get-worker:<workerPoolId>/<workerGroup>/<workerId>
See #worker
func (*WorkerManager) WorkerPool ¶
func (workerManager *WorkerManager) WorkerPool(workerPoolId string) (*WorkerPoolFullDefinition, error)
Fetch an existing worker pool defition.
Required scopes:
worker-manager:get-worker-pool:<workerPoolId>
See #workerPool
func (*WorkerManager) WorkerPoolErrorStats ¶
func (workerManager *WorkerManager) WorkerPoolErrorStats(workerPoolId string) (*WorkerPoolErrorStats, error)
Stability: *** EXPERIMENTAL ***
Get the list of worker pool errors count. Contains total count of errors for the past 7 days and 24 hours Also includes total counts grouped by titles of error and error code.
If `workerPoolId` is not specified, it will return the count of all errors ¶
Required scopes:
worker-manager:list-worker-pool-errors:<workerPoolId>
See #workerPoolErrorStats
func (*WorkerManager) WorkerPoolErrorStats_SignedURL ¶
func (workerManager *WorkerManager) WorkerPoolErrorStats_SignedURL(workerPoolId string, duration time.Duration) (*url.URL, error)
Returns a signed URL for WorkerPoolErrorStats, valid for the specified duration.
Required scopes:
worker-manager:list-worker-pool-errors:<workerPoolId>
See WorkerPoolErrorStats for more details.
func (*WorkerManager) WorkerPoolStats ¶
func (workerManager *WorkerManager) WorkerPoolStats(workerPoolId string) (*WorkerPoolStatistics, error)
Stability: *** EXPERIMENTAL ***
Fetch statistics for an existing worker pool, broken down by launch configuration. This includes counts and capacities of requested, running, stopping, and stopped workers.
Required scopes:
worker-manager:get-worker-pool:<workerPoolId>
See #workerPoolStats
func (*WorkerManager) WorkerPoolStats_SignedURL ¶
func (workerManager *WorkerManager) WorkerPoolStats_SignedURL(workerPoolId string, duration time.Duration) (*url.URL, error)
Returns a signed URL for WorkerPoolStats, valid for the specified duration.
Required scopes:
worker-manager:get-worker-pool:<workerPoolId>
See WorkerPoolStats for more details.
func (*WorkerManager) WorkerPool_SignedURL ¶
func (workerManager *WorkerManager) WorkerPool_SignedURL(workerPoolId string, duration time.Duration) (*url.URL, error)
Returns a signed URL for WorkerPool, valid for the specified duration.
Required scopes:
worker-manager:get-worker-pool:<workerPoolId>
See WorkerPool for more details.
func (*WorkerManager) Worker_SignedURL ¶
func (workerManager *WorkerManager) Worker_SignedURL(workerPoolId, workerGroup, workerId string, duration time.Duration) (*url.URL, error)
Returns a signed URL for Worker, valid for the specified duration.
Required scopes:
worker-manager:get-worker:<workerPoolId>/<workerGroup>/<workerId>
See Worker for more details.
type WorkerPoolDefinition ¶
type WorkerPoolDefinition struct {
// Additional properties allowed
Config json.RawMessage `json:"config"`
// A description of this worker pool.
//
// Max length: 10240
Description string `json:"description"`
// If true, the owner should be emailed on provisioning errors
EmailOnError bool `json:"emailOnError"`
// An email address to notify when there are provisioning errors for this
// worker pool.
Owner string `json:"owner"`
// The provider responsible for managing this worker pool.
//
// If this value is `"null-provider"`, then the worker pool is pending deletion
// once all existing workers have terminated.
//
// Syntax: ^([a-zA-Z0-9-_]*)$
// Min length: 1
// Max length: 38
ProviderID string `json:"providerId"`
}
Fields that are defined by a user for a worker pool. Used to create worker-pool definitions. There is a larger set of fields for viewing since some parts are generated by the service.
type WorkerPoolDefinition1 ¶
type WorkerPoolDefinition1 struct {
// Additional properties allowed
Config json.RawMessage `json:"config"`
// Ignored on update
Created tcclient.Time `json:"created,omitzero"`
// A description of this worker pool.
//
// Max length: 10240
Description string `json:"description"`
// If true, the owner should be emailed on provisioning errors
EmailOnError bool `json:"emailOnError"`
// Ignored on update
LastModified tcclient.Time `json:"lastModified,omitzero"`
// An email address to notify when there are provisioning errors for this
// worker pool.
Owner string `json:"owner"`
// The provider responsible for managing this worker pool.
//
// If this value is `"null-provider"`, then the worker pool is pending deletion
// once all existing workers have terminated.
//
// Syntax: ^([a-zA-Z0-9-_]*)$
// Min length: 1
// Max length: 38
ProviderID string `json:"providerId"`
// Syntax: ^[a-zA-Z0-9-_]{1,38}/[a-z]([-a-z0-9]{0,36}[a-z0-9])?$
WorkerPoolID string `json:"workerPoolId,omitempty"`
}
Fields that are defined by a user for a worker pool. Used to modify worker-pool definitions.
The `workerPoolId`, `created`, and `lastModified` fields are optional and allowed only to ease the common practice of getting a worker pool definition with `workerPool(..)`, modifying it, and writing it back with `updateWorkerPool(..). `workerPoolId` must be correct if supplied, and the values of `created` and `lastModified` are ignored.
type WorkerPoolError ¶
type WorkerPoolError struct {
// A longer description of what occured in the error.
//
// Max length: 10240
Description string `json:"description"`
// An arbitary unique identifier for this error
//
// Syntax: ^[A-Za-z0-9_-]{8}[Q-T][A-Za-z0-9_-][CGKOSWaeimquy26-][A-Za-z0-9_-]{10}[AQgw]$
ErrorID string `json:"errorId"`
// Any extra structured information about this error
//
// Additional properties allowed
Extra json.RawMessage `json:"extra"`
// A general machine-readable way to identify this sort of error.
//
// Syntax: [-a-z0-9]+
// Max length: 128
Kind string `json:"kind"`
// The launch config ID that was used when the error occurred.
//
// Syntax: ^([a-zA-Z0-9-_]*)$
// Min length: 1
// Max length: 38
LaunchConfigID string `json:"launchConfigId,omitempty"`
// Date and time when this error was reported
Reported tcclient.Time `json:"reported"`
// A human-readable version of `kind`.
//
// Max length: 128
Title string `json:"title"`
// The ID of this worker pool (of the form `providerId/workerType` for compatibility)
//
// Syntax: ^[a-zA-Z0-9-_]{1,38}/[a-z]([-a-z0-9]{0,36}[a-z0-9])?$
WorkerPoolID string `json:"workerPoolId"`
}
A complete worker pool error definition.
type WorkerPoolErrorList ¶
type WorkerPoolErrorList struct {
// Opaque `continuationToken` to be given as query-string option to get the
// next set of worker-types in the worker-manager.
// This property is only present if another request is necessary to fetch all
// results. In practice the next request with a `continuationToken` may not
// return additional results, but it can. Thus, you can only be sure to have
// all the results if you've called `listWorkerPools` with `continuationToken`
// until you get a result without a `continuationToken`.
ContinuationToken string `json:"continuationToken,omitempty"`
// List of worker pool errors
WorkerPoolErrors []WorkerPoolError `json:"workerPoolErrors"`
}
A list of worker pool errors
type WorkerPoolErrorStats ¶
type WorkerPoolErrorStats struct {
Totals Totals `json:"totals"`
// One of:
// * WorkerPoolID
// * Var4
WorkerPoolID json.RawMessage `json:"workerPoolId"`
}
Total number of errors for given worker pool or all worker pools broken down daily for the past 7 days, hourly for the past 24 hours. Also includes breakdown by title and error code.
type WorkerPoolFullDefinition ¶
type WorkerPoolFullDefinition struct {
// Additional properties allowed
Config json.RawMessage `json:"config"`
// Date and time when this worker pool was created
Created tcclient.Time `json:"created"`
// Total capacity available across all workers for this worker pool that are currently not "stopped"
//
// Mininum: 0
CurrentCapacity int64 `json:"currentCapacity"`
// A description of this worker pool.
//
// Max length: 10240
Description string `json:"description"`
// If true, the owner should be emailed on provisioning errors
EmailOnError bool `json:"emailOnError"`
// Date and time when this worker pool was last updated
LastModified tcclient.Time `json:"lastModified"`
// An email address to notify when there are provisioning errors for this
// worker pool.
Owner string `json:"owner"`
// The provider responsible for managing this worker pool.
//
// If this value is `"null-provider"`, then the worker pool is pending deletion
// once all existing workers have terminated.
//
// Syntax: ^([a-zA-Z0-9-_]*)$
// Min length: 1
// Max length: 38
ProviderID string `json:"providerId"`
// Total capacity available across all workers for this worker pool with state "requested"
//
// Mininum: 0
RequestedCapacity int64 `json:"requestedCapacity"`
// Total worker count in "requested" state for this worker pool
//
// Mininum: 0
RequestedCount int64 `json:"requestedCount"`
// Total capacity available across all workers for this worker pool with state "running"
//
// Mininum: 0
RunningCapacity int64 `json:"runningCapacity"`
// Total worker count in "running" state for this worker pool
//
// Mininum: 0
RunningCount int64 `json:"runningCount"`
// Total capacity available across all workers for this worker pool with state "stopped"
//
// Mininum: 0
StoppedCapacity int64 `json:"stoppedCapacity"`
// Total worker count in "stopped" state for this worker pool
//
// Mininum: 0
StoppedCount int64 `json:"stoppedCount"`
// Total capacity available across all workers for this worker pool with state "stopping"
//
// Mininum: 0
StoppingCapacity int64 `json:"stoppingCapacity"`
// Total worker count in "stopping" state for this worker pool
//
// Mininum: 0
StoppingCount int64 `json:"stoppingCount"`
// The ID of this worker pool (of the form `providerId/workerType` for compatibility)
//
// Syntax: ^[a-zA-Z0-9-_]{1,38}/[a-z]([-a-z0-9]{0,36}[a-z0-9])?$
WorkerPoolID string `json:"workerPoolId,omitempty"`
}
A complete worker pool definition.
type WorkerPoolID ¶
type WorkerPoolID string
The ID of this worker pool (of the form `providerId/workerType` for compatibility)
Syntax: ^[a-zA-Z0-9-_]{1,38}/[a-z]([-a-z0-9]{0,36}[a-z0-9])?$
type WorkerPoolLaunchConfigList ¶
type WorkerPoolLaunchConfigList struct {
// Opaque `continuationToken` to be given as query-string option to get the
// next set of worker pool launch configurations.
// This property is only present if another request is necessary to fetch all
// results. In practice the next request with a `continuationToken` may not
// return additional results, but it can. Thus, you can only be sure to have
// all the results if you've called `listWorkerPoolLaunchConfigs` with `continuationToken`
// until you get a result without a `continuationToken`.
ContinuationToken string `json:"continuationToken,omitempty"`
// List of all worker pool launch configurations
WorkerPoolLaunchConfigs []Var1 `json:"workerPoolLaunchConfigs"`
}
A list of worker pool launch configurations
type WorkerPoolList ¶
type WorkerPoolList struct {
// Opaque `continuationToken` to be given as query-string option to get the
// next set of worker-types in the worker-manager.
// This property is only present if another request is necessary to fetch all
// results. In practice the next request with a `continuationToken` may not
// return additional results, but it can. Thus, you can only be sure to have
// all the results if you've called `listWorkerPools` with `continuationToken`
// until you get a result without a `continuationToken`.
ContinuationToken string `json:"continuationToken,omitempty"`
// List of all worker pools
WorkerPools []WorkerPoolFullDefinition `json:"workerPools"`
}
A list of worker pools
type WorkerPoolListStats ¶
type WorkerPoolListStats struct {
// Opaque `continuationToken` to be given as query-string option to get the
// next set of worker-types in the worker-manager.
// This property is only present if another request is necessary to fetch all
// results. In practice the next request with a `continuationToken` may not
// return additional results, but it can. Thus, you can only be sure to have
// all the results if you've called `listWorkerPoolsStats` with `continuationToken`
// until you get a result without a `continuationToken`.
ContinuationToken string `json:"continuationToken,omitempty"`
// List of all worker pools stats
WorkerPoolsStats []Var3 `json:"workerPoolsStats"`
}
A list of worker pools stats
type WorkerPoolStatistics ¶
type WorkerPoolStatistics struct {
// Statistics broken down by launch configuration
LaunchConfigStats []Var2 `json:"launchConfigStats"`
}
Statistics for a worker pool, showing counts and capacities of workers in different states, broken down by launch configuration.
type WorkerResponse ¶
type WorkerResponse struct {
Actions []WorkerAction `json:"actions"`
// Number of tasks this worker can handle at once. A worker capacity of 0 means
// the worker is not managed by worker manager and is only known to the queue, the
// true capacity is not known.
//
// Mininum: 0
Capacity int64 `json:"capacity,omitempty"`
// Date and time after which the worker will be automatically
// deleted by the queue.
Expires tcclient.Time `json:"expires"`
// Date of the first time this worker claimed a task.
FirstClaim tcclient.Time `json:"firstClaim"`
// Date of the last time this worker was seen active. Updated each time a worker calls
// `queue.claimWork`, `queue.reclaimTask`, and `queue.declareWorker` for this task queue.
// `lastDateActive` is updated every half hour but may be off by up-to half an hour.
// Nonetheless, `lastDateActive` is a good indicator of when the worker was last seen active.
// This defaults to null in the database, and is set to the current time when the worker
// is first seen.
LastDateActive tcclient.Time `json:"lastDateActive,omitzero"`
// The ID of the launch configuration. Must be unique forever within the worker pool.
// Any change to the launch configuration (except `workerManager` fields) must use a new ID
// to ensure proper tracking of configuration metrics.
// If not provided, worker-manager will generate a unique ID.
// Must be between 1 and 38 characters long and contain only alphanumeric
// characters, dashes, and underscores.
//
// Syntax: ^([a-zA-Z0-9-_]*)$
// Min length: 1
// Max length: 38
LaunchConfigID string `json:"launchConfigId,omitempty"`
// The provider that had started the worker and responsible for managing it.
// Can be different from the provider that's currently in the worker pool config.
// A providerId of "none" is used when the worker is not managed by worker manager.
//
// Syntax: ^([a-zA-Z0-9-_]*)$
// Min length: 1
// Max length: 38
ProviderID string `json:"providerId,omitempty"`
// Unique identifier for a provisioner, that can supply specified
// `workerType`. Deprecation is planned for this property as it
// will be replaced, together with `workerType`, by the new
// identifier `workerPoolId`.
//
// Syntax: ^[a-zA-Z0-9-_]{1,38}$
ProvisionerID string `json:"provisionerId"`
// This is a list of changes to the worker's quarantine status. Each entry is an object
// containing information about the time, clientId and reason for the change.
QuarantineDetails []QuarantineDetails `json:"quarantineDetails,omitempty"`
// Quarantining a worker allows the machine to remain alive but not accept jobs.
// Once the quarantineUntil time has elapsed, the worker resumes accepting jobs.
// Note that a quarantine can be lifted by setting `quarantineUntil` to the present time (or
// somewhere in the past).
QuarantineUntil tcclient.Time `json:"quarantineUntil,omitzero"`
// List of 20 most recent tasks claimed by the worker.
RecentTasks []TaskRun `json:"recentTasks"`
// A string specifying the state this worker is in so far as worker-manager knows.
// A "requested" worker is in the process of starting up, and if successful will enter
// the "running" state once it has registered with the `registerWorker` API method. A
// "stopping" worker is in the process of shutting down and deleting resources, while
// a "stopped" worker is completely stopped. Stopped workers are kept for historical
// purposes and are purged when they expire. Note that some providers transition workers
// directly from "running" to "stopped".
// An "standalone" worker is a worker that is not managed by worker-manager, these workers
// are only known by the queue.
//
// Possible values:
// * "requested"
// * "running"
// * "stopping"
// * "stopped"
// * "standalone"
State string `json:"state,omitempty"`
// Identifier for group that worker who executes this run is a part of,
// this identifier is mainly used for efficient routing.
//
// Syntax: ^([a-zA-Z0-9-_]*)$
// Min length: 1
// Max length: 38
WorkerGroup string `json:"workerGroup"`
// Identifier for worker evaluating this run within given
// `workerGroup`.
//
// Syntax: ^([a-zA-Z0-9-_]*)$
// Min length: 1
// Max length: 38
WorkerID string `json:"workerId"`
// Unique identifier for a worker pool
//
// Syntax: ^[a-zA-Z0-9-_]{1,38}/[a-z]([-a-z0-9]{0,36}[a-z0-9])?$
WorkerPoolID string `json:"workerPoolId,omitempty"`
// Unique identifier for a worker-type within a specific
// provisioner. Deprecation is planned for this property as it will
// be replaced, together with `provisionerId`, by the new
// identifier `workerPoolId`.
//
// Syntax: ^[a-z]([-a-z0-9]{0,36}[a-z0-9])?$
WorkerType string `json:"workerType"`
}
Response containing information about a worker.