server: go.chromium.org/goma/server/remoteexec Index | Files | Directories

package remoteexec

import "go.chromium.org/goma/server/remoteexec"

Package remoteexec provides proxy to remoteexec server.

TODO: goma client should use credential described in https://cloud.google.com/remote-build-execution/docs/getting-started

Index

Package Files

adapter.go bytestream.go clang-cl.go client.go cmdfile.go exec.go exec_oss.go gcc.go gomainput.go gomaoutput.go inputroot.go javac.go nsjail.go

Variables

var (
    DefaultViews = []*view.View{
        {
            Description: `Number of current running exec operations`,
            Measure:     numRunningOperations,
            Aggregation: view.Sum(),
        },
    }
)

func ExecuteAndWait Uses

func ExecuteAndWait(ctx context.Context, c Client, req *rpb.ExecuteRequest, opts ...grpc.CallOption) (string, *rpb.ExecuteResponse, error)

ExecuteAndWait executes and action remotely and wait its response. it returns operation name, response and error.

type Adapter Uses

type Adapter struct {
    // InstancePrefix is the prefix (dirname) of the full RBE instance name.
    // e.g. If instance name == "projects/$PROJECT/instances/default_instance",
    // then InstancePrefix is "projects/$PROJECT/instances"
    InstancePrefix string

    Inventory   exec.Inventory
    ExecTimeout time.Duration

    // Client is remoteexec API client.
    Client         Client
    InsecureClient bool

    // GomaFile handles output files from remoteexec's cas to goma's FileBlob.
    GomaFile fpb.FileServiceClient

    // key: goma file hash.
    DigestCache DigestCache

    // CmdStorage is a storage for command files.
    CmdStorage CmdStorage

    // Tool details put in request metadata.
    ToolDetails *rpb.ToolDetails

    // FileLookupConcurrency represents concurrency to look up file
    // contents from file-cache-server to be converted to CAS.
    // 1 if not specified.
    FileLookupConcurrency int
    // contains filtered or unexported fields
}

Adapter is an adapter from goma API to remoteexec API.

func (*Adapter) DefaultInstance Uses

func (f *Adapter) DefaultInstance() string

func (*Adapter) Exec Uses

func (f *Adapter) Exec(ctx context.Context, req *gomapb.ExecReq) (resp *gomapb.ExecResp, err error)

Exec handles goma Exec requests with remoteexec backend.

1. compute input tree and Action.
1.1 construct input tree from req.
1.2. construct Action message from req.
2. checks the ActionCache using GetActionResult. if hit, go to 7.
3. queries the ContentAddressableStorage using FindMissingBlobs
4. uploads any missing blobs to the ContentAddressableStorage
   using bytestream.Write and BatchUpdateBlobs.
5. executes the action using Execute.
6. awaits completion of the action using the longrunning.Operations.
7. looks a the ActionResult
8. If the action is successful, uses bytestream.Read to download any outputs
   it does not already have;
   embed it in response, or will serve it by LookupFile later
9. job is complete
9.1  convert ExecResp from ExecuteResponse.
     for small outputs, embed in resp. otherwise use FILE_META.

type ByteStream Uses

type ByteStream struct {
    // Adapter provides an interface to the RBE API.
    Adapter *Adapter

    // The name of the RBE instance, e.g. "projects/$PROJECT/instances/default_instance"
    InstanceName string
}

ByteStream is a proxy that reads/writes data to/from a server, as defined in googleapis/bytestream. In the context of the exec server, it accesses a resource on the RBE server, specifically a resource under an RBE instance.

func (*ByteStream) QueryWriteStatus Uses

func (bs *ByteStream) QueryWriteStatus(ctx context.Context, req *pb.QueryWriteStatusRequest) (*pb.QueryWriteStatusResponse, error)

Write proxies bytestream QueryWriteStatus call.

func (*ByteStream) Read Uses

func (bs *ByteStream) Read(req *pb.ReadRequest, s pb.ByteStream_ReadServer) error

Read proxies bytestream Read stream.

func (*ByteStream) Write Uses

func (bs *ByteStream) Write(s pb.ByteStream_WriteServer) error

Write proxies bytestream Write stream.

type Client Uses

type Client struct {
    *grpc.ClientConn
    CallOptions []grpc.CallOption
}

Client is a remoteexec API client to ClientConn. CallOptions will be added when calling RPC.

prcred, _ := oauth.NewApplicationDefault(ctx,
   "https://www.googleapis.com/auth/cloud-build-service")
conn, _ := grpc.DialContext(ctx, target,
  grpc.WithPerRPCCredentials(prcred),
  grpc.WithTransportCredentials(credentials.NewTLS(&tls.Config{})))
client := &remoteexec.Client{conn}

func (Client) BatchReadBlobs Uses

func (c Client) BatchReadBlobs(ctx context.Context, req *rpb.BatchReadBlobsRequest, opts ...grpc.CallOption) (*rpb.BatchReadBlobsResponse, error)

BatchReadBlobs downloads many blobs at once.

func (Client) BatchUpdateBlobs Uses

func (c Client) BatchUpdateBlobs(ctx context.Context, req *rpb.BatchUpdateBlobsRequest, opts ...grpc.CallOption) (*rpb.BatchUpdateBlobsResponse, error)

