Task Search
As of 0.5.0, Singularity has better support for searching historical tasks. A global task search endpoint was added:
/api/history/tasks -> Retrieve the history sorted by startedAt for all inactive tasks.
The above endpoint as well as /api/history/request/{requestId}/tasks now take additonal query parameters:
requestId: Optional request id to match (only for/api/history/tasksendpoint as it is already specified in the path for/request/{requestId}/tasks)deployId: Optional deploy id to matchhost: Optional host (agent host name) to matchlastTaskStatus: OptionalExtendedTaskStateto matchstartedAfter: Optionally match only tasks started after this time (13 digit unix timestamp)startedBefore: Optionally match only tasks started before this time (13 digit unix timestamp)orderDirection: Sort direction (bystartedAt), can be ASC or DESC, defaults to DESC (newest tasks first)count: Maximum number of items to return, defaults to 100 and has a maximum value of 1000page: Page of items to view (e.g. page 1 is the firstcountitems, page 2 is the nextcountitems), defaults to 1
For clusters using a database that have a large number of tasks in the history, a relevant configuration option of taskHistoryQueryUsesZkFirst has been added in the base Singularity Configuration. This option can be used to either prefer efficiency or exact ordering when searching through task history, it defaults to false.
When
falsethe setting will prefer correct ordering. This may require multiple database calls, since Singularity needs to determine the overall order of items base on persisted (in the database) and non-persisted (still in zookeeper) tasks. The overall search may be less efficient, but the ordering is guranteed to be correct.When
truethe setting will prefer efficiency. In this case, it will be assumed that all task histories in zookeeper (not yet persisted) come before those in the database (persisted). This results in faster results and fewer queries, but ordering is not guaranteed to be correct between persisted and non-persisted items.