My goal is to concurrently fetch files from multiple servers including multiple files from the same server. I am given a dict of file paths to fetch.
I'm thinking of something like this: paramiko multi ssh but with SFTP.
I have a list of opened pysftp.Connection
objects. I can reuse these connection handles, so at least if I need to interact with the same server, the initialization process is skipped. I've been using this without errors. When I use threading
for invoking the function that fetches the files however, it stops working, because multiple threads are trying to take over the same SFTP connection which is not supported by pysftp
.
Do you know any workaround for this?