@@ -56,6 +56,7 @@ class AscpFileSystem(AbstractFileSystem):
5656 Args:
5757 ascp_path: Path to the ascp binary (default: "ascp")
5858 ssh_key: SSH private key content as a string (required)
59+ ssh_key_passphrase: SSH private key passphrase as a string
5960 user: Username for ascp connection (e.g., "era-fasp")
6061 host: Hostname (e.g., "fasp.sra.ebi.ac.uk")
6162 rate_limit: Transfer rate limit (default: "300m")
@@ -72,8 +73,9 @@ class AscpFileSystem(AbstractFileSystem):
7273
7374 def __init__ (
7475 self ,
76+ ssh_key : str ,
77+ ssh_key_passphrase : Optional [str ] = None ,
7578 ascp_path : str = "ascp" ,
76- ssh_key : Optional [str ] = None ,
7779 user : Optional [str ] = None ,
7880 host : Optional [str ] = None ,
7981 rate_limit : str = "300m" ,
@@ -99,6 +101,7 @@ def __init__(
99101 super ().__init__ (** kwargs )
100102 self .ascp_path = ascp_path
101103 self .ssh_key = ssh_key
104+ self .ssh_key_passphrase = ssh_key_passphrase
102105 self .user = user
103106 self .host = host
104107 self .rate_limit = rate_limit
@@ -118,7 +121,15 @@ def __init__(
118121 "Please ensure ascp is installed and accessible in your PATH."
119122 )
120123
121- def _get_file (self , rpath : str , lpath : str , ** kwargs : Any ) -> None :
124+ def isdir (self , path ):
125+ """Is this entry directory-like?"""
126+ return False
127+
128+ def isfile (self , path ):
129+ """Is this entry file-like?"""
130+ return True
131+
132+ def get_file (self , rpath : str , lpath : str , ** kwargs : Any ) -> None :
122133 """Download a file from remote path to local path using ascp with retry logic.
123134
124135 This method handles:
@@ -237,12 +248,18 @@ def _execute_ascp_transfer(self, rpath: str, lpath: str, attempt: int) -> None:
237248
238249 log .debug (f"Executing ascp command (key path hidden): { self ._sanitize_cmd_for_log (cmd )} " )
239250
251+ if self .ssh_key_passphrase :
252+ env = os .environ .copy ()
253+ env ["ASPERA_SCP_PASS" ] = self .ssh_key_passphrase
254+ else :
255+ env = None
240256 # Execute ascp
241257 result = subprocess .run (
242258 cmd ,
243259 capture_output = True ,
244260 text = True ,
245261 check = False , # We'll handle errors manually
262+ env = env ,
246263 )
247264
248265 if result .returncode != 0 :
0 commit comments