Class: ActiveJob::QueueAdapters::K8sAdapter

Inherits:
Object
  • Object
show all
Defined in:
lib/active_job/queue_adapters/k8s_adapter.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(**executor_options) ⇒ K8sAdapter

Returns a new instance of K8sAdapter.



11
12
13
# File 'lib/active_job/queue_adapters/k8s_adapter.rb', line 11

def initialize(**executor_options)
  @scheduler = ActiveJobK8s::Scheduler.new(**executor_options)
end

Instance Attribute Details

#schedulerObject (readonly)

Returns the value of attribute scheduler.



9
10
11
# File 'lib/active_job/queue_adapters/k8s_adapter.rb', line 9

def scheduler
  @scheduler
end

Instance Method Details

#enqueue(job) ⇒ Object



15
16
17
# File 'lib/active_job/queue_adapters/k8s_adapter.rb', line 15

def enqueue(job)
  scheduler.create_job(job)
end

#enqueue_at(job, scheduled_at) ⇒ Object



19
20
21
# File 'lib/active_job/queue_adapters/k8s_adapter.rb', line 19

def enqueue_at(job,scheduled_at)
  scheduler.create_job(job,scheduled_at:scheduled_at)
end