# StatusMessageWatcherAsync<!-- -->

Polls and logs Actor run status messages in an asyncio task.

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 an async context manager, which automatically starts and cancels the polling task. Alternatively, call `start` and `stop` manually. Obtain an instance via `RunClientAsync.get_status_message_watcher`.

### Hierarchy

* [StatusMessageWatcherBase](https://docs.apify.com/api/client/python/reference/class/StatusMessageWatcherBase.md)
  * *StatusMessageWatcherAsync*

## Index[](#Index)

### Methods

* [\_\_aenter\_\_](https://docs.apify.com/api/client/python/reference/class/StatusMessageWatcherAsync.md#__aenter__)
* [\_\_aexit\_\_](https://docs.apify.com/api/client/python/reference/class/StatusMessageWatcherAsync.md#__aexit__)
* [\_\_init\_\_](https://docs.apify.com/api/client/python/reference/class/StatusMessageWatcherAsync.md#__init__)
* [start](https://docs.apify.com/api/client/python/reference/class/StatusMessageWatcherAsync.md#start)
* [stop](https://docs.apify.com/api/client/python/reference/class/StatusMessageWatcherAsync.md#stop)

## Methods<!-- -->[](#Methods)

### [](#__aenter__)\_\_aenter\_\_

* async **\_\_aenter\_\_**(): Self

- Start the logging task within the context. Exiting the context will cancel the logging task.

  ***

  #### Returns Self

### [](#__aexit__)\_\_aexit\_\_

* async **\_\_aexit\_\_**(exc_type, exc_val, exc_tb): None

- Cancel the logging task.

  ***

  #### Parameters

  * ##### exc_type: [type](https://docs.apify.com/api/client/python/reference/class/DatasetSchemaValidationError.md#type)\[BaseException] | None
  * ##### exc_val: BaseException | None
  * ##### exc_tb: TracebackType | None

  #### Returns None

### [](#__init__)\_\_init\_\_

* **\_\_init\_\_**(\*, run_client, to_logger, check_period): None

- Overrides [StatusMessageWatcherBase.\_\_init\_\_](https://docs.apify.com/api/client/python/reference/class/StatusMessageWatcherBase.md#__init__)

  Initialize `StatusMessageWatcherAsync`.

  ***

  #### Parameters

  * ##### keyword-onlyrun_client: [RunClientAsync](https://docs.apify.com/api/client/python/reference/class/RunClientAsync.md)

    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

* **start**(): [Task](https://docs.apify.com/api/client/python/reference/class/Task.md)

- Start the polling task.

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

  ***

  #### Returns [Task](https://docs.apify.com/api/client/python/reference/class/Task.md)

### [](#stop)stop

* async **stop**(): None

- Stop the logging task.

  ***

  #### Returns None
