Class: Pipes::Runner

Inherits:
Object
  • Object
show all
Defined in:
lib/pipes/runner.rb

Overview

This is the entry point to running jobs.

In most cases, this is the sole API used to start up some jobs and run a series of stages (a pipe).

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(jobs, job_args, options) ⇒ Runner

Set up the runner.



31
32
33
34
35
36
37
38
39
40
41
42
# File 'lib/pipes/runner.rb', line 31

def initialize(jobs, job_args, options)
  @job_args, @options = job_args, options

  @requested = normalize_jobs(jobs)

  # Resolve if the option has been explicitly passed or it's specified in the config.
  if @options[:resolve] or (@options[:resolve] != false and Pipes.resolve)
    @requested = include_dependencies(@requested)
  end

  Store.add_pipe(construct_pipe, options)
end

Class Method Details

.run(jobs, *args) ⇒ Object

Entry point to begin running jobs.

eg, Pipes::Runner.run(MyStrategies::ContentWriter)

  ie, You want to run a single job from somewhere in the app.
Pipes::Runner.run('MyStrategies::ContentWriter')
  ie, Params were passed for a single job 
Pipes::Runner.run([MyStrategies::ContentWriter, YourStrategies::Publisher])
  ie, You want to run multiple jobs from somewhere in the app.
Pipes::Runner.run(['MyStrategies::ContentWriter', 'YourStrategies::Publisher'])
  ie, Params were passed for multiple jobs
Pipes::Runner.run(:content_writers)
  ie, You want to run an entire stage
Pipes::Runner.run([:content_writers, :publishers])
  ie, You want to run multiple stages


24
25
26
27
# File 'lib/pipes/runner.rb', line 24

def self.run(jobs, *args)
  options = args.last.is_a?(Hash) ? args.pop : {}
  self.new(jobs, args, options)
end