tasks

package
v0.0.0-...-03780a1 Latest Latest
Warning

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

Go to latest
Published: Apr 25, 2024 License: Apache-2.0 Imports: 60 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) error

CreateBackendTask creates a backend task for the 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 CreateSwarmingTask

func CreateSwarmingTask(ctx context.Context, task *taskdefs.CreateSwarmingTask) error

CreateSwarmingTask enqueues a task queue 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, routeToGo bool) error

ExportBigQuery enqueues a task queue task to export the given build to Bq. TODO(crbug.com/1356766): routeToGo will be removed once migration is done.

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 PublishBuildsV2Notification

func PublishBuildsV2Notification(ctx context.Context, buildID int64, topic *pb.BuildbucketCfg_Topic, callback bool) error

PublishBuildsV2Notification is the handler of notify-pubsub-go where it actually sends build notifications to the internal or external topic.

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) 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