internal

package
v0.0.0-...-13f153f Latest Latest
Warning

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

Go to latest
Published: May 3, 2024 License: BSD-3-Clause Imports: 27 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var MidpointHandlerContextKey = &MidpointHandlerKey{}

Functions

func BuildChrome

func BuildChrome(ctx workflow.Context, params workflows.BuildChromeParams) (*workflows.Build, error)

BuildChrome is a Workflow definition that builds Chrome.

func CheckCombinedCommitEqualActivity

func CheckCombinedCommitEqualActivity(ctx context.Context, lower, higher *midpoint.CombinedCommit) (bool, error)

CheckCombinedCommitEqualActivity checks whether two combined commits are equal.

func CollectValuesActivity

func CollectValuesActivity(ctx context.Context, run *workflows.TestRun, benchmark, chart, aggMethod string) ([]float64, error)

CollectValuesActivity is an activity to collect sampled values from a single test run.

func ComparePairwiseActivity

func ComparePairwiseActivity(ctx context.Context, valuesA, valuesB []float64, dir compare.ImprovementDir) (*compare.ComparePairwiseResult, error)

ComparePairwiseActivity wraps compare.ComparePairwise as a temporal activity

func FindAvailableBotsActivity

func FindAvailableBotsActivity(ctx context.Context, botConfig string, seed int64) ([]string, error)

FindAvailableBotsActivity fetches a list of free, alive and non quarantined bots per provided bot configuration for eg: android-go-wembley-perf

The function makes a swarming API call internally to fetch the desired bots. If successful, a slice of bot ids is returned

func FindMidCommitActivity

func FindMidCommitActivity(ctx context.Context, lower, higher *midpoint.CombinedCommit) (*midpoint.CombinedCommit, error)

FindMidCommitActivity is an Activity that finds the middle point of two commits.

func PostBugCommentActivity

func PostBugCommentActivity(ctx context.Context, issueID int64, comment string) (bool, error)

PostBugCommentActivity wraps the call to Issuetracker's PostComment.

func PostBugCommentWorkflow

func PostBugCommentWorkflow(ctx workflow.Context, issueID int64, comment string) (bool, error)

TODO(sunxiaodi): Add a unit test for this workflow

func ReportStatusActivity

func ReportStatusActivity(ctx context.Context, issueID int, culprits []*pinpoint_proto.CombinedCommit) error

ReportStatusActivity wraps the call to IssueTracker to report culprits. TODO(sunxiaodi@): Update this activity for culprit verification

func RunBenchmarkWorkflow

func RunBenchmarkWorkflow(ctx workflow.Context, p *RunBenchmarkParams) (*workflows.TestRun, error)

RunBenchmarkWorkflow is a Workflow definition that schedules a single task, polls and retrieves the CAS for the RunBenchmarkParams defined.

Types

type BisectExecution

type BisectExecution struct {
	JobId       string
	Culprits    []*pinpoint_proto.CombinedCommit
	CreateTime  *timestamppb.Timestamp
	Comparisons []*CombinedResults
	RunData     []*BisectRun
}

BisectExecution is a mirror of pinpoint_proto.BisectExecution, with additional raw data.

When this BisectExecution embeds pinpoint_proto.BisectExecution, it fails to store CommitPairValues and BisectRuns, which are used to curate the information for Catapult Pinpoint. TODO(b/322203189) - This is a temporary solution for backwards compatibilty to the Catapult UI and should be removed when the catapult package is deprecated.

func BisectWorkflow

func BisectWorkflow(ctx workflow.Context, p *workflows.BisectParams) (be *BisectExecution, wkErr error)

BisectWorkflow is a Workflow definition that takes a range of git hashes and finds the culprit.

type BisectRun

type BisectRun struct {
	CommitRun
	ScheduledRuns []scheduledRun
}

BisectRun tracks current scheduled SingleCommitRun's and merges from other runs.

This is not thread-safe. Schedule and Update usually happens in an I/O nonblocking manner where they are invoked in the same thread vis select.

type BisectRunIndex

type BisectRunIndex int

bisectRunTracker stores all the running bisect runs.

It keeps track of all the runs by indexes. The BisectRun will be updated from different future fulfillment. One can wait for a bisect run that's already triggered by a different bisection. This usually happens when the mid commit is computed and the result will be used for comparisions from both sides. This can also happen when one comparision requires more runs, and part of them is already triggered by another comparision.

type BuildChromeActivity

type BuildChromeActivity struct {
}

BuildChromeActivity wraps BuildChrome in Activities.

