Class: Wukong::Local::LocalRunner
- Includes:
- Wukong::Logging
- Defined in:
- lib/wukong/local/runner.rb
Overview
Implements the Runner for wu-local.
Direct Known Subclasses
Instance Attribute Summary
Attributes inherited from Runner
Instance Method Summary collapse
-
#dataflow ⇒ String
(also: #processor)
Returns the name of the dataflow we're going to run.
-
#driver ⇒ Class, #start
The class used.
-
#run ⇒ Object
Starts up the driver with the right dataflow and settings.
-
#setup ⇒ Object
Adds a customized help message built from the Processor # itself.
-
#validate ⇒ true
Validates the chosen processor.
Methods included from Wukong::Logging
Methods inherited from Runner
#args, #dataflow?, #dataflow_class_for, description, #description, die, #initialize, #processor?, #program_name, #program_name=, #registered?, #root, run, #usage, usage
Methods included from Runner::BootSequence
Methods included from Runner::HelpMessage
#dump_help, #dump_help_and_exit!, #help_given?, #strip_help_param!
Methods included from Runner::DeployPackLoader
#deploy_pack_dir, #environment_file, #in_deploy_pack?, #load_deploy_pack, #loaded_deploy_pack?
Methods included from Runner::CodeLoader
Constructor Details
This class inherits a constructor from Wukong::Runner
Instance Method Details
#dataflow ⇒ String Also known as: processor
Returns the name of the dataflow we're going to run.
49 50 51 52 53 54 55 56 57 58 |
# File 'lib/wukong/local/runner.rb', line 49 def dataflow arg = args.first basename = File.basename(arg.to_s, '.rb') case when settings[:run] then settings[:run] when arg && File.exist?(arg) then basename else arg end end |
#driver ⇒ Class, #start
The class used
90 91 92 |
# File 'lib/wukong/local/runner.rb', line 90 def driver StdioDriver end |
#run ⇒ Object
Starts up the driver with the right dataflow and settings.
Starts the EventMachine reactor before starting the driver.
81 82 83 84 85 |
# File 'lib/wukong/local/runner.rb', line 81 def run EM.run do driver.start(dataflow, settings) end end |
#setup ⇒ Object
Adds a customized help message built from the Processor
itself.
73 74 75 76 |
# File 'lib/wukong/local/runner.rb', line 73 def setup super() dataflow_class_for(dataflow).configure(settings) if registered?(dataflow) end |
#validate ⇒ true
Validates the chosen processor.
65 66 67 68 69 |
# File 'lib/wukong/local/runner.rb', line 65 def validate raise Error.new("Must provide a processor or dataflow to run, via either the --run option or as the first argument") if dataflow.nil? || dataflow.empty? raise Error.new("No such processor or dataflow <#{dataflow}>") unless registered?(dataflow) true end |