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

sftp_sensor: fixing resource management with sensor #40022

Merged

Conversation

pateash
Copy link
Contributor

@pateash pateash commented Jun 3, 2024

closes: #39922

Summary

When a user tries to use the SFTPSensor operator with deferrable=True, using path/newer_than, it will open a connection and remain open, the reason is because of method get_mod_time in opening a sftp connection but not closing it afterward.

As part of this change, we are closing the connection.

@pateash pateash force-pushed the pateash/sftp-sensor-connection-issue branch from f64a94a to fef455a Compare June 3, 2024 09:04
@pateash pateash force-pushed the pateash/sftp-sensor-connection-issue branch from 9dc8708 to d28d5fe Compare June 3, 2024 13:24
@pateash pateash marked this pull request as ready for review June 3, 2024 14:16
@eladkal eladkal requested review from Lee-W and pankajkoti June 6, 2024 18:53
Copy link
Contributor

@eladkal eladkal left a comment

Choose a reason for hiding this comment

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

LGTM

@eladkal eladkal requested a review from shahar1 June 7, 2024 12:36
Copy link
Member

@pankajkoti pankajkoti left a comment

Choose a reason for hiding this comment

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

Thanks for fixing this @pateash . I have a small suggestion inline.

airflow/providers/sftp/hooks/sftp.py Show resolved Hide resolved
@pankajkoti pankajkoti merged commit f5c8059 into apache:main Jun 7, 2024
49 checks passed
@pateash pateash deleted the pateash/sftp-sensor-connection-issue branch June 11, 2024 08:06
romsharon98 pushed a commit to romsharon98/airflow that referenced this pull request Jul 26, 2024
closes: apache#39922

Summary
When a user tries to use the SFTPSensor operator with deferrable=True, using path/newer_than, it will open a connection and remain open, the reason is because of method get_mod_time in opening a sftp connection but not closing it afterward.

As part of this change, we are closing the connection.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Close open connections for deferrable SFTPSensor
3 participants