class ActiveJob::QueueAdapters::KubernetesAdapter

Public Instance Methods

enqueue(job) click to toggle source
# File lib/active_job/queue_adapters/kubernetes_adapter.rb, line 8
def enqueue(job)
  serialized_job = JSON.dump(job.serialize)
  kube_job = Kubeclient::Resource.new(job.manifest)

  kube_job.spec.template.spec.containers.map do |container|
    container.env ||= []
    container.env.push({
      'name' => 'SERIALIZED_JOB',
      'value' => serialized_job
    })
  end

  job.kubeclient('/apis/batch').create_job(kube_job)
end
enqueue_at(_job, _timestamp) click to toggle source
# File lib/active_job/queue_adapters/kubernetes_adapter.rb, line 23
def enqueue_at(_job, _timestamp)
  raise NotImplementedError, 'Enqueueing jobs in the future is not supported.'
end