server: Index | Files | Directories

package remoteexec

import ""

Package remoteexec provides proxy to remoteexec server.

TODO: goma client should use credential described in


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 stats.go


var (
    DefaultViews = []*view.View{
            Description: `Number of current running exec operations`,
            Measure:     numRunningOperations,
            Aggregation: view.Sum(),
            Description: "Number of requests per wrapper types",
            TagKeys: []tag.Key{
            Measure:     wrapperCount,
            Aggregation: view.Count(),
            Description: "Size to allocate buffer for input files",
            TagKeys: []tag.Key{
            Measure:     inputBufferAllocSize,
            Aggregation: view.Sum(),
            Description: "Time in inventory check",
            Measure:     execInventoryTime,
            Aggregation: defaultLatencyDistribution,
            Description: "Time in input tree construction",
            Measure:     execInputTreeTime,
            Aggregation: defaultLatencyDistribution,
            Description: "Time in setup",
            Measure:     execSetupTime,
            Aggregation: defaultLatencyDistribution,
            Description: "Time to check cache",
            Measure:     execCheckCacheTime,
            Aggregation: defaultLatencyDistribution,
            Description: "Time to check missing",
            Measure:     execCheckMissingTime,
            Aggregation: defaultLatencyDistribution,
            Description: "Time to upload blobs",
            Measure:     execUploadBlobsTime,
            Aggregation: defaultLatencyDistribution,
            Description: "Time to execute",
            Measure:     execExecuteTime,
            Aggregation: defaultLatencyDistribution,
            Description: "Time in response",
            Measure:     execResponseTime,
            Aggregation: defaultLatencyDistribution,
            Description: "Time in RBE queue",
            Measure:     rbeQueueTime,
            TagKeys:     rbeTagKeys,
            Aggregation: defaultLatencyDistribution,
            Description: "Time in RBE worker",
            Measure:     rbeWorkerTime,
            TagKeys:     rbeTagKeys,
            Aggregation: defaultLatencyDistribution,
            Description: "Time in RBE input",
            Measure:     rbeInputTime,
            TagKeys:     rbeTagKeys,
            Aggregation: defaultLatencyDistribution,
            Description: "Time in RBE exec",
            Measure:     rbeExecTime,
            TagKeys:     rbeTagKeys,
            Aggregation: defaultLatencyDistribution,
            Description: "Time in RBE output",
            Measure:     rbeOutputTime,
            TagKeys:     rbeTagKeys,
            Aggregation: defaultLatencyDistribution,

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

    // FileLookupSema specifies concurrency to look up file
    // contents from file-cache-server to be converted to CAS.
    FileLookupSema chan struct{}

    // CASBlobLookupSema specifies concurrency to look up file blobs in in cas.lookupBlobsInStore(),
    // which calls Store.Get().
    CASBlobLookupSema chan struct{}

    // OutputFileSema specifies concurrency to download files from CAS and store in
    // file server in gomaOutput.toFileBlob().
    OutputFileSema chan struct{}

    // Ratio to enable hardening.
    HardeningRatio float64
    // 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 {
    CallOptions []grpc.CallOption
    Retry       rpc.Retry

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

prcred, _ := oauth.NewApplicationDefault(ctx,
conn, _ := grpc.DialContext(ctx, target,
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.

func (Client) CAS Uses

func (c Client) CAS() rpb.ContentAddressableStorageClient

CAS returns content addressable storage client.

func (Client) Cache Uses

func (c Client) Cache() rpb.ActionCacheClient

Cache returns action cache client.

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.

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.


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,
merkletreePackage merkletree operates on a merkle tree for remote execution API,

Package remoteexec imports 52 packages (graph) and is imported by 3 packages. Updated 2020-10-27. Refresh now. Tools for package owners.