tryjobs

package
v0.0.0-...-03d6fc4 Latest Latest
Warning

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

Go to latest
Published: Jan 23, 2019 License: BSD-3-Clause Imports: 33 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// API URLs
	API_URL_PROD    = "https://cr-buildbucket.appspot.com/api/buildbucket/v1/"
	API_URL_TESTING = "http://localhost:8008/api/buildbucket/v1/"

	// Buildbucket buckets used for try jobs.
	BUCKET_PRIMARY  = "skia.primary"
	BUCKET_INTERNAL = "skia.internal"
	BUCKET_TESTING  = "skia.testing"

	// How often to send updates to Buildbucket.
	UPDATE_INTERVAL = 30 * time.Second

	// We attempt to renew leases in batches. This is the batch size.
	LEASE_BATCH_SIZE = 25

	// We lease a build for this amount of time, and if we don't renew the
	// lease before the time is up, the build resets to "scheduled" status
	// and becomes available for leasing again.
	LEASE_DURATION = time.Hour

	// We use a shorter initial lease duration in case we succeed in leasing
	// a build but fail to insert the associated Job into the DB, eg.
	// because the scheduler was interrupted.
	LEASE_DURATION_INITIAL = 5 * time.Minute

	// How many pending builds to read from the bucket at a time.
	PEEK_MAX_BUILDS = 50

	// How often to poll Buildbucket for newly-scheduled builds.
	POLL_INTERVAL = 10 * time.Second

	// This error reason indicates that we already marked the build as
	// finished.
	BUILDBUCKET_API_ERROR_REASON_COMPLETED = "BUILD_IS_COMPLETED"
)

Variables

This section is empty.

Functions

func MockCancelBuild

func MockCancelBuild(mock *mockhttpclient.URLMock, id int64, msg string, err error)

func MockHeartbeats

func MockHeartbeats(t testutils.TestingT, mock *mockhttpclient.URLMock, now time.Time, jobs []*types.Job, resps map[string]*heartbeatResp)

func MockJobFailure

func MockJobFailure(mock *mockhttpclient.URLMock, j *types.Job, now time.Time, expectErr error)

func MockJobMishap

func MockJobMishap(mock *mockhttpclient.URLMock, j *types.Job, now time.Time, expectErr error)

func MockJobStarted

func MockJobStarted(mock *mockhttpclient.URLMock, id int64, now time.Time, err error)

func MockJobSuccess

func MockJobSuccess(mock *mockhttpclient.URLMock, j *types.Job, now time.Time, expectErr error, dontCareRequest bool)

func MockPeek

func MockPeek(mock *mockhttpclient.URLMock, builds []*buildbucket_api.ApiCommonBuildMessage, now time.Time, cursor, nextcursor string, err error)

func MockTryLeaseBuild

func MockTryLeaseBuild(mock *mockhttpclient.URLMock, id int64, now time.Time, err error)

func Params

func Params(t testutils.TestingT, builder, project, revision, server, issue, patchset string) buildbucket.Parameters

Types

type TryJobIntegrator

type TryJobIntegrator struct {
	// contains filtered or unexported fields
}

TryJobIntegrator is responsible for communicating with Buildbucket to trigger try jobs and report their results.

func NewTryJobIntegrator

func NewTryJobIntegrator(apiUrl, bucket, host string, c *http.Client, d db.JobDB, w *window.Window, projectRepoMapping map[string]string, rm repograph.Map, taskCfgCache *specs.TaskCfgCache, gerrit gerrit.GerritInterface) (*TryJobIntegrator, error)

NewTryJobIntegrator returns a TryJobIntegrator instance.

func (*TryJobIntegrator) Poll

func (t *TryJobIntegrator) Poll(ctx context.Context, now time.Time) error

func (*TryJobIntegrator) Start

func (t *TryJobIntegrator) Start(ctx context.Context)

Start initiates the TryJobIntegrator's heatbeat and polling loops. If the given Context is canceled, the loops stop.

Jump to

Keyboard shortcuts

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