Examples: query, "exact match", wildcard*, wild?ard, wild*rd
Fuzzy search: cake~ (finds cakes, bake)
Term boost: "red velvet"^4, chocolate^2
Field grouping: tags:(+work -"fun-stuff")
Escaping: Escape characters +-&|!(){}[]^"~*?:\ with \, e.g. \+
Range search: properties.timestamp:[1587729413488 TO *] (inclusive), properties.title:{A TO Z}(excluding A and Z)
Combinations: chocolate AND vanilla, chocolate OR vanilla, (chocolate OR vanilla) NOT "vanilla pudding"
Field search: properties.title:"The Title" AND text
Answered
How Can I Call The

How can I call the runtime of a experiment running on the clearml agent?

  
  
Posted one year ago
Votes Newest

Answers 20


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

  
  
Posted one year ago

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

  
  
Posted one year ago

next one I'm looking for is average queue time

  
  
Posted one year ago

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

  
  
Posted one year ago

cool thanks - I'll try it out

  
  
Posted one year ago

this is the response. We are using the clearml hosted server

  
  
Posted one year ago

` 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 `

  
  
Posted one year ago

I also noticed that my queue stats haven't been updated since 7/1/2022 @ 12:41am

  
  
Posted one year ago

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 🙂

  
  
Posted one year ago

yes exactly

  
  
Posted one year ago

<queues.GetQueueMetricsResponse: { "queues": [] }>

  
  
Posted one year ago

Hi RobustRat47 , I'm not sure I understand the question...?

  
  
Posted one year ago

Going for something like this:
` >>> queue = QueueMetrics(queue='queueid')

queue.avg_waiting_times `

  
  
Posted one year ago

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])

  
  
Posted one year ago

Are there any errors in the server that might indicate issues with writing the queue stats?

  
  
Posted one year ago

please note from_date and to_date need to be epoch floats (casted to in, they should represent milliseconds, not microseconds)

  
  
Posted one year ago

Usually that is shown here... for some reason it's not showing

  
  
Posted one year ago

ahhh okay thank you 🙂

  
  
Posted one year ago

RobustRat47 getting the default queue ID should be enough

  
  
Posted one year ago

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 ?

  
  
Posted one year ago
524 Views
20 Answers
one year ago
one year ago
Tags
Similar posts