Hi RobustRat47 , I'm not sure I understand the question...?
you can try something like this - which reproduces the gui behavior
` import math
import datetime
from clearml.backend_api.session.client import APIClient
client = APIClient()
q = client.queues.get_all(name='queue-2')[0]
n = math.floor(datetime.timestamp(datetime.now()))
res = client.queues.get_queue_metrics(from_date=n-1, to_date=n, interval=1, queue_ids=[q.id]) `Be careful though of the null value in the results. It happens when the there are values in the res than intervals between start and stop dates
Umm no luck
q = client.queues.get_all(name='default')[0] from_date = math.floor(datetime.timestamp(datetime.now() - relativedelta(months=3))) to_date = math.floor(datetime.timestamp(datetime.now())) res = client.queues.get_queue_metrics(from_date=from_date, to_date=to_date, interval=1, queue_ids=[q.id])
Are there any errors in the server that might indicate issues with writing the queue stats?
I also noticed that my queue stats haven't been updated since 7/1/2022 @ 12:41am
<queues.GetQueueMetricsResponse: { "queues": [] }>
hi RobustRat47
the field name is active_duration, and it is expressed in seconds
to access it for the task my_task , do my_task.d
ata.active_duration
Going for something like this:
` >>> queue = QueueMetrics(queue='queueid')
queue.avg_waiting_times `
Usually that is shown here... for some reason it's not showing
next one I'm looking for is average queue time
` client.queues.get_default()
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/opt/conda/lib/python3.9/site-packages/clearml/backend_api/session/client/client.py", line 378, in new_func
return Response(self.session.send(request_cls(*args, **kwargs)))
File "/opt/conda/lib/python3.9/site-packages/clearml/backend_api/session/client/client.py", line 122, in send
raise APIError(result)
clearml.backend_api.session.client.client.APIError: APIError: code 400/707: No queue is tagged as the default queue for this company `
can you please try to replace client.queues.get_all by client.queues.get_default ?
this is a specific function for retrieving the default queue 🙂
please note from_date
and to_date
need to be epoch floats (casted to in, they should represent milliseconds, not microseconds)
RobustRat47 getting the default
queue ID should be enough
this is the response. We are using the clearml hosted server
what do you mean ? the average time that the tasks are waiting before being executed by an agent ? that is to say the average difference between enqueue time and beginning time ?
I'll like to call Run Time
via the task object.... I think I need to calculate manually
i.e.
task = clearml.Task.get_task(id) time = task.data.last_update - task.data.started