feat(sftp): add deferrable mode to SFTPOperator#68520
Open
venkata-pavani wants to merge 2 commits into
Open
Conversation
Allow SFTPOperator to defer to a trigger for single-file get/put transfers, freeing the worker slot while the transfer is in progress. Directory transfers, delete operations, and concurrency > 1 are not supported and raise a ValueError when deferrable=True. Closes apache#65475 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
Congratulations on your first Pull Request and welcome to the Apache Airflow community! If you have any issues or are unsure about any anything please check our Contributors' Guide
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
deferrableparameter toSFTPOperator, allowinggetandputtransfers of a single file (or list of single-file pairs, whenconcurrency == 1) to be deferred to a trigger instead of blocking a worker slot while the transfer is in progress.SFTPOperatorTrigger(inairflow.providers.sftp.triggers.sftp) which performs the async file transfer viaSFTPHookAsyncand yields aTriggerEventon success or failure.deferrable=TrueraisesValueErrorat execute-time for unsupported configurations:operation == "delete"concurrency > 1ssh_conn_idavailable (neither explicitssh_conn_idnor ansftp_hookwith one set)This re-implements the design from #65480 (closed unmerged due to a rebase issue), scoped down per discussion on #65475.
Closes #65475
Test plan
providers/sftp/tests/unit/sftp/triggers/test_sftp.py(TestSFTPOperatorTrigger) covering serialization, get/put success, intermediate directory creation, and failure events.providers/sftp/tests/unit/sftp/operators/test_sftp.pycovering deferral behavior, theValueErrorguard rails, andexecute_complete.fcntl,os.register_at_fork, and symlinked_sharedpackages).