Re: [PR] Add fail_on_file_not_exist option to SFTPToS3Operator [airflow]

2024-11-27 Thread via GitHub


boring-cyborg[bot] commented on PR #44320:
URL: https://github.com/apache/airflow/pull/44320#issuecomment-2504893503

   Awesome work, congrats on your first merged pull request! You are invited to 
check our [Issue Tracker](https://github.com/apache/airflow/issues) for 
additional contributions.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@airflow.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



Re: [PR] Add fail_on_file_not_exist option to SFTPToS3Operator [airflow]

2024-11-27 Thread via GitHub


potiuk merged PR #44320:
URL: https://github.com/apache/airflow/pull/44320


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@airflow.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



Re: [PR] Add fail_on_file_not_exist option to SFTPToS3Operator [airflow]

2024-11-27 Thread via GitHub


Guaqamole commented on code in PR #44320:
URL: https://github.com/apache/airflow/pull/44320#discussion_r1860936101


##
providers/src/airflow/providers/amazon/aws/transfers/sftp_to_s3.py:
##
@@ -85,6 +89,14 @@ def execute(self, context: Context) -> None:
 
 sftp_client = ssh_hook.get_conn().open_sftp()
 
+try:
+sftp_client.stat(self.sftp_path)
+except FileNotFoundError:
+if self.fail_on_file_not_exist:
+raise
+self.log.info("File %s not found on SFTP server. Skipping 
transfer.", self.sftp_path)
+return

Review Comment:
   I also agree with your point. It would be better if paramiko had 
functionality to check file existence without raising errors, but using 
sftp_client.stat() was my best.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@airflow.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



Re: [PR] Add fail_on_file_not_exist option to SFTPToS3Operator [airflow]

2024-11-27 Thread via GitHub


Guaqamole commented on code in PR #44320:
URL: https://github.com/apache/airflow/pull/44320#discussion_r1860936101


##
providers/src/airflow/providers/amazon/aws/transfers/sftp_to_s3.py:
##
@@ -85,6 +89,14 @@ def execute(self, context: Context) -> None:
 
 sftp_client = ssh_hook.get_conn().open_sftp()
 
+try:
+sftp_client.stat(self.sftp_path)
+except FileNotFoundError:
+if self.fail_on_file_not_exist:
+raise
+self.log.info("File %s not found on SFTP server. Skipping 
transfer.", self.sftp_path)
+return

Review Comment:
   I also agree with your point. It would be better if paramiko had 
functionality to check file existence without raising errors, but using 
sftp_client.stat() was my best.
   
   So am I eligible to resolve this? Or someone else is approving? (I'm not 
familiar with this processπŸ˜… its my first PR)



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@airflow.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



Re: [PR] Add fail_on_file_not_exist option to SFTPToS3Operator [airflow]

2024-11-27 Thread via GitHub


Guaqamole commented on code in PR #44320:
URL: https://github.com/apache/airflow/pull/44320#discussion_r1860936101


##
providers/src/airflow/providers/amazon/aws/transfers/sftp_to_s3.py:
##
@@ -85,6 +89,14 @@ def execute(self, context: Context) -> None:
 
 sftp_client = ssh_hook.get_conn().open_sftp()
 
+try:
+sftp_client.stat(self.sftp_path)
+except FileNotFoundError:
+if self.fail_on_file_not_exist:
+raise
+self.log.info("File %s not found on SFTP server. Skipping 
transfer.", self.sftp_path)
+return

Review Comment:
   I also agree with your point. It would be better if paramiko had 
functionality to check file existence without raising errors, but using 
sftp_client. stat() was my best.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@airflow.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



Re: [PR] Add fail_on_file_not_exist option to SFTPToS3Operator [airflow]

2024-11-27 Thread via GitHub


vincbeck commented on code in PR #44320:
URL: https://github.com/apache/airflow/pull/44320#discussion_r1860893355


##
providers/src/airflow/providers/amazon/aws/transfers/sftp_to_s3.py:
##
@@ -85,6 +89,14 @@ def execute(self, context: Context) -> None:
 
 sftp_client = ssh_hook.get_conn().open_sftp()
 
+try:
+sftp_client.stat(self.sftp_path)
+except FileNotFoundError:
+if self.fail_on_file_not_exist:
+raise
+self.log.info("File %s not found on SFTP server. Skipping 
transfer.", self.sftp_path)
+return

Review Comment:
   I personally find it costly to call `sftp_client.stat` just for logging 
purposes (in case `fail_on_file_not_exist` is `False`). But if you think this 
is worth it, I am not blocking you :)



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@airflow.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



Re: [PR] Add fail_on_file_not_exist option to SFTPToS3Operator [airflow]

2024-11-27 Thread via GitHub


Guaqamole commented on code in PR #44320:
URL: https://github.com/apache/airflow/pull/44320#discussion_r1860403615


##
providers/src/airflow/providers/amazon/aws/transfers/sftp_to_s3.py:
##
@@ -85,6 +89,14 @@ def execute(self, context: Context) -> None:
 
 sftp_client = ssh_hook.get_conn().open_sftp()
 
+try:
+sftp_client.stat(self.sftp_path)
+except FileNotFoundError:
+if self.fail_on_file_not_exist:
+raise
+self.log.info("File %s not found on SFTP server. Skipping 
transfer.", self.sftp_path)
+return

Review Comment:
   @vincbeck 
   the purpose of this implementation is to give users an option _not failing_ 
the dag.
   
   setting `fail_on_file_not_exist` to `False` means the user is trying to skip 
the task and get informed about FileNotFound case, while _not failing_ the dag.
   
   just like @ferruzzi said, the code does look much cleaner but users won't be 
able to know if the task succeeded because the file existed or just skipped 
task even if the file did not exist.
   
   in my opinion **its better to have logging** so that users can be informed 
about the file existence.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@airflow.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



Re: [PR] Add fail_on_file_not_exist option to SFTPToS3Operator [airflow]

2024-11-27 Thread via GitHub


Guaqamole commented on code in PR #44320:
URL: https://github.com/apache/airflow/pull/44320#discussion_r1860403615


##
providers/src/airflow/providers/amazon/aws/transfers/sftp_to_s3.py:
##
@@ -85,6 +89,14 @@ def execute(self, context: Context) -> None:
 
 sftp_client = ssh_hook.get_conn().open_sftp()
 
+try:
+sftp_client.stat(self.sftp_path)
+except FileNotFoundError:
+if self.fail_on_file_not_exist:
+raise
+self.log.info("File %s not found on SFTP server. Skipping 
transfer.", self.sftp_path)
+return

Review Comment:
   @vincbeck 
   the purpose of this implementation is to give users an option _not failing_ 
the dag.
   
   setting `fail_on_file_not_exist` to `False` means the user is trying to skip 
the task and get informed about FileNotFound case, while _not failing_ the dag.
   
   just like @ferruzzi said, the code does look much cleaner but users won't be 
able to know if the task succeeded because file existed or just skipped task 
even if file did not exist.
   
   in my opinion **its better to have logging** so that users can be informed 
about the file existence.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@airflow.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



Re: [PR] Add fail_on_file_not_exist option to SFTPToS3Operator [airflow]

2024-11-27 Thread via GitHub


Guaqamole commented on code in PR #44320:
URL: https://github.com/apache/airflow/pull/44320#discussion_r1860403615


##
providers/src/airflow/providers/amazon/aws/transfers/sftp_to_s3.py:
##
@@ -85,6 +89,14 @@ def execute(self, context: Context) -> None:
 
 sftp_client = ssh_hook.get_conn().open_sftp()
 
+try:
+sftp_client.stat(self.sftp_path)
+except FileNotFoundError:
+if self.fail_on_file_not_exist:
+raise
+self.log.info("File %s not found on SFTP server. Skipping 
transfer.", self.sftp_path)
+return

Review Comment:
   @vincbeck 
   the purpose of this implementation is to give users an option _not failing_ 
the dag.
   
   setting `fail_on_file_not_exist` to `False` means the user is trying to skip 
the task and get informed about FileNotFound case, while _not failing_ the dag.
   
   just like @ferruzzi said, the code does look much cleaner but users won't be 
able to know if the task succeeded because the file existed or just skipped the 
task even if the file did not exist.
   
   in my opinion **its better to have logging** so that users can be informed 
about the file existence.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@airflow.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



Re: [PR] Add fail_on_file_not_exist option to SFTPToS3Operator [airflow]

2024-11-27 Thread via GitHub


Guaqamole commented on code in PR #44320:
URL: https://github.com/apache/airflow/pull/44320#discussion_r1860403615


##
providers/src/airflow/providers/amazon/aws/transfers/sftp_to_s3.py:
##
@@ -85,6 +89,14 @@ def execute(self, context: Context) -> None:
 
 sftp_client = ssh_hook.get_conn().open_sftp()
 
+try:
+sftp_client.stat(self.sftp_path)
+except FileNotFoundError:
+if self.fail_on_file_not_exist:
+raise
+self.log.info("File %s not found on SFTP server. Skipping 
transfer.", self.sftp_path)
+return

Review Comment:
   @vincbeck 
   the purpose of this implementation is to give users an option _not failing_ 
the dag.
   
   setting `fail_on_file_not_exist` to `False` means the user is trying to skip 
the task and get informed about FileNotFound case, while _not failing_ the dag.
   
   just like @ferruzzi said, the code does look much cleaner but users won't be 
able to know if the task succeeded because the file existed or just skipped the 
task because file does not exist.
   
   in my opinion **its better to have logging** so that users can be informed 
about the file existence.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@airflow.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



Re: [PR] Add fail_on_file_not_exist option to SFTPToS3Operator [airflow]

2024-11-27 Thread via GitHub


Guaqamole commented on code in PR #44320:
URL: https://github.com/apache/airflow/pull/44320#discussion_r1860403615


##
providers/src/airflow/providers/amazon/aws/transfers/sftp_to_s3.py:
##
@@ -85,6 +89,14 @@ def execute(self, context: Context) -> None:
 
 sftp_client = ssh_hook.get_conn().open_sftp()
 
+try:
+sftp_client.stat(self.sftp_path)
+except FileNotFoundError:
+if self.fail_on_file_not_exist:
+raise
+self.log.info("File %s not found on SFTP server. Skipping 
transfer.", self.sftp_path)
+return

Review Comment:
   @vincbeck 
   the purpose of this implementation is to give users an option '_not 
failing_' the dag.
   
   setting `fail_on_file_not_exist` to `False` means the user is trying to skip 
the task and get informed about FileNotFound case, while '_not failing_' the 
dag.
   
   just like @ferruzzi said, the code does look much cleaner but users won't be 
able to know if the task succeeded because the file existed or just skipped the 
task because file does not exist.
   
   in my opinion **its better to have logging** so that users can be informed 
about the file existence.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@airflow.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



Re: [PR] Add fail_on_file_not_exist option to SFTPToS3Operator [airflow]

2024-11-27 Thread via GitHub


Guaqamole commented on code in PR #44320:
URL: https://github.com/apache/airflow/pull/44320#discussion_r1860403615


##
providers/src/airflow/providers/amazon/aws/transfers/sftp_to_s3.py:
##
@@ -85,6 +89,14 @@ def execute(self, context: Context) -> None:
 
 sftp_client = ssh_hook.get_conn().open_sftp()
 
+try:
+sftp_client.stat(self.sftp_path)
+except FileNotFoundError:
+if self.fail_on_file_not_exist:
+raise
+self.log.info("File %s not found on SFTP server. Skipping 
transfer.", self.sftp_path)
+return

Review Comment:
   @vincbeck 
   the purpose of this implementation is to give users an option 'not failing' 
the dag.
   
   setting 'fail_on_file_not_exist' to 'False' means the user is trying to skip 
the task and get informed about FileNotFound case, while 'not failing' the dag.
   
   just like @ferruzzi said, the code does look much cleaner but users won't be 
able to know if the task succeeded because the file existed or just skipped the 
task because file does not exist.
   
   in my opinion its better to have logging so that users can be informed about 
the file existence.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@airflow.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



Re: [PR] Add fail_on_file_not_exist option to SFTPToS3Operator [airflow]

2024-11-26 Thread via GitHub


ferruzzi commented on code in PR #44320:
URL: https://github.com/apache/airflow/pull/44320#discussion_r1858992968


##
providers/src/airflow/providers/amazon/aws/transfers/sftp_to_s3.py:
##
@@ -85,6 +89,14 @@ def execute(self, context: Context) -> None:
 
 sftp_client = ssh_hook.get_conn().open_sftp()
 
+try:
+sftp_client.stat(self.sftp_path)
+except FileNotFoundError:
+if self.fail_on_file_not_exist:
+raise
+self.log.info("File %s not found on SFTP server. Skipping 
transfer.", self.sftp_path)
+return

Review Comment:
   Your way loses the logging if the file is missing, but it does look much 
cleaner.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@airflow.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



Re: [PR] Add fail_on_file_not_exist option to SFTPToS3Operator [airflow]

2024-11-26 Thread via GitHub


vincbeck commented on code in PR #44320:
URL: https://github.com/apache/airflow/pull/44320#discussion_r1858721098


##
providers/src/airflow/providers/amazon/aws/transfers/sftp_to_s3.py:
##
@@ -85,6 +89,14 @@ def execute(self, context: Context) -> None:
 
 sftp_client = ssh_hook.get_conn().open_sftp()
 
+try:
+sftp_client.stat(self.sftp_path)
+except FileNotFoundError:
+if self.fail_on_file_not_exist:
+raise
+self.log.info("File %s not found on SFTP server. Skipping 
transfer.", self.sftp_path)
+return

Review Comment:
   If `self. fail_on_file_not_exist` is `False` then you call 
`sftp_client.stat(` for nothing. I think the implementation could be simplified 
and optimized to:
   
   
   
   ```suggestion
if self.fail_on_file_not_exist:
sftp_client.stat(self.sftp_path)
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@airflow.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



Re: [PR] Add fail_on_file_not_exist option to SFTPToS3Operator [airflow]

2024-11-25 Thread via GitHub


ephraimbuddy commented on code in PR #44320:
URL: https://github.com/apache/airflow/pull/44320#discussion_r1856825984


##
providers/src/airflow/providers/amazon/aws/transfers/sftp_to_s3.py:
##
@@ -85,6 +89,15 @@ def execute(self, context: Context) -> None:
 
 sftp_client = ssh_hook.get_conn().open_sftp()
 
+try:
+sftp_client.stat(self.sftp_path)
+except FileNotFoundError:
+if self.fail_on_file_not_exist:
+raise
+else:
+self.log.info("File %s not found on SFTP server. Skipping 
transfer.", self.sftp_path)
+return

Review Comment:
   ```suggestion
   try:
   sftp_client.stat(self.sftp_path)
   except FileNotFoundError:
   if self.fail_on_file_not_exist:
   raise
   self.log.info("File %s not found on SFTP server. Skipping 
transfer.", self.sftp_path)
   return
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@airflow.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



Re: [PR] Add fail_on_file_not_exist option to SFTPToS3Operator [airflow]

2024-11-25 Thread via GitHub


injae-kim commented on code in PR #44320:
URL: https://github.com/apache/airflow/pull/44320#discussion_r1856703581


##
providers/src/airflow/providers/amazon/aws/transfers/sftp_to_s3.py:
##
@@ -85,6 +89,15 @@ def execute(self, context: Context) -> None:
 
 sftp_client = ssh_hook.get_conn().open_sftp()
 
+try:
+sftp_client.stat(self.sftp_path)
+except FileNotFoundError:
+if self.fail_on_file_not_exist:
+raise
+else:
+self.log.info("File %s not found on SFTP server. Skipping 
transfer.", self.sftp_path)
+return

Review Comment:
   we have some long-time dag and need this `fail_on_file_not_exist` option to 
skip on file not found failure.
   without this option we need to re-run long-time dag on file not found and 
it's really annoying cause it takes 2~3 hours πŸ˜…



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@airflow.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



Re: [PR] Add fail_on_file_not_exist option to SFTPToS3Operator [airflow]

2024-11-25 Thread via GitHub


injae-kim commented on code in PR #44320:
URL: https://github.com/apache/airflow/pull/44320#discussion_r1856703581


##
providers/src/airflow/providers/amazon/aws/transfers/sftp_to_s3.py:
##
@@ -85,6 +89,15 @@ def execute(self, context: Context) -> None:
 
 sftp_client = ssh_hook.get_conn().open_sftp()
 
+try:
+sftp_client.stat(self.sftp_path)
+except FileNotFoundError:
+if self.fail_on_file_not_exist:
+raise
+else:
+self.log.info("File %s not found on SFTP server. Skipping 
transfer.", self.sftp_path)
+return

Review Comment:
   we have some long-time dag and need this `fail_on_file_not_exist` option to 
skip on file not found failure.
   without this option we need to re-run long-time dag and it's really annoying 
πŸ˜…



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@airflow.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



Re: [PR] Add fail_on_file_not_exist option to SFTPToS3Operator [airflow]

2024-11-25 Thread via GitHub


Guaqamole commented on code in PR #44320:
URL: https://github.com/apache/airflow/pull/44320#discussion_r1856698284


##
providers/src/airflow/providers/amazon/aws/transfers/sftp_to_s3.py:
##
@@ -85,6 +89,15 @@ def execute(self, context: Context) -> None:
 
 sftp_client = ssh_hook.get_conn().open_sftp()
 
+try:
+sftp_client.stat(self.sftp_path)
+except FileNotFoundError:
+if self.fail_on_file_not_exist:
+raise
+else:
+self.log.info("File %s not found on SFTP server. Skipping 
transfer.", self.sftp_path)
+return

Review Comment:
   As mentioned in https://github.com/apache/airflow/issues/40576, the 
fail_on_file_not_exist option is intended to provide users greater control over 
the operator's behavior, particularly in environments where continued 
processing is preferred.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@airflow.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



Re: [PR] Add fail_on_file_not_exist option to SFTPToS3Operator [airflow]

2024-11-25 Thread via GitHub


Guaqamole commented on code in PR #44320:
URL: https://github.com/apache/airflow/pull/44320#discussion_r1856698284


##
providers/src/airflow/providers/amazon/aws/transfers/sftp_to_s3.py:
##
@@ -85,6 +89,15 @@ def execute(self, context: Context) -> None:
 
 sftp_client = ssh_hook.get_conn().open_sftp()
 
+try:
+sftp_client.stat(self.sftp_path)
+except FileNotFoundError:
+if self.fail_on_file_not_exist:
+raise
+else:
+self.log.info("File %s not found on SFTP server. Skipping 
transfer.", self.sftp_path)
+return

Review Comment:
   As mentioned in https://github.com/apache/airflow/issues/41472, the 
fail_on_file_not_exist option is intended to provide users greater control over 
the operator's behaviour, particularly in environments where continued 
processing is preferred.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@airflow.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



Re: [PR] Add fail_on_file_not_exist option to SFTPToS3Operator [airflow]

2024-11-25 Thread via GitHub


Guaqamole commented on code in PR #44320:
URL: https://github.com/apache/airflow/pull/44320#discussion_r1856698284


##
providers/src/airflow/providers/amazon/aws/transfers/sftp_to_s3.py:
##
@@ -85,6 +89,15 @@ def execute(self, context: Context) -> None:
 
 sftp_client = ssh_hook.get_conn().open_sftp()
 
+try:
+sftp_client.stat(self.sftp_path)
+except FileNotFoundError:
+if self.fail_on_file_not_exist:
+raise
+else:
+self.log.info("File %s not found on SFTP server. Skipping 
transfer.", self.sftp_path)
+return

Review Comment:
   As mentioned in https://github.com/apache/airflow/issues/40576, the 
fail_on_file_not_exist option is intended to provide users greater control over 
the operator's behaviour, particularly in environments where continued 
processing is preferred.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@airflow.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



Re: [PR] Add fail_on_file_not_exist option to SFTPToS3Operator [airflow]

2024-11-25 Thread via GitHub


ephraimbuddy commented on code in PR #44320:
URL: https://github.com/apache/airflow/pull/44320#discussion_r1856183672


##
providers/src/airflow/providers/amazon/aws/transfers/sftp_to_s3.py:
##
@@ -85,6 +89,15 @@ def execute(self, context: Context) -> None:
 
 sftp_client = ssh_hook.get_conn().open_sftp()
 
+try:
+sftp_client.stat(self.sftp_path)
+except FileNotFoundError:
+if self.fail_on_file_not_exist:
+raise
+else:
+self.log.info("File %s not found on SFTP server. Skipping 
transfer.", self.sftp_path)
+return

Review Comment:
   Just wondering about the benefit of not failing if the file does not exist.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@airflow.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



Re: [PR] Add fail_on_file_not_exist option to SFTPToS3Operator [airflow]

2024-11-23 Thread via GitHub


boring-cyborg[bot] commented on PR #44320:
URL: https://github.com/apache/airflow/pull/44320#issuecomment-2495794069

   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 
(https://github.com/apache/airflow/blob/main/contributing-docs/README.rst)
   Here are some useful points:
   - Pay attention to the quality of your code (ruff, mypy and type 
annotations). Our [pre-commits]( 
https://github.com/apache/airflow/blob/main/contributing-docs/08_static_code_checks.rst#prerequisites-for-pre-commit-hooks)
 will help you with that.
   - In case of a new feature add useful documentation (in docstrings or in 
`docs/` directory). Adding a new operator? Check this short 
[guide](https://github.com/apache/airflow/blob/main/docs/apache-airflow/howto/custom-operator.rst)
 Consider adding an example DAG that shows how users should use it.
   - Consider using [Breeze 
environment](https://github.com/apache/airflow/blob/main/dev/breeze/doc/README.rst)
 for testing locally, it's a heavy docker but it ships with a working Airflow 
and a lot of integrations.
   - Be patient and persistent. It might take some time to get a review or get 
the final approval from Committers.
   - Please follow [ASF Code of 
Conduct](https://www.apache.org/foundation/policies/conduct) for all 
communication including (but not limited to) comments on Pull Requests, Mailing 
list and Slack.
   - Be sure to read the [Airflow Coding style]( 
https://github.com/apache/airflow/blob/main/contributing-docs/05_pull_requests.rst#coding-style-and-best-practices).
   - Always keep your Pull Requests rebased, otherwise your build might fail 
due to changes not related to your commits.
   Apache Airflow is a community-driven project and together we are making it 
better πŸš€.
   In case of doubts contact the developers at:
   Mailing List: d...@airflow.apache.org
   Slack: https://s.apache.org/airflow-slack
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@airflow.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org