0

Using Apache airflow tool, how can I implement a DAG for the following Python code. The task accomplished in the code is to get a directory from GPU server to local system. Code is working fine in Jupyter notebook. Please help to implement in Airflow...I'm very new to this. Thanks.

import pysftp
import os
myHostname = "hostname"
myUsername = "username"
myPassword = "pwd"

with pysftp.Connection(host=myHostname, username=myUsername, password=myPassword) as sftp:
    print("Connection successfully stablished ... ")
    src = '/path/src/'
    dst = '/home/path/path/destination'
    os.mkdir(dst)
    sftp.get_d(src, dst, preserve_mtime=True)
    print("Fetched source images from GPU server to local directory")
# connection closed automatically at the end of the with-block```
y2k-shubham
  • 10,183
  • 11
  • 55
  • 131

1 Answers1

1

  • I acknowledge there aren't many examples, but this might be helpful
  • For SSH-connection, see this
y2k-shubham
  • 10,183
  • 11
  • 55
  • 131