dag11_daily_backups.py 842 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. from datetime import timedelta
  2. from airflow.models import DAG,Variable
  3. from airflow.utils.dates import days_ago
  4. from airflow.operators.bash_operator import BashOperator
  5. ## ARGS
  6. default_args = {
  7. 'owner': 'airflow',
  8. 'depends_on_past': False,
  9. 'start_date': days_ago(2),
  10. 'email_on_failure': False,
  11. 'email_on_retry': False,
  12. 'retries': 1,
  13. 'retry_delay': timedelta(minutes=5)
  14. }
  15. ## DAG
  16. dag = \
  17. DAG(
  18. dag_id='dag11_daily_backups',
  19. catchup=False,
  20. schedule_interval='@daily',
  21. max_active_runs=1,
  22. tags=['hpc'],
  23. default_args=default_args)
  24. with dag:
  25. ## TASK
  26. backup_prod_db = \
  27. BashOperator(
  28. task_id='backup_prod_db',
  29. dag=dag,
  30. xcom_push=False,
  31. queue='hpc_4G',
  32. bash_command='bash /rds/general/user/igf/home/secret_keys/get_dump.sh ')
  33. ## PIPELINE
  34. backup_prod_db