artifactexporter

package
v0.0.0-...-9e29339 Latest Latest
Warning

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

Go to latest
Published: May 3, 2024 License: Apache-2.0 Imports: 42 Imported by: 0

Documentation

Overview

Package artifactexporter handles uploading artifacts to BigQuery. This is the replacement of the legacy artifact exporter in bqexp

Index

Constants

View Source
const ArtifactRequestOverhead = 100

ArtifactRequestOverhead is the overhead (in bytes) applying to each artifact when calculating the size.

View Source
const MaxRBECasBatchSize = 2 * 1024 * 1024 // 2 MB

MaxRBECasBatchSize is the batch size limit when we read artifact content. TODO(nqmtuan): Call the Capacity API to find out the exact size limit for batch operations. For now, hardcode to be 2MB. It should be under the limit, since BatchUpdateBlobs in BatchCreateArtifacts can handle up to 10MB.

View Source
const MaxShardContentSize = bqutil.RowMaxBytes - 10*1024

MaxShardContentSize is the maximum content size in BQ row. Artifacts content bigger than this size needs to be sharded. Leave 10 KB for other fields, the rest is content.

Variables

View Source
var (
	ErrInvalidUTF8 = fmt.Errorf("invalid UTF-8 character")
)
View Source
var ExportArtifactsTask = tq.RegisterTaskClass(tq.TaskClass{
	ID:            "export-artifacts",
	Prototype:     &taskspb.ExportArtifacts{},
	Kind:          tq.Transactional,
	Queue:         "artifactexporter",
	RoutingPrefix: "/internal/tasks/artifactexporter",
})

ExportArtifactsTask describes how to route export artifact task.

Functions

func InitServer

func InitServer(srv *server.Server, opts Options) error

InitServer initializes a artifactexporter server.

func Schedule

func Schedule(ctx context.Context, invID invocations.ID) error

Schedule schedules tasks for all the finalized invocations.

Types

type Artifact

type Artifact struct {
	InvocationID string
	TestID       string
	ResultID     string
	ArtifactID   string
	ContentType  string
	Size         int64
	RBECASHash   string
	TestStatus   pb.TestStatus
}

type BQExportClient

type BQExportClient interface {
	InsertArtifactRows(ctx context.Context, rows []*bqpb.TextArtifactRow) error
}

BQExportClient is the interface for exporting artifacts.

type Client

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

Client provides methods to export artifacts to BigQuery via the BigQuery Write API.

func NewClient

func NewClient(ctx context.Context, projectID string) (s *Client, reterr error)

NewClient creates a new client for exporting artifacts via the BigQuery Write API.

func (*Client) Close

func (c *Client) Close() (reterr error)

Close releases resources held by the client.

func (*Client) EnsureSchema

func (c *Client) EnsureSchema(ctx context.Context) error

func (*Client) InsertArtifactRows

func (c *Client) InsertArtifactRows(ctx context.Context, rows []*bqpb.TextArtifactRow) error

InsertArtifactRows inserts the given rows in BigQuery.

type Options

type Options struct {
	// ArtifactRBEInstance is the name of the RBE instance to use for artifact
	// storage. Example: "projects/luci-resultdb/instances/artifacts".
	ArtifactRBEInstance string
}

Options is artifact exporter configuration.

Jump to

Keyboard shortcuts

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