Thanks for the discussion 🙂
It helped me too.
is there an available reference for how I can use the API calls with the python API? it is not clear to me from what you shared
AgitatedDove14 I believe that worker status doesn't is not considered a metric?
it is missing the status that I'm looking for, namely is this worker is running a task or not
thanks AgitatedDove14 ! this is what I was looking for
It's just the print (_ repr _) not showing the datafor w in client.workers.get_all(): print(w.data)
When you say status, what do you mean? Is it active? Running a task?
So basically the APIClient is a pythonic interface to the RestAPI, so you can do the following
See if this one works# stats from he last 60 seconds for worker in workers: print(client.workers.get_stats(worker_ids=[worker.id], from_date=int(time()-60),to_date=int(time()), interval=60, ))
Hmm yes we should probably provide metrics:client.workers.get_stats(..., items=[dict(key='cpu_usage'), dict(key='gpu_usage')])
Ohh so even easier:print(client.workers.get_all())
AgitatedDove14 , this was my starting point, however this is only a list of workers ids and names for example:{'id': 'ip-777-77-7-77.us-east-7.compute.internal:0', 'name': <function Entity.__getattr__.<locals>.new_func at 0x782477c68ca0>}
I am getting the following error when I try the above:
` /opt/conda/envs/torch_38/lib/python3.8/site-packages/clearml/backend_api/session/client/client.py in new_func(self, *args, **kwargs)
374 @wrap
375 def new_func(self, *args, **kwargs):
--> 376 return Response(self.session.send(request_cls(*args, **kwargs)))
377
378 new_func.name = new_func.qualname = action
TypeError: init() missing 1 required positional argument: 'items' `
it works.. but I am actually trying to access the status not the stats, is that an option?
Hi DepressedChimpanzee34
This is not a query call, this is a reporting call. see docs below
https://clear.ml/docs/latest/docs/references/api/workers#post-workersstatus_report
It is used by the worker to report its own status.
I think this is what you are looking for:
https://clear.ml/docs/latest/docs/references/api/workers#post-workersget_stats
from the docs::param items: List of metric keys and requested statistics