-1

I can do

sftp server.com <<< """put bar.txt bar.txt"""

using my config in ~/.shh/config, and I try to incorporate the same into my Snakefile. Following the docs, I manage to connect, but not transfer the file:

from snakemake.remote.SFTP import RemoteProvider
SFTP = RemoteProvider(mkdir_remote=True, username='my.email@something.com', private_key='~/.ssh/id_rsa')

rule all:
    input:
        "bar.txt"
    output:
        SFTP.remote('server.com/bar.txt')
    shell:
        "cp {input} {output}"

does not transfer the file. Am I missing something? How is the sftp command from above executed using pysftp?

Thanks in advance!

enryh
  • 83
  • 1
  • 10
  • Your shell command says `cd` instead of `cp`. – Konrad Rudolph Oct 26 '20 at 16:55
  • yes sorry. This mistake must have happend when I replace the example with generic names... I changed it, thanks for spotting. Does this code work for you with a server you have access to?! – enryh Oct 26 '20 at 17:17
  • Do you get any output at all, like an error message? If so, please put it in your question. – CryptoFool Oct 26 '20 at 17:31
  • How does the first two lines of code relate to the rest of the text in your code section? – CryptoFool Oct 26 '20 at 17:32
  • I just noticed "How is the sftp command from above executed using pysftp?" So you aren't having a problem with your code. Rather, you're asking us to code this up for you. That's not how it works here. Code something up that you think should work, and then provide your code and ask questions about why it isn't working. If you don't yet know how to write the code, find tutorials or books to learn what you need to know. We don't teach programming here. – CryptoFool Oct 26 '20 at 17:37
  • It was just a conceptional question. @KonradRudolph : Thanks for the hint. I don't know what went wrong, but after re-checking this morning it works! Maybe I was timed-out on the server side and that's why the command failed yesterday! – enryh Oct 27 '20 at 08:47

1 Answers1

0

so just to confirm: The above should work as written. I ran into a timeout as SFTP uses parallel pysftp/paramiko connections which are limited on my infrastructure.

(A snakemake dry-run also tries to reach the files on the ftp server and then I was blocked for 5 minutes as I had opened too many connections)

enryh
  • 83
  • 1
  • 10