How-To: Monitor Worker Performance
Last updated
Was this helpful?
Last updated
Was this helpful?
Was this helpful?
import lattica_common.auth_local_state as auth
import lattica_common.app_api as agent_app
# Notice your account token expires every 30 days and it's up to you to renew it
auth.set_session_token("your_account_token_you_got_in_your_email")
# Retrieve all active workers for a specific model
active_workers = agent_app.worker.get_active_workers("model_id")
# Iterate through each active worker and get detailed worker information
for active_worker in active_workers:
# Retrieve worker information using the workerSessionId
worker_session_id = active_worker.workerSessionId
# In case of failur this function throws
worker_info = agent_app.worker.get_worker_info(worker_session_id)
# Print or process the worker information as needed
print(f"Worker Session ID: {worker_session_id}")
print(f"Worker Info: {worker_info}\n")