buildgrid.client.actioncache module

buildgrid.client.actioncache.query(channel, instance=None)

Context manager generator for the ActionCacheClient class.

class buildgrid.client.actioncache.ActionCacheClient(channel, instance=None)

Bases: object

Remote ActionCache service client helper.

The ActionCacheClient class comes with a generator factory function that can be used together with the with statement for context management:

from buildgrid.client.actioncache import query

with query(channel, instance='build') as action_cache:
    digest, action_result = action_cache.get(action_digest)
get(action_digest)

Retrieves the cached ActionResult for a given Action.

Parameters

action_digest (Digest) – the action’s digest to query.

Returns

the cached result or None if not found.

Return type

ActionResult

Raises

grpc.RpcError – on any network or remote service error.

update(action_digest, action_result)

Maps in cache an Action to an ActionResult.

Parameters
  • action_digest (Digest) – the action’s digest to update.

  • action_result (ActionResult) – the action’s result.

Returns

the cached result or None on failure.

Return type

ActionResult

Raises

grpc.RpcError – on any network or remote service error.

close()

Closes the underlying connection stubs.