Skip to content

Conversation

@kandharvishnu
Copy link
Contributor

Adds a fail_on_sftp_file_not_exist parameter to the SFTPToGCSOperator, allowing users to configure whether the task should fail or continue when the specified file is not found on the SFTP server.


Description

This PR introduces a new parameter, fail_on_sftp_file_not_exist, to the SFTPToGCSOperator. This parameter allows users to specify whether the operator should fail the task if the specified file is not found on the SFTP server.

Previously, the operator would raise an exception and fail the task if the file was not found on the SFTP server. With the introduction of the fail_on_sftp_file_not_exist parameter, users now have the flexibility to configure the operator's behavior in such scenarios. By setting this parameter to False, the operator will log a warning message instead of failing the task, allowing the DAG to continue running.

This enhancement aligns with similar improvements requested for other operators, such as the SFTPToS3Operator.

Changes

  • Added the fail_on_sftp_file_not_exist parameter to the SFTPToGCSOperator.
  • Updated the _copy_single_object method to conditionally handle missing files based on the value of fail_on_sftp_file_not_exist.
  • Provided relevant test cases to ensure the new parameter functions as expected.

@boring-cyborg boring-cyborg bot added area:providers provider:google Google (including GCP) related issues labels Aug 14, 2024
@github-actions
Copy link

github-actions bot commented Oct 4, 2024

This pull request has been automatically marked as stale because it has not had recent activity. It will be closed in 5 days if no further activity occurs. Thank you for your contributions.

@github-actions github-actions bot added the stale Stale PRs per the .github/workflows/stale.yml policy file label Oct 4, 2024
@eladkal eladkal requested a review from shahar1 October 4, 2024 02:00
Copy link
Contributor

@shahar1 shahar1 left a comment

Choose a reason for hiding this comment

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

Overall LGTM, minor comment

move_object: bool = False,
impersonation_chain: str | Sequence[str] | None = None,
sftp_prefetch: bool = True,
fail_on_sftp_file_not_exist: bool = True,
Copy link
Contributor

Choose a reason for hiding this comment

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

Could you please shorten the parameter name?
Maybe something like fail_if_not_exists?

@github-actions github-actions bot removed the stale Stale PRs per the .github/workflows/stale.yml policy file label Oct 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:providers provider:google Google (including GCP) related issues

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants