shahar1 commented on code in PR #43045:
URL: https://github.com/apache/airflow/pull/43045#discussion_r1801823395
##########
providers/src/airflow/providers/apache/hdfs/sensors/web_hdfs.py:
##########
@@ -41,3 +43,31 @@ def poke(self, context: Context) -> bool:
hook = WebHDFSHook(self.webhdfs_conn_id)
self.log.info("Poking for file %s", self.filepath)
return hook.check_for_path(hdfs_path=self.filepath)
+
+
+class MultipleFilesWebHdfsSensor(BaseSensorOperator):
+ """Waits for multiple files in a folder to land in HDFS."""
+
+ template_fields: Sequence[str] = ("directory_path", "expected_filenames")
+
+ def __init__(self, *, directory_path: str, expected_filenames:
Sequence[str],
+ webhdfs_conn_id: str = "webhdfs_default", **kwargs: Any) ->
None:
+ super().__init__(**kwargs)
+ self.directory_path = directory_path
+ self.expected_filenames = set(expected_filenames)
Review Comment:
```suggestion
self.expected_filenames = expected_filenames
```
You defined `expected_filenames` as a templated field, which means that [it
must be assigned
directly](https://airflow.apache.org/docs/apache-airflow/stable/howto/custom-operator.html#limitations).
If needed, you could apply it within the `poke()` method.
--
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]