Documentation ¶
Overview ¶
Package tasks contains task queue implementations.
Index ¶
- func Cancel(ctx context.Context, bID int64) (*model.Build, error)
- func CancelBackendTask(ctx context.Context, task *taskdefs.CancelBackendTask) error
- func CancelChildren(ctx context.Context, bID int64) error
- func CancelSwarmingTask(ctx context.Context, task *taskdefs.CancelSwarmingTaskGo) error
- func CheckBuildLiveness(ctx context.Context, buildID int64, heartbeatTimeout uint32, ...) error
- func CheckLiveness(ctx context.Context, buildID int64, heartbeatTimeout uint32) error
- func CreateBackendBuildTask(ctx context.Context, task *taskdefs.CreateBackendBuildTask) error
- func CreateBackendTask(ctx context.Context, buildID int64, requestID string, ...) error
- func CreatePopPendingBuildTask(ctx context.Context, task *taskdefs.PopPendingBuildTask) error
- func CreatePushPendingBuildTask(ctx context.Context, task *taskdefs.PushPendingBuildTask) error
- func CreateSwarmingBuildTask(ctx context.Context, task *taskdefs.CreateSwarmingBuildTask) error
- func EnqueueNotifyPubSubGo(ctx context.Context, buildID int64, project string) error
- func ExportBigQuery(ctx context.Context, buildID int64) error
- func ExportBuild(ctx context.Context, buildID int64) error
- func FinalizeResultDB(ctx context.Context, task *taskdefs.FinalizeResultDBGo) error
- func HandleCancelBackendTask(ctx context.Context, project, target, taskID string) error
- func HandleCancelSwarmingTask(ctx context.Context, hostname string, taskID string, realm string) error
- func NewCipdClient(ctx context.Context, host string, project string) (client *prpc.Client, err error)
- func NotifyPubSub(ctx context.Context, b *model.Build) error
- func PopPendingBuildTask(ctx context.Context, bID int64, bldrID *pb.BuilderID) error
- func PublishBuildsV2Notification(ctx context.Context, buildID int64, topic *pb.BuildbucketCfg_Topic, ...) error
- func PushPendingBuildTask(ctx context.Context, bID int64, bldrID *pb.BuilderID) error
- func ScheduleCancelBuildTask(ctx context.Context, bID int64, delay time.Duration) error
- func SendOnBuildStatusChange(ctx context.Context, bld *model.Build, inf *model.BuildInfra) error
- func StartCancel(ctx context.Context, bID int64, summary string) (*model.Build, error)
- func SubNotify(ctx context.Context, body io.Reader) error
- func SyncBuild(ctx context.Context, buildID int64, generation int64) error
- func SyncBuildsWithBackendTasks(ctx context.Context, backend, project string) error
- func SyncSwarmingBuildTask(ctx context.Context, task *taskdefs.SyncSwarmingBuildTask, delay time.Duration) error
- func SyncWithBackend(ctx context.Context, backend, project string) error
- func UpdateBuildTask(ctx context.Context, body io.Reader) error
- type MockCipdClientKey
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CancelBackendTask ¶
func CancelBackendTask(ctx context.Context, task *taskdefs.CancelBackendTask) error
CancelBackendTask enqueues a task queue task to cancel the given Backend task.
func CancelChildren ¶
CancelChildren cancels a build's children. NOTE: This process is best-effort; Builds call UpdateBuild at a minimum frequency and Buildbucket will inform them if they should start the cancel process (by checking the parent build, if any). So, even if this fails, the next UpdateBuild will catch it.
func CancelSwarmingTask ¶
func CancelSwarmingTask(ctx context.Context, task *taskdefs.CancelSwarmingTaskGo) error
CancelSwarmingTask enqueues a task queue task to cancel the given Swarming task.
func CheckBuildLiveness ¶
func CheckBuildLiveness(ctx context.Context, buildID int64, heartbeatTimeout uint32, delay time.Duration) error
CheckBuildLiveness enqueues a task queue task to check a build's liveness.
func CheckLiveness ¶
CheckLiveness is to check if the given build has received any updates during the timeout period.
func CreateBackendBuildTask ¶
func CreateBackendBuildTask(ctx context.Context, task *taskdefs.CreateBackendBuildTask) error
CreateBackendBuildTask enqueues a Cloud Tasks task to create a backend task from the given build.
func CreateBackendTask ¶
func CreateBackendTask(ctx context.Context, buildID int64, requestID string, dequeueTime *timestamppb.Timestamp) error
CreateBackendTask creates a backend task for the build.
func CreatePopPendingBuildTask ¶
func CreatePopPendingBuildTask(ctx context.Context, task *taskdefs.PopPendingBuildTask) error
CreatePopPendingBuildTask enqueues a task queue task to pop a pending build.
func CreatePushPendingBuildTask ¶
func CreatePushPendingBuildTask(ctx context.Context, task *taskdefs.PushPendingBuildTask) error
CreatePushPendingBuildTask enqueues a task queue task to push a pending build.
func CreateSwarmingBuildTask ¶
func CreateSwarmingBuildTask(ctx context.Context, task *taskdefs.CreateSwarmingBuildTask) error
CreateSwarmingBuildTask enqueues a Cloud Tasks task to create a Swarming task from the given build.
func EnqueueNotifyPubSubGo ¶
EnqueueNotifyPubSubGo dispatches NotifyPubSubGo tasks to send builds_v2 notifications.
func ExportBigQuery ¶
ExportBigQuery enqueues a task queue task to export the given build to Bq.
func ExportBuild ¶
ExportBuild saves the build into BiqQuery. The returned error has transient.Tag or tq.Fatal in order to tell tq to drop or retry.
func FinalizeResultDB ¶
func FinalizeResultDB(ctx context.Context, task *taskdefs.FinalizeResultDBGo) error
FinalizeResultDB enqueues a task queue task to finalize the invocation for the given build in ResultDB.
func HandleCancelBackendTask ¶
func NewCipdClient ¶
func NotifyPubSub ¶
NotifyPubSub enqueues tasks to notify Pub/Sub about the given build.
func PopPendingBuildTask ¶
PopPendingBuildTask is responsible for popping and triggering builds from the BuilderQueue pending_builds queue. PopPendingBuildTask runs at build termination for builder with Config.MaxConcurrentBuilds > 0, or at builder config ingestion for Config.MaxConcurrentBuilds increases and resets. A popped build is sent to task backend and moved to the BuilderQueue triggered_builds set.
func PublishBuildsV2Notification ¶
func PublishBuildsV2Notification(ctx context.Context, buildID int64, topic *pb.BuildbucketCfg_Topic, callback bool, largeBytesSizeLimit int) error
PublishBuildsV2Notification is the handler of notify-pubsub-go where it actually sends build notifications to the internal or external topic.
func PushPendingBuildTask ¶
PushPendingBuildTask is responsible for updating the BuilderQueue entity. It is triggered at the build creation for builder with Config.MaxConcurrentBuilds > 0. A new build can either be pushed to triggered_builds and sent to task backend, or pushed to pending_builds where it will wait to be popped when the builder gets some capacity.
func ScheduleCancelBuildTask ¶
ScheduleCancelBuildTask enqueues a CancelBuildTask.
func SendOnBuildStatusChange ¶
SendOnBuildStatusChange sends cloud tasks if a build's top level status changes.
It's the default PostProcess func for buildstatus.Updater.
Must run in a datastore transaction.
func StartCancel ¶
StartCancel starts canceling a build and schedules the delayed task to finally cancel it
func SubNotify ¶
SubNotify handles swarming-go PubSub push messages produced by Swarming. For a retryable error, it will be tagged with transient.Tag.
func SyncBuild ¶
SyncBuild synchronizes the build with Swarming. If the swarming task does not exist yet, creates it. Otherwise, updates the build state to match swarming task state. Enqueues a new sync push task if the build did not end.
Cloud tasks handler will retry the task if any error is thrown, unless it's tagged with tq.Fatal.
func SyncBuildsWithBackendTasks ¶
SyncBuildsWithBackendTasks syncs all the builds belongs to `project` running on `backend` with their backend tasks if their next sync time have been exceeded.
func SyncSwarmingBuildTask ¶
func SyncSwarmingBuildTask(ctx context.Context, task *taskdefs.SyncSwarmingBuildTask, delay time.Duration) error
SyncSwarmingBuildTask enqueues a Cloud Tasks task to sync the Swarming task with the given build.
func SyncWithBackend ¶
SyncWithBackend enqueues a task queue task to sync builds in one project running on a backend.
Types ¶
type MockCipdClientKey ¶
type MockCipdClientKey struct{}