buildgrid.server.bots.instance module

class buildgrid.server.bots.instance.BotsInterface(scheduler: Scheduler)

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.

create_bot_session(bot_session: BotSession, context: CancellationContext, 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(bot_session: BotSession, context: CancellationContext, deadline: float | None = None, partial_execution_metadata: Dict[str, ExecutedActionMetadata] | 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_by_status() Dict[BotStatus, int]