class Bosh::Director::Api::Controllers::TasksController
Public Class Methods
new(config)
click to toggle source
Calls superclass method
Bosh::Director::Api::Controllers::BaseController::new
# File lib/bosh/director/api/controllers/tasks_controller.rb, line 7 def initialize(config) super(config) @deployment_manager = Api::DeploymentManager.new end
Public Instance Methods
filter_task_by_deployment_and_teams(dataset, deployment, token_scopes, limit)
click to toggle source
# File lib/bosh/director/api/controllers/tasks_controller.rb, line 80 def filter_task_by_deployment_and_teams(dataset, deployment, token_scopes, limit) if deployment dataset = dataset.where(deployment_name: deployment) end if token_scopes teams = Models::Team.transform_admin_team_scope_to_teams(token_scopes) dataset = dataset.where(teams: teams) end if limit dataset = dataset.limit(limit) end dataset.order_by(Sequel.desc(:timestamp)).all end
Private Instance Methods
task_timeout?(task)
click to toggle source
# File lib/bosh/director/api/controllers/tasks_controller.rb, line 139 def task_timeout?(task) # Some of the old task entries might not have the checkpoint_time unless task.checkpoint_time task.checkpoint_time = Time.now task.save end # If no checkpoint update in 3 cycles --> timeout (task.state == 'processing' || task.state == 'cancelling') && (Time.now - task.checkpoint_time > Config.task_checkpoint_interval * 3) end