Module: Postjob::Workflow

Defined in:
lib/postjob/workflow.rb

Overview

This module defines the interface available for workflow modules.

This module is extended into the actual workflow module during registering.

Instance Method Summary collapse

Instance Method Details

#async(runner, *args, timeout: nil, max_attempts: nil, queue: nil) ⇒ Object

see Postjob::Runner.async



18
19
20
# File 'lib/postjob/workflow.rb', line 18

def async(runner, *args, timeout: nil, max_attempts: nil, queue: nil)
  ::Postjob::Runner.async(runner, *args, timeout: timeout, max_attempts: max_attempts, queue: queue)
end

#await(job, *args, timeout: nil, max_attempts: nil) ⇒ Object

see Postjob::Runner.await



23
24
25
# File 'lib/postjob/workflow.rb', line 23

def await(job, *args, timeout: nil, max_attempts: nil)
  ::Postjob::Runner.await(job, *args, timeout: timeout, max_attempts: max_attempts)
end

#workflow_token(job) ⇒ Object

see Postjob::Runner.workflow_token



28
29
30
31
# File 'lib/postjob/workflow.rb', line 28

def workflow_token(job)
  expect! job.parent_id => ::Postjob::Runner.current_job.id
  ::Postjob::Queue.find_or_create_token(job)
end