X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/1e54d655b91afae99816f47ac3b9283ae12ba4c2..94d2af98f5882985e57d8dd1b17a2fd2e8cc8734:/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 bd6cbd0df6..3a255adf5c 100644 --- a/services/api/app/controllers/arvados/v1/jobs_controller.rb +++ b/services/api/app/controllers/arvados/v1/jobs_controller.rb @@ -122,8 +122,9 @@ class Arvados::V1::JobsController < ApplicationController while not @job.started_at # send a summary (job queue + available nodes) to the client # every few seconds while waiting for the job to start - last_ack_at ||= Time.now - Q_UPDATE_INTERVAL - 1 - if Time.now - last_ack_at >= Q_UPDATE_INTERVAL + current_time = db_current_time + last_ack_at ||= current_time - Q_UPDATE_INTERVAL - 1 + if current_time - last_ack_at >= Q_UPDATE_INTERVAL nodes_in_state = {idle: 0, alloc: 0} ActiveRecord::Base.uncached do Node.where('hostname is not ?', nil).collect do |n| @@ -139,13 +140,13 @@ class Arvados::V1::JobsController < ApplicationController break if j.uuid == @job.uuid n_queued_before_me += 1 end - yield "#{Time.now}" \ + yield "#{db_current_time}" \ " job #{@job.uuid}" \ " queue_position #{n_queued_before_me}" \ " queue_size #{job_queue.size}" \ " nodes_idle #{nodes_in_state[:idle]}" \ " nodes_alloc #{nodes_in_state[:alloc]}\n" - last_ack_at = Time.now + last_ack_at = db_current_time end sleep 3 ActiveRecord::Base.uncached do