ashb commented on a change in pull request #2450: [Airflow-1413] Fix FTPSensor
failing on error message with unexpected text.
URL: https://github.com/apache/incubator-airflow/pull/2450#discussion_r240663138
##########
File path: airflow/contrib/sensors/ftp_sensor.py
##########
@@ -26,33 +28,64 @@
class FTPSensor(BaseSensorOperator):
"""
Waits for a file or directory to be present on FTP.
-
- :param path: Remote file or directory path
- :type path: str
- :param ftp_conn_id: The connection to run the sensor against
- :type ftp_conn_id: str
"""
+
template_fields = ('path',)
+ """Errors that are transient in nature, and where action can be retried"""
+ transient_errors = [421, 425, 426, 434, 450, 451, 452]
+
+ error_code_pattern = re.compile("([\d]+)")
+
@apply_defaults
- def __init__(self, path, ftp_conn_id='ftp_default', *args, **kwargs):
+ def __init__(
+ self,
+ path,
+ ftp_conn_id='ftp_default',
+ fail_on_transient_errors=True,
+ *args,
+ **kwargs):
+ """
+ Create a new FTP sensor
Review comment:
```suggestion
Create a new FTP sensor
```
There needs to be a blank line between the description and the params for
this to render correctly
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services