Forked from nehiljain/jinja-example-airflow-part-2.py
Created
February 12, 2021 20:03
-
-
Save samklr/95dce650e44af33ea9be96522ce1a1d5 to your computer and use it in GitHub Desktop.
Code Sample for Blog
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# suppose my data file name has the following format "datatfile_YYYY_MM_DD.csv"; this file arrives in S3 every day. | |
file_suffix = "{{ execution_date.strftime('%Y-%m-%d') }}" | |
bucket_key_template = 's3://[bucket_name]/datatfile_{}.csv'.format(file_suffix) | |
file_sensor = S3KeySensor( | |
task_id='s3_key_sensor_task', | |
poke_interval=60 * 30, # (seconds); checking file every half an hour | |
timeout=60 * 60 * 12, # timeout in 12 hours | |
bucket_key=bucket_key_template, | |
bucket_name=None, | |
wildcard_match=False, | |
dag=dag | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment