atomscale.similarity.polling.start_polling_trajectory_task#
- atomscale.similarity.polling.start_polling_trajectory_task(client, source_id: str, *, interval: float = 1.0, last_n: int | None = None, on_result: Callable[[DataFrame], Any] | None = None, **kwargs) Task[None][source]
Start polling trajectory data as an asyncio.Task.
Wraps aiter_poll_trajectory in a background Task. If on_result returns a coroutine, it will be awaited before the next iteration.
- Parameters:
client – API client instance forwarded to the provider.
source_id (
str) – The data_id or physical_sample_id to poll trajectory for.interval (
float) – Seconds between polls. Defaults to 1.0.last_n (
int|None) – Last number of trajectory data points to poll for. None is all.on_result (
Callable[[DataFrame],Any] |None) – Optional callback invoked with each yielded result. If it returns a coroutine, it will be awaited.**kwargs – Additional keyword arguments forwarded to aiter_poll_trajectory (e.g., distinct_by, until, max_polls, fire_immediately, jitter, on_error).
- Returns:
A created and started Task. Cancel it to stop polling.
- Return type:
asyncio.Task[None]
- Raises:
RuntimeError – If no running event loop is available when called.