stream_task_host_resources#
- MonitorApi.stream_task_host_resources(task_id, project_id, *, backlog=100, max_messages=None)#
Stream CPU and memory metric updates for the host running a specific task.
Resolves the task’s assigned evaluator (via JMS and RMS) and subscribes to
host_resourcesmetric messages for that evaluator. Yields each update as it arrives.- Return type:
- Parameters:
- task_id
str The task identifier to monitor.
- project_id
str The JMS project identifier that owns
task_id.- backlog
int,optional Number of historical metric messages to request on connect. The default is
100.- max_messages
intorNone,optional Maximum total messages to yield before closing the connection. The default is
None, which streams indefinitely until interrupted or the server closes the connection.
- task_id
- Yields:
MonitorMessageParsed JSON host-resource metric dicts from the server.
Examples
>>> for update in api.stream_task_host_resources("task-123", "project-abc"): ... cpu = update.get("cpu_percent") ... mem = update.get("memory_percent") ... print(f"CPU: {cpu}% Memory: {mem}%")