BatchUpdateBlobs uploads many blobs at once.

func (Client) ByteStream Uses

func (c Client) ByteStream() bpb.ByteStreamClient

ByteStream returns byte stream client. https://godoc.org/google.golang.org/genproto/googleapis/bytestream#ByteStreamClient

func (Client) CAS Uses

func (c Client) CAS() rpb.ContentAddressableStorageClient

CAS returns content addressable storage client. https://github.com/bazelbuild/remote-apis/blob/c1c1ad2c97ed18943adb55f06657440daa60d833/build/bazel/remote/execution/v2/remote_execution.proto#L168

func (Client) Cache Uses

func (c Client) Cache() rpb.ActionCacheClient

Cache returns action cache client. https://github.com/bazelbuild/remote-apis/blob/c1c1ad2c97ed18943adb55f06657440daa60d833/build/bazel/remote/execution/v2/remote_execution.proto#L117

func (Client) Capabilities Uses

func (c Client) Capabilities() rpb.CapabilitiesClient

Capabilities returns capabilities client.

func (Client) Exec Uses

func (c Client) Exec() rpb.ExecutionClient

Exec returns execution client. https://github.com/bazelbuild/remote-apis/blob/c1c1ad2c97ed18943adb55f06657440daa60d833/build/bazel/remote/execution/v2/remote_execution.proto#L34

func (Client) Execute Uses

func (c Client) Execute(ctx context.Context, req *rpb.ExecuteRequest, opts ...grpc.CallOption) (rpb.Execution_ExecuteClient, error)

Execute executes an action remotely.

func (Client) FindMissingBlobs Uses

func (c Client) FindMissingBlobs(ctx context.Context, req *rpb.FindMissingBlobsRequest, opts ...grpc.CallOption) (*rpb.FindMissingBlobsResponse, error)

FindMissingBlobs determines if blobs are present in the CAS.

func (Client) GetActionResult Uses

func (c Client) GetActionResult(ctx context.Context, req *rpb.GetActionResultRequest, opts ...grpc.CallOption) (*rpb.ActionResult, error)

GetActionResult retrieves a cached execution result.

func (Client) GetCapabilities Uses

func (c Client) GetCapabilities(ctx context.Context, req *rpb.GetCapabilitiesRequest, opts ...grpc.CallOption) (*rpb.ServerCapabilities, error)

GetCapabilities returns the server capabilities configuration.

func (Client) GetTree Uses

func (c Client) GetTree(ctx context.Context, req *rpb.GetTreeRequest, opts ...grpc.CallOption) (rpb.ContentAddressableStorage_GetTreeClient, error)

GetTree fetches the entire directory tree rooted at a node.

func (Client) QueryWriteStatus Uses

func (c Client) QueryWriteStatus(ctx context.Context, in *bpb.QueryWriteStatusRequest, opts ...grpc.CallOption) (*bpb.QueryWriteStatusResponse, error)

QueryWriteStatus is used to find the committed_size for a resource that is being written, which can be then be used as the write_offset for the next Write call.

func (Client) Read Uses

func (c Client) Read(ctx context.Context, in *bpb.ReadRequest, opts ...grpc.CallOption) (bpb.ByteStream_ReadClient, error)

Read is used to retrieve the contents of a resource as a sequence of bytes.

func (Client) UpdateActionResult Uses

func (c Client) UpdateActionResult(ctx context.Context, req *rpb.UpdateActionResultRequest, opts ...grpc.CallOption) (*rpb.ActionResult, error)

UpdateActionResult uploads a new execution result.

func (Client) WaitExecution Uses

func (c Client) WaitExecution(ctx context.Context, req *rpb.WaitExecutionRequest, opts ...grpc.CallOption) (rpb.Execution_WaitExecutionClient, error)

WaitExecution waits for an execution operation to complete.

func (Client) Write Uses

func (c Client) Write(ctx context.Context, opts ...grpc.CallOption) (bpb.ByteStream_WriteClient, error)

Write is used to send the contents of a resource as a sequence of bytes.

type CmdStorage Uses

type CmdStorage interface {
    Open(ctx context.Context, hash string) (io.ReadCloser, error)
}

CmdStorage is an interface to retrieve cmd file contents.

type DigestCache Uses

type DigestCache interface {
    Get(context.Context, string, digest.Source) (digest.Data, error)
}

DigetCache caches digest for goma file hash.

Directories

PathSynopsis
casPackage cas manages content addressable storage.
datasourcePackage datasource provides data source from local file, bytes etc.
digestPackage digest handles content digest for remote executon API, https://github.com/bazelbuild/remote-apis/blob/c1c1ad2c97ed18943adb55f06657440daa60d833/build/bazel/remote/execution/v2/remote_execution.proto#L633
merkletreePackage merkletree operates on a merkle tree for remote execution API, https://github.com/bazelbuild/remote-apis/blob/c1c1ad2c97ed18943adb55f06657440daa60d833/build/bazel/remote/execution/v2/remote_execution.proto#L838

Package remoteexec imports 47 packages (graph) and is imported by 3 packages. Updated 2019-11-18. Refresh now. Tools for package owners.