parsl.channels.SSHChannel
- class parsl.channels.SSHChannel(hostname, username=None, password=None, script_dir=None, envs=None, gssapi_auth=False, skip_auth=False, port=22, key_filename=None, host_keys_filename=None)[source]
SSH persistent channel. This enables remote execution on sites accessible via ssh. It is assumed that the user has setup host keys so as to ssh to the remote host. Which goes to say that the following test on the commandline should work:
>>> ssh <username>@<hostname>
- __init__(hostname, username=None, password=None, script_dir=None, envs=None, gssapi_auth=False, skip_auth=False, port=22, key_filename=None, host_keys_filename=None)[source]
Initialize a persistent connection to the remote system. We should know at this point whether ssh connectivity is possible
- Parameters:
hostname (-) – Hostname
- KWargs:
username (string) : Username on remote system
password (string) : Password for remote system
port : The port designated for the ssh connection. Default is 22.
script_dir (string) : Full path to a script dir where generated scripts could be sent to.
envs (dict) : A dictionary of environment variables to be set when executing commands
key_filename (string or list): the filename, or list of filenames, of optional private key(s)
Raises:
Methods
__init__
(hostname[, username, password, ...])Initialize a persistent connection to the remote system.
abspath
(path)Return the absolute path on the remote side.
close
()Closes the channel.
execute_wait
(cmd[, walltime, envs])Synchronously execute a commandline string on the shell.
isdir
(path)Return true if the path refers to an existing directory.
makedirs
(path[, mode, exist_ok])Create a directory on the remote side.
prepend_envs
(cmd[, env])pull_file
(remote_source, local_dir)Transport file on the remote side to a local directory
push_file
(local_source, remote_dir)Transport a local file to a directory on a remote machine
Attributes
This is a property.
- abspath(path)[source]
Return the absolute path on the remote side.
- Parameters:
path (str) – Path for which the absolute path will be returned.
- close()[source]
Closes the channel. Clean out any auth credentials.
- Parameters:
None –
- Returns:
Bool
- execute_wait(cmd, walltime=2, envs={})[source]
Synchronously execute a commandline string on the shell.
- Parameters:
cmd (-) – Commandline string to execute
walltime (-) – walltime in seconds
- Kwargs:
envs (dict) : Dictionary of env variables
- Returns:
Return code from the execution, -1 on fail - stdout : stdout string - stderr : stderr string
- Return type:
retcode
Raises: None.
- isdir(path)[source]
Return true if the path refers to an existing directory.
- Parameters:
path (str) – Path of directory on the remote side to check.
- makedirs(path, mode=448, exist_ok=False)[source]
Create a directory on the remote side.
If intermediate directories do not exist, they will be created.
- pull_file(remote_source, local_dir)[source]
Transport file on the remote side to a local directory
- Parameters:
remote_source (-) – remote_source
local_dir (-) – Local directory to copy to
- Returns:
Local path to file
- Return type:
str
- Raises:
- FileExists – Name collision at local directory.
- FileCopyException – FileCopy failed.
- push_file(local_source, remote_dir)[source]
Transport a local file to a directory on a remote machine
- Parameters:
local_source (-) – Path
remote_dir (-) – Remote path
- Returns:
Path to copied file on remote machine
- Return type:
str
- Raises:
- BadScriptPath – if script path on the remote side is bad
- BadPermsScriptPath – You do not have perms to make the channel script dir
- FileCopyException – FileCopy failed.