Skip to main content

StatusMessageWatcher

Polls and logs Actor run status messages in a background thread.

The status message and status of the Actor run are polled at a fixed interval and forwarded to the provided logger whenever they change. There is no guarantee that every intermediate status message will be captured, especially when messages change rapidly.

Can be used as a context manager, which automatically starts and stops the polling thread. Alternatively, call start and stop manually. Obtain an instance via RunClient.get_status_message_watcher.

Hierarchy

Index

Methods

__enter__

  • __enter__(): Self
  • Start the logging thread within the context. Exiting the context will stop the logging thread.


    Returns Self

__exit__

  • __exit__(exc_type, exc_val, exc_tb): None
  • Stop the logging thread.


    Parameters

    • exc_type: type[BaseException] | None
    • exc_val: BaseException | None
    • exc_tb: TracebackType | None

    Returns None

__init__

  • __init__(*, run_client, to_logger, check_period): None
  • Initialize StatusMessageWatcher.


    Parameters

    • keyword-onlyrun_client: RunClient

      The run client used to poll the Actor run status and status message.

    • keyword-onlyto_logger: logging.Logger

      The logger to which the status messages will be forwarded.

    • optionalkeyword-onlycheck_period: timedelta = timedelta(seconds=1)

      How often to poll the status message.

    Returns None

start

  • start(): Thread
  • Start the polling thread.

    The caller is responsible for cleanup by calling the stop method when done.


    Returns Thread

stop

  • stop(): None
  • Signal the logging thread to stop logging and wait for it to finish.


    Returns None

Page Options