tasks

package
v0.0.0-...-d3da680 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 4, 2024 License: Apache-2.0 Imports: 62 Imported by: 1

Documentation

Overview

Package tasks contains task queue implementations.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Cancel

func Cancel(ctx context.Context, bID int64) (*model.Build, error)

Cancel actually cancels a build.

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

func CancelChildren(ctx context.Context, bID int64) error

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

func CheckLiveness(ctx context.Context, buildID int64, heartbeatTimeout uint32) error

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

func EnqueueNotifyPubSubGo(ctx context.Context, buildID int64, project string) error

EnqueueNotifyPubSubGo dispatches NotifyPubSubGo tasks to send builds_v2 notifications.

func ExportBigQuery

func ExportBigQuery(ctx context.Context, buildID int64) error

ExportBigQuery enqueues a task queue task to export the given build to Bq.

func ExportBuild

func ExportBuild(ctx context.Context, buildID int64) error

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 HandleCancelBackendTask(ctx context.Context, project, target, taskID string) error

func HandleCancelSwarmingTask

func HandleCancelSwarmingTask(ctx context.Context, hostname string, taskID string, realm string) error

func NewCipdClient

func NewCipdClient(ctx context.Context, host string, project string) (client *prpc.Client, err error)

func NotifyPubSub

func NotifyPubSub(ctx context.Context, b *model.Build) error

NotifyPubSub enqueues tasks to notify Pub/Sub about the given build.

func PopPendingBuildTask

func PopPendingBuildTask(ctx context.Context, bID int64, bldrID *pb.BuilderID) error

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

func PushPendingBuildTask(ctx context.Context, bID int64, bldrID *pb.BuilderID) error

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

func ScheduleCancelBuildTask(ctx context.Context, bID int64, delay time.Duration) error

ScheduleCancelBuildTask enqueues a CancelBuildTask.

func SendOnBuildStatusChange

func SendOnBuildStatusChange(ctx context.Context, bld *model.Build, inf *model.BuildInfra) error

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

func StartCancel(ctx context.Context, bID int64, summary string) (*model.Build, error)

StartCancel starts canceling a build and schedules the delayed task to finally cancel it

func SubNotify

func SubNotify(ctx context.Context, body io.Reader) error

SubNotify handles swarming-go PubSub push messages produced by Swarming. For a retryable error, it will be tagged with transient.Tag.

func SyncBuild

func SyncBuild(ctx context.Context, buildID int64, generation int64) error

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

func SyncBuildsWithBackendTasks(ctx context.Context, backend, project string) error

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

func SyncWithBackend(ctx context.Context, backend, project string) error

SyncWithBackend enqueues a task queue task to sync builds in one project running on a backend.

func UpdateBuildTask

func UpdateBuildTask(ctx context.Context, body io.Reader) error

UpdateBuildTask handles task backend PubSub push messages produced by various task backends. For a retryable error, it will be tagged with transient.Tag.

Types

type MockCipdClientKey

type MockCipdClientKey struct{}

Directories

Path Synopsis
Package taskdefs contains task queue task definitions.
Package taskdefs contains task queue task definitions.

Jump to

Keyboard shortcuts

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