buildgrid.server.bots.instance module

BotsInterface

Instance of the Remote Workers interface.

class buildgrid.server.bots.instance.BotsInterface(scheduler: SQLDataStore, *, job_assignment_interval: float = 1.0)

Bases: Instance

SERVICE_NAME: ClassVar[str] = 'google.devtools.remoteworkers.v1test2.Bots'

The expected FULL_NAME of the Service which will wrap this instance. This value should be declared on the class of any Instance implementations.

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.

set_instance_name(instance_name: str) None

Set the instance name associated with this instance. This method may be overriden if extra referencing is required.

Parameters:

instance_name (str) – The new instance’s name.

Raises:

AssertionError – if the instance is already registered.

create_bot_session_ignored_exceptions = (<class 'buildgrid._exceptions.RetriableError'>,)
create_bot_session(bot_session: BotSession, context: ServicerContext, deadline: float | None = None) BotSession

Creates a new bot session. Server should assign a unique name to the session. If the bot_id already exists in the database then any leases already assigned to that id are requeued (via close_bot_session) and then the name previously associated with the bot_id is replaced with the new name in the database. If the bot_id is not in the database, a new record is created.

update_bot_session_ignored_exceptions = (<class 'buildgrid._exceptions.RetriableError'>,)
update_bot_session(bot_session: BotSession, context: ServicerContext, deadline: float | None = None) Tuple[BotSession, List[Tuple[str, bytes]]]

Client updates the server. Any changes in state to the Lease should be registered server side. Assigns available leases with work.

count_bots() int
count_bots_by_status(status: BotStatus) int