Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Check the existence of the remote file before transferring the file #248

Merged
merged 3 commits into from
Jan 1, 2024

Conversation

hujay2019
Copy link
Contributor

@hujay2019 hujay2019 commented Dec 24, 2023

If the remote file doesn't exist, the statement sftp_client.get(file_dst, file_src) will raise FileNotFoundError. The expected behavior is to skip. But the paramiko sftp connection will make the local file to empty. Thus, add sftp_client.stat(file_dst) to check remote file existence. If the remote file is not exists, the FileNotFoundError will raise before the the file transfer.

@pmrv
Copy link
Contributor

pmrv commented Dec 24, 2023

Please add a comment as to why this stat call is needed, so that the next person doesn't think it's unnecessary code and removes it again. A short line summarizing the discussion in pyiron/pyiron#1526 will do.

Copy link
Contributor

@pmrv pmrv left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm, thanks for the additional explanation!

@jan-janssen jan-janssen merged commit fbdc565 into pyiron:main Jan 1, 2024
15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants