Status

Clients often wait for jobs to finish. Instead of asking the broker for the status of each job in turn, a client can subscribe to one stream of status updates for all of its jobs.

multi_job_status_stream() is an async generator over that stream:

from momotor.rpc.status.client import multi_job_status_stream

async for status in multi_job_status_stream(client_stub):
    print(status)

Each item is a JobStatusStream message for one job event. The connect_timeout and status_timeout parameters bound the wait for the stream to open and for the next message.

API reference

async momotor.rpc.status.client.multi_job_status_stream(stub, *, connect_timeout=None, status_timeout=None)

Async generator that connects to the multiJobStatusStream() client endpoint and yields the JobStatusStream status messages

Parameters:
  • stub (ClientStub) – The connected client stub

  • connect_timeout (float | None) – Connection timeout

  • status_timeout (float | None) – Status message timeout

Return type:

AsyncIterable[JobStatusStream]