Class: HybridPlatformsConductor::HpcPlugins::Action::Scp
- Defined in:
- lib/hybrid_platforms_conductor/hpc_plugins/action/scp.rb
Overview
Copy files and directories from the local host to the remote one
Constant Summary
Constants included from LoggerHelpers
LoggerHelpers::LEVELS_MODIFIERS, LoggerHelpers::LEVELS_TO_STDERR
Instance Method Summary collapse
-
#execute ⇒ Object
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.
-
#need_connector? ⇒ Boolean
Do we need a connector to execute this action on a node?.
-
#setup(mappings) ⇒ Object
Setup the action.
Methods inherited from Action
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
#execute ⇒ Object
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.
-
48 49 50 51 52 53 |
# File 'lib/hybrid_platforms_conductor/hpc_plugins/action/scp.rb', line 48 def execute @mappings.each do |from, to| log_debug "[#{@node}] - Copy to remote \"#{from}\" => \"#{to}\"" @connector.remote_copy from, to, sudo: @sudo, owner: @owner, group: @group end end |
#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?
33 34 35 |
# File 'lib/hybrid_platforms_conductor/hpc_plugins/action/scp.rb', line 33 def need_connector? true end |
#setup(mappings) ⇒ 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
-
mappings (Hash<String or Symbol, Object>): Set of couples source => destination_dir to copy files or directories from the local file system to the remote file system. The following properties can also be used:
-
sudo (Boolean): Do we use sudo on the remote to make the copy? [default: false]
-
owner (String or nil): Owner to use for files, or nil to use current one [default: nil]
-
group (String or nil): Group to use for files, or nil to use current one [default: nil]
-
22 23 24 25 26 27 |
# File 'lib/hybrid_platforms_conductor/hpc_plugins/action/scp.rb', line 22 def setup(mappings) @mappings = mappings @sudo = @mappings.delete(:sudo) || false @owner = @mappings.delete(:owner) @group = @mappings.delete(:group) end |