X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/403d9f6b700f38cd3caf067445233b5ead99466c..f19ce869a14511bb8031309a75fd9ee7acfeee6c:/services/api/app/controllers/arvados/v1/jobs_controller.rb diff --git a/services/api/app/controllers/arvados/v1/jobs_controller.rb b/services/api/app/controllers/arvados/v1/jobs_controller.rb index 7b3b6586f6..901b7423e4 100644 --- a/services/api/app/controllers/arvados/v1/jobs_controller.rb +++ b/services/api/app/controllers/arvados/v1/jobs_controller.rb @@ -65,9 +65,9 @@ class Arvados::V1::JobsController < ApplicationController incomplete_job = nil @objects.each do |j| if j.nondeterministic != true and - ((j.success == true and j.output != nil) or j.running == true) and + ["Queued", "Running", "Complete"].include?(j.state) and j.script_parameters == resource_attrs[:script_parameters] - if j.running && j.owner_uuid == current_user.uuid + if j.state != "Complete" && j.owner_uuid == current_user.uuid # We'll use this if we don't find a job that has completed incomplete_job ||= j else @@ -100,6 +100,11 @@ class Arvados::V1::JobsController < ApplicationController show end + def lock + @object.lock current_user.uuid + show + end + class LogStreamer Q_UPDATE_INTERVAL = 12 def initialize(job, opts={}) @@ -151,12 +156,7 @@ class Arvados::V1::JobsController < ApplicationController params[:order] ||= ['priority desc', 'created_at'] load_limit_offset_order_params load_where_param - @where.merge!({ - started_at: nil, - is_locked_by_uuid: nil, - cancelled_at: nil, - success: nil - }) + @where.merge!({state: Job::Queued}) return if false.equal?(load_filters_param) find_objects_for_index index @@ -164,7 +164,8 @@ class Arvados::V1::JobsController < ApplicationController def queue_size # Users may not be allowed to see all the jobs in the queue, so provide a - # method to get the actual queue length. + # method to get just the queue size in order to get a gist of how busy the + # cluster is. render :json => {:queue_size => Job.queue.size} end