Class: HybridPlatformsConductor::Action
- Defined in:
- lib/hybrid_platforms_conductor/action.rb
Overview
Base class for any action that could be run on a node.
Direct Known Subclasses
HpcPlugins::Action::Bash, HpcPlugins::Action::Interactive, HpcPlugins::Action::RemoteBash, HpcPlugins::Action::Ruby, HpcPlugins::Action::Scp
Constant Summary
Constants included from LoggerHelpers
LoggerHelpers::LEVELS_MODIFIERS, LoggerHelpers::LEVELS_TO_STDERR
Instance Method Summary collapse
-
#initialize(logger: Logger.new(STDOUT), logger_stderr: Logger.new(STDERR), config: Config.new, cmd_runner: CmdRunner.new, actions_executor: ActionsExecutor.new, action_info: nil) ⇒ Action
constructor
Constructor.
-
#need_connector? ⇒ Boolean
Do we need a connector to execute this action on a node?.
-
#prepare_for(node, connector, timeout, stdout_io, stderr_io) ⇒ Object
Prepare an action to be run for a given node in a given context.
Methods inherited from Plugin
extend_config_dsl_with, 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
#initialize(logger: Logger.new(STDOUT), logger_stderr: Logger.new(STDERR), config: Config.new, cmd_runner: CmdRunner.new, actions_executor: ActionsExecutor.new, action_info: nil) ⇒ Action
Constructor
- Parameters
-
logger (Logger): Logger to be used [default: Logger.new(STDOUT)]
-
logger_stderr (Logger): Logger to be used for stderr [default: Logger.new(STDERR)]
-
config (Config): Config to be used. [default: Config.new]
-
cmd_runner (CmdRunner): Command executor to be used. [default: CmdRunner.new]
-
actions_executor (ActionsExecutor): Actions Executor to be used. [default: ActionsExecutor.new]
-
action_info (Object or nil): Action info needed to setup the action, or nil if none [default: nil]
18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/hybrid_platforms_conductor/action.rb', line 18 def initialize( logger: Logger.new(STDOUT), logger_stderr: Logger.new(STDERR), config: Config.new, cmd_runner: CmdRunner.new, actions_executor: ActionsExecutor.new, action_info: nil ) super(logger: logger, logger_stderr: logger_stderr, config: config) @cmd_runner = cmd_runner @actions_executor = actions_executor @action_info = action_info setup(@action_info) if self.respond_to?(:setup) end |
Instance Method Details
#need_connector? ⇒ Boolean
Do we need a connector to execute this action on a node?
- Result
-
Boolean: Do we need a connector to execute this action on a node?
37 38 39 |
# File 'lib/hybrid_platforms_conductor/action.rb', line 37 def need_connector? false end |
#prepare_for(node, connector, timeout, stdout_io, stderr_io) ⇒ Object
Prepare an action to be run for a given node in a given context. It is required to call this method before executing the action.
- Paramaters
-
node (String): The node this actions is targetting
-
connector (Connector or nil): Connector to use to connect to this node, or nil if none
-
timeout (Integer or nil): Timeout this action should have (in seconds), or nil if none
-
stdout_io (IO): IO to log stdout to
-
stderr_io (IO): IO to log stderr to
50 51 52 53 54 55 56 57 |
# File 'lib/hybrid_platforms_conductor/action.rb', line 50 def prepare_for(node, connector, timeout, stdout_io, stderr_io) @node = node @connector = connector @timeout = timeout @stdout_io = stdout_io @stderr_io = stderr_io @connector.prepare_for(@node, @timeout, @stdout_io, @stderr_io) if @connector end |