query

package
v0.0.0-...-e560ebb Latest Latest
Warning

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

Go to latest
Published: Jul 13, 2021 License: BSD-3-Clause Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var GetStatusLogQuery = mustMakeTemplate(
	"getStatusLog",
	`
SELECT
  BUILDS.infra.swarming.task_id AS swarming_id,
  BUILDS.id AS bbid,
  JSON_EXTRACT_SCALAR(BUILDS.output.properties, r"$.compressed_result") AS bb_output_properties,
FROM
  {{$tick}}cr-buildbucket.chromeos.builds{{$tick}} AS BUILDS
WHERE
  (
    BUILDS.infra.swarming.task_id = {{.SwarmingTaskID | printf "%q"}}
    OR "" = {{.SwarmingTaskID | printf "%q"}}
  )
LIMIT 1
`,
)

GetStatusLogQuery is a query that gets the buildbucket ID and result proto for a single swarming task. We do not need to join the task_results_summary table because the table of buildbucket builds already contains the swarming ID. In the event that no swarming task ID is specified, yield the status log query for an arbitrary swarming query.

Functions

func ExtractGSURL

func ExtractGSURL(res *skylab_test_runner.Result) (string, error)

ExtractGSURL is a convenience method that extracts the Google storage root URL from a skylab test runner result.

func ExtractStainlessURL

func ExtractStainlessURL(res *skylab_test_runner.Result) (string, error)

ExtractStainlessURL is a convenience method that extracts the Stainless URL from a skylab test runner result.

func JSONEncodeBBRecord

func JSONEncodeBBRecord(res *skylab_test_runner.Result) (string, error)

JSONEncodeBBRecord takes a Skylab test runner result and encodes it as JSON.

func RunBrokenBy

func RunBrokenBy(ctx context.Context, client *bigquery.Client, params *BrokenByParams) (*bigquery.RowIterator, error)

RunBrokenBy takes a BigQuery client and parameters and returns a result set.

func RunRandTaskQuery

func RunRandTaskQuery(ctx context.Context, client *bigquery.Client, params *RandTaskParams) (*bigquery.RowIterator, error)

RunRandTaskQuery takes a BigQuery client and parameters and returns a randomly chosen task fitting the requirements, its request name and its exit status.

func RunSQL

func RunSQL(ctx context.Context, client *bigquery.Client, sql string) (*bigquery.RowIterator, error)

RunSQL takes a Bigquery Client and a sql query and returns an iterator over the result set.

func RunStatusLogQuery

func RunStatusLogQuery(ctx context.Context, client *bigquery.Client, params *GetStatusLogParams) (*bigquery.RowIterator, error)

RunStatusLogQuery takes a bigquery client and parameters and returns a result set.

func RunTaskQuery

func RunTaskQuery(ctx context.Context, client *bigquery.Client, params *TaskQueryParams) (*bigquery.RowIterator, error)

RunTaskQuery takes a BigQuery client and parameters and returns a result set.

func UnmarshalBBRecord

func UnmarshalBBRecord(encodedData string) (*skylab_test_runner.Result, error)

UnmarshalBBRecord takes a bigquery.Value and returns a parsed Skylab test result. If the message is empty, successfully return nothing.

Types

type BrokenByParams

type BrokenByParams struct {
	BotID     string
	StartTime int64
	EndTime   int64
}

BrokenByParams are all the parameters necessary to determine which task broke a DUT when

type GetStatusLogParams

type GetStatusLogParams struct {
	SwarmingTaskID string
}

GetStatusLogParams are all the params necessary to construct a query to get the status logs for a single swarming task.

type RandTaskParams

type RandTaskParams struct {
	Model                   string
	StartTime               int64
	EndTime                 int64
	Limit                   int
	BuildBucketSafetyMargin int64
}

RandTaskParams are all the params necessary to fetch a random task.

type TaskQueryParams

type TaskQueryParams struct {
	// Params.Model may be empty or non-empty. An empty string as the model means that all
	// models are permitted.
	Model     string
	StartTime int64
	EndTime   int64
	Limit     int
	// BuildBucketSafetyMargin is the number of seconds to look before and after
	// the given time range in order to be sure to include all buildbucket records.
	// For more details, see the documentation for buildBucketSafetyMarginSeconds.
	BuildBucketSafetyMargin int64
}

TaskQueryParams are all the params necessary to construct a task query

Jump to

Keyboard shortcuts

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