buildgrid.server.actioncache.caches.remote_cache module

Remote Action Cache

Provides an interface to a remote Action Cache. This can be used by other services (e.g. an Execution service) to communicate with a remote cache.

It provides the same API as any other Action Cache instance backend.

class buildgrid.server.actioncache.caches.remote_cache.RemoteActionCache(remote: str, instance_name: str, retries: int = 0, max_backoff: int = 64, request_timeout: float | None = None, channel_options: Tuple[Tuple[str, str], ...] | None = None, credentials: ClientCredentials | None = None)

Bases: ActionCacheABC

start() None

A method called when the grpc service is starting.

This method may be overriden if startup logic is required.

stop() None

A method called when the grpc service is shutting down.

This method may be overriden if shutdown logic is required.

property allow_updates: bool
get_action_result(action_digest: Digest) ActionResult

Retrieves the cached result for an Action.

Queries the remote ActionCache service to retrieve the cached result for a given Action digest. If the remote cache doesn’t contain a result for the Action, then None is returned.

Parameters:

action_digest (Digest) – The digest of the Action to retrieve the cached result of.

update_action_result(action_digest: Digest, action_result: ActionResult) None

Stores a result for an Action in the remote cache.

Sends an UpdateActionResult request to the remote ActionCache service, to store the result in the remote cache.

If the remote cache doesn’t allow updates, then this raises a NotImplementedError.

Parameters:
  • action_digest (Digest) – The digest of the Action whose result is being cached.

  • action_result (ActionResult) – The result to cache for the given Action digest.