Andy Dyer
09/29/2020, 9:40 PMparamiko
which I am using for sftp. See below stack trace.
it makes sense and other people are having difficulties pickling the same object in different applications. Is the best bet to use ShellTasks to sftp?
<https://github.com/paramiko/paramiko/issues/753>
<https://stackoverflow.com/questions/39321606/cant-pickle-an-rsa-key-to-send-over-a-socket>
stack trace : https://pastebin.com/8hyAdpx1Jim Crist-Harif
09/29/2020, 9:42 PMJim Crist-Harif
09/29/2020, 9:42 PMAndy Dyer
09/29/2020, 9:44 PMdef open_sftp():
transport = paramiko.Transport((SFTP_CREDENTIALS["server"], 22))
transport.connect(None, SFTP_CREDENTIALS["username"], SFTP_CREDENTIALS["password"])
sftp = paramiko.SFTPClient.from_transport(transport)
return sftp
Andy Dyer
09/29/2020, 9:45 PM@task
def get_zip_from_sftp() -> str:
with (open_sftp()) as sftp_client:
sftp_client.chdir("active")
latest_zip = get_latest_sftp_file(sftp_client)
sftp_client.get(latest_zip, local_path)
return local_path
Jim Crist-Harif
09/29/2020, 9:46 PMJim Crist-Harif
09/29/2020, 9:47 PMAndy Dyer
09/29/2020, 9:48 PMJim Crist-Harif
09/29/2020, 9:50 PMimport paramiko, cloudpickle
cloudpickle.dumps(paramiko)
cloudpickle.dumps(paramiko.Transport)
cloudpickle.dumps(paramiko.SFTPClient.from_transport)
Andy Dyer
09/29/2020, 9:52 PMAndy Dyer
09/29/2020, 9:52 PMJim Crist-Harif
09/29/2020, 9:53 PMFFI
backend from cffi, which normally shouldn't be serialized between things.Jim Crist-Harif
09/29/2020, 9:53 PMAndy Dyer
09/29/2020, 9:56 PMfrom google.oauth2.service_account import Credentials
Jim Crist-Harif
09/29/2020, 9:57 PMCredentials
object outside of a task?Andy Dyer
09/29/2020, 9:57 PMAndy Dyer
09/29/2020, 9:58 PMAndy Dyer
09/29/2020, 9:58 PMJim Crist-Harif
09/29/2020, 9:59 PMAndy Dyer
09/29/2020, 10:37 PM