New issue
Advanced search Search tips

Issue 857598 link

Starred by 1 user

Issue metadata

Status: Assigned
Owner:
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: ----
Pri: 2
Type: Feature

Blocking:
issue 846020



Sign in to add a comment

Bot.ListTasks: Query for tasks sorted by STARTED_TS

Project Member Reported by pprabhu@chromium.org, Jun 28 2018

Issue description

Currently, the Bot.ListTasks API (http://shortn/_pXphJYqhBI) allows sorting the tasks by the following fields: CREATED_TS, MODIFIED_TS, COMPLETED_TS, ABANDONED_TS

http://shortn/_yDodrVBv65

This doesn't support the following use-case: we want to know how long a bot has been idle. For this, we want to know when the last task that ran on the bot completed. We don't care whether the task completed (pass/fail), or was killed, or timed out. All we care about is that the bot was utilized for the task.

So, we need either:
[1] A combined sort based on COMPLETED_TS (for completed/killed tasks) / ABANDONED_TS (for timed out tasks)
[2] Sort based on STARTED_TS.

I think [2] is cleaner and handles the use-case stated, from my understanding so far.
 
Blocking: 846020
Owner: mar...@chromium.org
Status: Assigned (was: Untriaged)
Dunno was the triaging process is, so handing it off directly.
Labels: -Type-Bug Type-Feature

Comment 4 by mar...@chromium.org, Jun 29 2018

Components: Infra>Platform>Swarming
Labels: -OS-Mac
Oh, the easiest way to answer this question is via a bot events query, here's an example:

./swarming.py query --limit 0 -S chromeos-swarming.appspot.com 'bot/chromeos-skylab-bot-06321e38-7463-4889-9752-4413899e9880/events?start=1541449500&end=1541535900'

That should give enough information to answer your question.
I think it still makes sense for this to be implemented Swarming side, since the client will need to make more queries to get the task details.  Either we query for each task individually after querying the task_complete events (which is expensive RPC-wise), or we still need to query all tasks sorted by created_ts, which gives us no guarantee how far back we need to query before we get all the tasks we want, especially as we start creating more low priority tasks that get run far after they were created to take advantage of spare capacity.
Summary: Bot.ListTasks: Query for tasks sorted by STARTED_TS (was: Bot.ListTasks: Support sorting tasks uniformly independent of the tasks completion status)
+1 to c#6, our experience with autotest suggests that trying to reorder list of tasks on client side doesn't scale well in our usecase because we have tasks that often run ~ 1 week after creation (by design: we have weekly low priority suites that slowly fill in the gaps between bursty latency sensitive tasks)

Sign in to add a comment