Class: Commands::StepCommand

Inherits:
Command show all
Defined in:
lib/commands.rb

Instance Attribute Summary collapse

Attributes inherited from Command

#arg, #commands, #description, #logger, #name

Instance Method Summary collapse

Methods inherited from Command

#enact, #get_field, #has_value, #have, #option, #require, #require_single_jobflow, #resolve

Constructor Details

#initialize(*args) ⇒ StepCommand

Returns a new instance of StepCommand.



213
214
215
216
# File 'lib/commands.rb', line 213

def initialize(*args)
  super(*args)
  @args = []
end

Instance Attribute Details

#apps_pathObject

Returns the value of attribute apps_path.



210
211
212
# File 'lib/commands.rb', line 210

def apps_path
  @apps_path
end

#argsObject

Returns the value of attribute args.



210
211
212
# File 'lib/commands.rb', line 210

def args
  @args
end

#beta_pathObject

Returns the value of attribute beta_path.



210
211
212
# File 'lib/commands.rb', line 210

def beta_path
  @beta_path
end

#enable_debugging_pathObject

Returns the value of attribute enable_debugging_path.



211
212
213
# File 'lib/commands.rb', line 211

def enable_debugging_path
  @enable_debugging_path
end

#hive_cmdObject

Returns the value of attribute hive_cmd.



211
212
213
# File 'lib/commands.rb', line 211

def hive_cmd
  @hive_cmd
end

#hive_pathObject

Returns the value of attribute hive_path.



211
212
213
# File 'lib/commands.rb', line 211

def hive_path
  @hive_path
end

#pig_cmdObject

Returns the value of attribute pig_cmd.



211
212
213
# File 'lib/commands.rb', line 211

def pig_cmd
  @pig_cmd
end

#pig_pathObject

Returns the value of attribute pig_path.



211
212
213
# File 'lib/commands.rb', line 211

def pig_path
  @pig_path
end

#script_runner_pathObject

Returns the value of attribute script_runner_path.



211
212
213
# File 'lib/commands.rb', line 211

def script_runner_path
  @script_runner_path
end

#step_actionObject

Returns the value of attribute step_action.



210
211
212
# File 'lib/commands.rb', line 210

def step_action
  @step_action
end

#step_nameObject

Returns the value of attribute step_name.



210
211
212
# File 'lib/commands.rb', line 210

def step_name
  @step_name
end

Instance Method Details

#default_enable_debugging_pathObject



244
245
246
# File 'lib/commands.rb', line 244

def default_enable_debugging_path
  File.join(get_field(:apps_path), "libs/state-pusher/0.1")
end

#default_hive_cmdObject



235
236
237
238
# File 'lib/commands.rb', line 235

def default_hive_cmd
  [ File.join(get_field(:hive_path), "hive-script"), "--base-path", 
    get_field(:hive_path) ]
end

#default_hive_pathObject



231
232
233
# File 'lib/commands.rb', line 231

def default_hive_path
  File.join(get_field(:apps_path), "libs/hive/")
end

#default_pig_cmdObject



226
227
228
229
# File 'lib/commands.rb', line 226

def default_pig_cmd
  [ File.join(get_field(:pig_path), "pig-script"), "--base-path", 
    get_field(:pig_path) ]
end

#default_pig_pathObject



222
223
224
# File 'lib/commands.rb', line 222

def default_pig_path
  File.join(get_field(:apps_path), "libs/pig/")      
end

#default_resize_jobflow_cmdObject



240
241
242
# File 'lib/commands.rb', line 240

def default_resize_jobflow_cmd
  File.join(get_field(:apps_path), "libs/resize-job-flow/0.1/resize-job-flow.jar")
end

#default_script_runner_pathObject



218
219
220
# File 'lib/commands.rb', line 218

def default_script_runner_path
  File.join(get_field(:apps_path), "libs/script-runner/script-runner.jar")      
end

#ensure_install_cmd(jobflow, sc, install_step_class) ⇒ Object



269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
# File 'lib/commands.rb', line 269

def ensure_install_cmd(jobflow, sc, install_step_class)
  has_install = false
  install_step = install_step_class.new_from_commands(commands, self)
  if install_step.jobflow_has_install_step(jobflow) then
    return sc
  else
    new_sc = []
    has_install_pi = false
    for sc_cmd in sc do
      if sc_cmd.is_a?(install_step_class) then
        if has_install_pi then
          next
        else
          has_install_pi = true
        end
      end
      if sc_cmd.is_a?(self.class) then
        if ! has_install_pi then
          has_install_pi = true
          new_sc << install_step
          install_step.validate
        end
      end
      new_sc << sc_cmd
    end
  end
  return new_sc
end

#extra_argsObject



261
262
263
264
265
266
267
# File 'lib/commands.rb', line 261

def extra_args
  if @args != nil && @args.size > 0 then
    return ["--args"] + @args
  else
    return []
  end
end

#reorder_steps(jobflow, sc) ⇒ Object



298
299
300
# File 'lib/commands.rb', line 298

def reorder_steps(jobflow, sc)
  return sc
end

#script_argsObject



253
254
255
256
257
258
259
# File 'lib/commands.rb', line 253

def script_args
  if @arg then
    [ @arg ] + @args
  else
    @args
  end
end

#validateObject



248
249
250
251
# File 'lib/commands.rb', line 248

def validate
  super
  require(:apps_path, "--apps-path path must be defined")
end