Split timeSpent query into 2 separate queries, as postgresql isn't able to figure out a decent query plan. With 120k jobs in queue, this makes some queries go from 100s to 1-2s.

[?]
May 1, 2015, 10:28 AM
QMC6IMJQ3CTMLLEERF5YT7JS3RJW4UJ2BKEJA43WRQ5OL72G6ZMAC

Dependencies

  • [2] X3YLTWJA hydra-queue-runner: Cache the lookup of time spent per jobset
  • [3] GEADFVZ5 hydra-queue-runner: Improved scheduling
  • [*] 7YBYT2LQ

Change contents

  • replacement in src/script/hydra-queue-runner at line 151
    [2.335][2.335:446]()
    { where => \ ("(finished = 0 or (me.stoptime >= " . (time() - $windowSize) . "))")
    [2.335]
    [2.446]
    { where => \ ("(finished = 0)")
    , join => 'buildsteps'
    , select => \ "sum(coalesce(buildsteps.stoptime, ${\time}) - buildsteps.starttime)"
    , as => "sum" })->single->get_column("sum") // 0;
    $timeSpent += $jobset->builds->search(
    { },
    { where => \ ("(me.stoptime >= " . (time() - $windowSize) . ")")