func (*BuildChromeActivity) CleanupBuildActivity

func (bca *BuildChromeActivity) CleanupBuildActivity(ctx context.Context, buildID int64, status buildbucketpb.Status) error

CleanupBuildActivity wraps BuildChromeClient.CancelBuild

func (*BuildChromeActivity) RetrieveCASActivity

func (bca *BuildChromeActivity) RetrieveCASActivity(ctx context.Context, buildID int64, target string) (*swarmingV1.SwarmingRpcsCASReference, error)

RetrieveCASActivity wraps BuildChromeClient.RetrieveCAS and gets build artifacts in CAS.

func (*BuildChromeActivity) SearchOrBuildActivity

func (bca *BuildChromeActivity) SearchOrBuildActivity(ctx context.Context, params workflows.BuildChromeParams) (int64, error)

SearchOrBuildActivity wraps BuildChromeClient.SearchOrBuild

func (*BuildChromeActivity) WaitBuildCompletionActivity

func (bca *BuildChromeActivity) WaitBuildCompletionActivity(ctx context.Context, buildID int64) (buildbucketpb.Status, error)

WaitBuildCompletionActivity wraps BuildChromeClient.GetStatus and waits until it is completed or errors.

type CombinedResults

type CombinedResults struct {
	Result           *compare.CompareResults
	OtherResult      *compare.CompareResults // record the other comparison
	ResultType       string                  // either Functional or Performance
	CommitPairValues CommitPairValues
}

func CompareActivity

func CompareActivity(ctx context.Context, allValues CommitPairValues, magnitude, errRate float64, direction compare.ImprovementDir) (*CombinedResults, error)

CompareActivity wraps compare.ComparePerformance and compare.CompareFunctional as activity

commitA and commitB are passed in to make it easier to see on the Temporal UI what two commits are being tested. Errors are recorded in the activity but the ErrorVerdict is not passed back to the main workflow.

type CommitPairValues

type CommitPairValues struct {
	Lower  CommitValues
	Higher CommitValues
}

func GetAllDataForCompareLocalActivity

func GetAllDataForCompareLocalActivity(ctx context.Context, lbr *BisectRun, hbr *BisectRun, chart string) (*CommitPairValues, error)

TODO(sunxiaodi@): Change GetAllDataForCompareLocalActivity to a regular function

type CommitRangeTracker

type CommitRangeTracker struct {
	Lower  BisectRunIndex
	Higher BisectRunIndex
}

CommitRangeTracker stores a commit range as [Lower, Higher].

It stores bisect run as indexes as it needs to be serialized. The indexes are stable within the workflow thru bisectRunTracker.

func (CommitRangeTracker) CloneWithHigher

func (t CommitRangeTracker) CloneWithHigher(higher BisectRunIndex) CommitRangeTracker

CloneWithHigher clones itself with the overriden higher index.

func (CommitRangeTracker) CloneWithLower

func (t CommitRangeTracker) CloneWithLower(lower BisectRunIndex) CommitRangeTracker

CloneWithHigher clones itself with the overriden lower index.

type CommitRun

type CommitRun struct {
	// The Chrome build associated with the commit.
	Build *workflows.Build

	// All the benchmark runs using the build.
	Runs []*workflows.TestRun
}

CommitRun stores benchmark tests runs for a single commit

func SingleCommitRunner

func SingleCommitRunner(ctx workflow.Context, sc *SingleCommitRunnerParams) (*CommitRun, error)

SingleCommitRunner is a Workflow definition.

SingleCommitRunner builds, runs and collects benchmark sampled values from one single commit.

func (*CommitRun) AllErrorValues

func (cr *CommitRun) AllErrorValues(chart string) []float64

func (*CommitRun) AllValues

func (cr *CommitRun) AllValues(chart string) []float64

type CommitValues

type CommitValues struct {
	Commit      *midpoint.CombinedCommit
	Values      []float64
	ErrorValues []float64
}

type MidpointHandlerKey

type MidpointHandlerKey struct{}

type PairwiseCommitsRunnerParams

type PairwiseCommitsRunnerParams struct {
	SingleCommitRunnerParams

	// LeftCommit and RightCommit specify the two commits the pairwise runner will compare.
	// SingleCommitRunnerParams includes a field for only one commit.
	LeftCommit, RightCommit *midpoint.CombinedCommit

	// The random seed used to generate pairs.
	Seed int64
}

PairwiseCommitsRunnerParams defines the parameters for PairwiseCommitsRunner workflow.

type PairwiseRun

type PairwiseRun struct {
	Left, Right CommitRun
}

