FileClient#
- class atomate2.utils.file_client.FileClient(key_filename='~/.ssh/id_rsa', config_filename='~/.ssh/config')[source]#
Bases:
object
Tool for performing operations on files.
The client is agnostic of whether file operations are happening locally or via SSH. All operations have a
host
parameter that specifies which remote host the operation should be performed on.Note
To use abbreviated host names without user information, the FileClient requires the appropriate configuration to be defined in the ssh config file.
- Parameters:
- connect(host)[source]#
Connect to a remote host.
- Parameters:
host (str) – A remote host filesystem. Supports using hosts defined in the ssh config file. The host can be specified as either “username@remote_host” or just “remote_host” in which case the username will be inferred from the current user.
- get_ssh(host)[source]#
Get an SSH connection to a host.
- Parameters:
host (str) – A remote host filesystem. Supports using hosts defined in the ssh config file. The host can be specified as either “username@remote_host” or just “remote_host” in which case the username will be inferred from the current user.
- Returns:
An ssh client to the host.
- Return type:
.SSHClient
- get_sftp(host)[source]#
Get an SFTP connection to a host.
- Parameters:
host (str) – A remote host filesystem. Supports using hosts defined in the ssh config file. The host can be specified as either “username@remote_host” or just “remote_host” in which case the username will be inferred from the current user.
- Returns:
An sftp client to the host.
- Return type:
.SFTPClient
- copy(src_filename, dest_filename, src_host=None, dest_host=None)[source]#
Copy a file from source to destination.