ajaykarthick27 opened a new issue, #27890:
URL: https://github.com/apache/airflow/issues/27890

   ### Apache Airflow Provider(s)
   
   sftp
   
   ### Versions of Apache Airflow Providers
   
   apache-airflow-providers-sftp==4.1.0
   
   ### Apache Airflow version
   
   apache-airflow==2.4.3
   
   ### Operating System
   
   NAME="Ubuntu" VERSION="20.04.2 LTS (Focal Fossa)"
   
   ### Deployment
   
   Composer
   
   ### Deployment details
   
   _No response_
   
   ### What happened
   
   SFTPSensor is continuously running even when the files matching file pattern 
passed by the user are available in sftp location. This is happening because 
the variable `actual_file_to_check` holds just file name where as the method 
`get_mod_time` expects file name with path.
   
   
https://github.com/apache/airflow/blob/12c3c39d1a816c99c626fe4c650e88cf7b1cc1bc/airflow/providers/sftp/sensors/sftp.py#L70-L79
   
   
   ### What you think should happen instead
   
   SFTPSensor should stop execution as soon as it finds first file match. 
   
   ### How to reproduce
   
   Trigger SFTPSensor with file pattern as shown in the below code snippet.
   `checkForSFTPFiles = SFTPSensor(
           task_id="checkForSFTPFiles",
           path=f"{SFTP_ROOT_DIR}",
           file_pattern='Migrate*',
           poke_interval=10
       )`
   
   ### Anything else
   
   Every time
   
   ### Are you willing to submit PR?
   
   - [X] Yes I am willing to submit a PR!
   
   ### Code of Conduct
   
   - [X] I agree to follow this project's [Code of 
Conduct](https://github.com/apache/airflow/blob/main/CODE_OF_CONDUCT.md)
   


-- 
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]

Reply via email to