rexec

package
v0.0.0-...-ebb4f00 Latest Latest
Warning

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

Go to latest
Published: Nov 9, 2023 License: Apache-2.0 Imports: 28 Imported by: 0

Documentation

Overview

Package rexec provides a top-level client for executing remote commands.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	FileMetadataCache filemetadata.Cache
	GrpcClient        *rc.Client
}

Client is a remote execution client.

func (*Client) NewContext

func (c *Client) NewContext(ctx context.Context, cmd *command.Command, opt *command.ExecutionOptions, oe outerr.OutErr) (*Context, error)

NewContext starts a new Context for a given command.

func (*Client) Run

Run executes a command remotely.

type Context

type Context struct {

	// The metadata of the current execution.
	Metadata *command.Metadata
	// The result of the current execution, if available.
	Result *command.Result
	// contains filtered or unexported fields
}

Context allows more granular control over various stages of command execution. At any point, any errors that occurred will be stored in the Result.

func (*Context) DownloadOutErr

func (ec *Context) DownloadOutErr()

DownloadOutErr downloads the stdout and stderr of the command.

func (*Context) DownloadOutputs

func (ec *Context) DownloadOutputs(outputDir string)

DownloadOutputs downloads the outputs of the command in the context to the specified directory.

func (*Context) DownloadSpecifiedOutputs

func (ec *Context) DownloadSpecifiedOutputs(outs map[string]*rc.TreeOutput, outDir string)

DownloadSpecifiedOutputs downloads the specified outputs into the specified directory This function is run when the option to preserve unchanged outputs is on

func (*Context) ExecuteRemotely

func (ec *Context) ExecuteRemotely()

ExecuteRemotely tries to execute the command remotely and download the results. It uploads any missing inputs first.

func (*Context) GetCachedResult

func (ec *Context) GetCachedResult()

GetCachedResult tries to get the command result from the cache. The Result will be nil on a cache miss. The Context will be ready to execute the action, or, alternatively, to update the remote cache with a local result. If the ExecutionOptions do not allow to accept remotely cached results, the operation is a noop.

func (*Context) GetFlattenedOutputs

func (ec *Context) GetFlattenedOutputs() (map[string]*rc.TreeOutput, error)

GetFlattenedOutputs flattens the outputs from the ActionResult of the context and returns a map of output paths relative to the working directory and their corresponding TreeOutput

func (*Context) GetOutputFileDigests

func (ec *Context) GetOutputFileDigests(useAbsPath bool) (map[string]digest.Digest, error)

GetOutputFileDigests returns a map of output file paths to digests. This function is supposed to be run after a successful cache-hit / remote-execution has been run with the given execution context. If called before the completion of remote-execution, the function returns a nil result.

func (*Context) UpdateCachedResult

func (ec *Context) UpdateCachedResult()

UpdateCachedResult tries to write local results of the execution to the remote cache. TODO(olaola): optional arguments to override values of local outputs, and also stdout/err.

Jump to

Keyboard shortcuts

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