PairwiseRun is the output of the PairwiseCommitsRunnerWorkflow

func PairwiseCommitsRunnerWorkflow

func PairwiseCommitsRunnerWorkflow(ctx workflow.Context, pc PairwiseCommitsRunnerParams) (*PairwiseRun, error)

PairwiseCommitsRunnerWorkflow is a Workflow definition.

PairwiseCommitsRunner builds, runs and collects benchmark sampled values from several commits. It runs the tests in pairs to reduces sample noises.

TODO(b/331856095): viditchitkara@ handle odd number of iterations for pairwise execution workflow.

type RunBenchmarkActivity

type RunBenchmarkActivity struct {
}

RunBenchmarkActivity wraps RunBenchmarkWorkflow in Activities

func (*RunBenchmarkActivity) CleanupBenchmarkRunActivity

func (rba *RunBenchmarkActivity) CleanupBenchmarkRunActivity(ctx context.Context, taskID string, state run_benchmark.State) error

CleanupActivity wraps run_benchmark.Cancel

func (*RunBenchmarkActivity) RetrieveTestCASActivity

func (rba *RunBenchmarkActivity) RetrieveTestCASActivity(ctx context.Context, taskID string) (*swarmingV1.SwarmingRpcsCASReference, error)

RetrieveTestCASActivity wraps retrieves task artifacts from CAS

func (*RunBenchmarkActivity) ScheduleTaskActivity

func (rba *RunBenchmarkActivity) ScheduleTaskActivity(ctx context.Context, rbp *RunBenchmarkParams) (string, error)

ScheduleTaskActivity wraps run_benchmark.Run

func (*RunBenchmarkActivity) WaitTaskFinishedActivity

func (rba *RunBenchmarkActivity) WaitTaskFinishedActivity(ctx context.Context, taskID string) (run_benchmark.State, error)

WaitTaskFinishedActivity polls the task until it finishes or errors. Returns the status if the task finishes regardless of task success

func (*RunBenchmarkActivity) WaitTaskPendingActivity

func (rba *RunBenchmarkActivity) WaitTaskPendingActivity(ctx context.Context, taskID string) (run_benchmark.State, error)

WaitTaskPendingActivity polls the task until it is no longer pending. Returns the status if the task stops pending regardless of task success

type RunBenchmarkParams

type RunBenchmarkParams struct {
	// the Pinpoint job id
	JobID string
	// the swarming instance and cas digest hash and bytes location for the build
	BuildCAS *swarmingV1.SwarmingRpcsCASReference
	// commit hash
	Commit *midpoint.CombinedCommit
	// device configuration
	BotConfig string
	// benchmark to test
	Benchmark string
	// story to test
	Story string
	// story tags for the test
	StoryTags string
	// additional dimensions for bot selection
	Dimensions map[string]string
	// iteration for the benchmark run. A few workflows have multiple iterations of
	// benchmark runs and this param comes in handy to get additional info of a specific run.
	// This is for debugging/informational purposes only.
	IterationIdx int32
}

RunBenchmarkParams are the Temporal Workflow params for the RunBenchmarkWorkflow.

type SingleCommitRunnerParams

type SingleCommitRunnerParams struct {
	// PinpointJobID is the Job ID to associate with the run.
	PinpointJobID string

	// BotConfig is the name of the device configuration, e.g. "linux-perf".
	BotConfig string

	// Benchmark is the name of the benchmark test.
	Benchmark string

	// Chart is a story histogram in a Benchmark.
	Chart string

	// Story is a story in a Benchmark.
	Story string

	// StoryTags is for the story in a Benchmark.
	StoryTags string

	// AggregationMethod is method to aggregate sampled values.
	// If empty, then the original values are returned.
	AggregationMethod string

	// The commit with optional deps override
	// Note: This field is only used in bisect
	// TODO(b/326352320): move CombinedCommit to a common package or rename midpoint
	CombinedCommit *midpoint.CombinedCommit

	// The number of benchmark tests to run.
	// Note the collected sampled values can be more than iterations as each iteration produce
	// more than one samples.
	Iterations int32

	// Finished number of iterations of benchmark test
	// In the bisect jobs, one commit run will start with an initial number of iteration
	// If the compare result is not significant enough, then extra number of iteration will be added to that commit
	// We need this attribute to record the finished number of iterations
	// Note: This field is only used in bisect
	FinishedIteration int32

	// Available bot list
	BotIds []string
}

SingleCommitRunnerParams defines the parameters for SingleCommitRunner workflow.

Jump to

Keyboard shortcuts

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