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 11 months ago
Votes Newest

Answers 20


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

  
  
Posted 11 months ago

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 11 months 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 11 months ago

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

  
  
Posted 11 months ago

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

  
  
Posted 11 months ago

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

  
  
Posted 11 months ago

cool thanks - I'll try it out

  
  
Posted 11 months 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 11 months ago

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

queue.avg_waiting_times `

  
  
Posted 11 months ago

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

  
  
Posted 11 months ago

next one I'm looking for is average queue time

  
  
Posted 11 months ago

ahhh okay thank you 🙂

  
  
Posted 11 months ago

yes exactly

  
  
Posted 11 months 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 11 months 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 11 months ago

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

  
  
Posted 11 months ago

RobustRat47 getting the default queue ID should be enough

  
  
Posted 11 months ago

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

  
  
Posted 11 months 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 11 months 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 11 months ago
97 Views
20 Answers
11 months ago
4 months ago
Tags
Similar posts