9773: Fix up find-or-create-job code.
authorTom Clegg <tom@curoverse.com>
Fri, 19 Aug 2016 19:00:09 +0000 (15:00 -0400)
committerTom Clegg <tom@curoverse.com>
Mon, 22 Aug 2016 20:27:34 +0000 (16:27 -0400)
commit321b2b5486a7e64527eae9718c54425de9285d7c
tree06d6422037d29c2c42fb2cf89d9cab20a0b7f4e1
parenta786d20e2ac2dbc5fd78a6100b23e391ddb3ce32
9773: Fix up find-or-create-job code.

* Reduce pyramid of conditions

* Ask the database to filter script_parameters, instead of doing that in Ruby

* Ditto job state

* Check "output is readable?" only once, not once per candidate job

* If two matching jobs have different outputs, avoid reusing either of them,
  even if one of the outputs is not readable by current_user.
services/api/app/controllers/arvados/v1/jobs_controller.rb