Class: Bosh::Director::JobQueue

Inherits:
Object
  • Object
show all
Defined in:
lib/bosh/director/job_queue.rb

Overview

Abstracts the delayed jobs system.

Instance Method Summary collapse

Instance Method Details

#enqueue(username, job_class, description, params, deployment = nil) ⇒ Object



8
9
10
11
12
13
14
15
16
# File 'lib/bosh/director/job_queue.rb', line 8

def enqueue(username, job_class, description, params, deployment = nil)
  task = Api::TaskHelper.new.create_task(username, job_class.job_type, description, deployment)

  Delayed::Worker.backend = :sequel
  db_job = Bosh::Director::Jobs::DBJob.new(job_class, task.id, params)
  Delayed::Job.enqueue db_job

  task
end