alexkruc commented on code in PR #24451:
URL: https://github.com/apache/airflow/pull/24451#discussion_r897624908
##########
airflow/providers/sftp/sensors/sftp.py:
##########
@@ -71,6 +71,8 @@ def poke(self, context: 'Context') -> bool:
self.actual_file_to_check = file_from_pattern
else:
return False
+ else:
+ self.actual_file_to_check = self.path
Review Comment:
Indeed a good catch! :)
I agree that `actual_file_to_check` can be deleted from the `__init__()`
method, it's not really needed there, and it was my mistake to leave it there 😅
Perhaps the best approach is to initiate the variable inside the `poke()`
method itself.
Or, because it is a user-facing attribute, maybe it's ok to add this to the
`template_fields`? WDYT?
About the API itself, when I've added this feature, I saw `self.path`
variable to be a strict and complete file location, but when you ask for a
pattern, it's "easier" to understand that you look for a pattern, in a specific
path.
So for example, if you want to check if csv reports are done and placed in
the correct folder, you will give the folder with the `*.csv` pattern for
poking.
But if you think that this API is not good, I guess it's ok also to change
it :)
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]