Class: HybridPlatformsConductor::HpcPlugins::Action::Bash

Inherits:
Action
  • Object
show all
Defined in:
lib/hybrid_platforms_conductor/hpc_plugins/action/bash.rb

Overview

Execute Bash commands locally

Constant Summary

Constants included from LoggerHelpers

LoggerHelpers::LEVELS_MODIFIERS, LoggerHelpers::LEVELS_TO_STDERR

Instance Method Summary collapse

Methods inherited from Action

#initialize, #need_connector?, #prepare_for

Methods inherited from Plugin

extend_config_dsl_with, #initialize, valid?

Methods included from LoggerHelpers

#err, #init_loggers, #log_component=, #log_debug?, #log_level=, #out, #section, #set_loggers_format, #stderr_device, #stderr_device=, #stderr_displayed?, #stdout_device, #stdout_device=, #stdout_displayed?, #stdouts_to_s, #with_progress_bar

Constructor Details

This class inherits a constructor from HybridPlatformsConductor::Action

Instance Method Details

#executeObject

Execute the action

API
  • This method is mandatory

API
  • @cmd_runner is accessible

API
  • @actions_executor is accessible

API
  • @action_info is accessible with the action details

API
  • @node (String) can be used to know on which node the action is to be executed

API
  • @connector (Connector or nil) can be used to access the node’s connector if the action needs remote connection

API
  • @timeout (Integer) should be used to make sure the action execution does not get past this number of seconds

API
  • @stdout_io can be used to log stdout messages

API
  • @stderr_io can be used to log stderr messages

API
  • run_cmd(String) method can be used to execute a command. See CmdRunner#run_cmd to know about the result’s signature.



33
34
35
36
# File 'lib/hybrid_platforms_conductor/hpc_plugins/action/bash.rb', line 33

def execute
  log_debug "[#{@node}] - Execute local Bash commands \"#{@cmd}\"..."
  run_cmd @cmd
end

#setup(cmd) ⇒ Object

Setup the action. This is called by the constructor itself, when an action is instantiated to be executed for a node.

API
  • This method is optional

API
  • @cmd_runner is accessible

API
  • @actions_executor is accessible

Parameters
  • cmd (String): The bash command to execute



18
19
20
# File 'lib/hybrid_platforms_conductor/hpc_plugins/action/bash.rb', line 18

def setup(cmd)
  @cmd = cmd
end