Uploaded image for project: 'Apache Airflow'
  1. Apache Airflow
  2. AIRFLOW-4384

Support exclude from scheduling time windows

    XMLWordPrintableJSON

Details

    Description

      I think it would be useful to include as DAG attribute a list of calendar events to be excluded from scheduling. I've came across with the need of excluding specific dates from scheduling, for example holidays, and I think it could be useful for maintenance windows too.

      I've been doing some tests with a custom subclass of DAG. It would accept an attribute like

      exclude_calendar = [{ start_date: '2019-04-22T10:00:00.000+00:00 ', end_date: ' 2019-04-22T11:00:00.000+00:00' },

      { start_date: '2019-04-22T17:00:00.000+00:00 ', end_date: ' 2019-04-22T18:00:00.000+00:00' }

      ]

      Then, when scheduler calls following_schedule function from DAG it would check if the following scheduled date belongs to any of the time windows included on exclude_calendar, and if it does, it will jump to the end of the time window, and check again, and so on until it finds a valid date.

      Would be great if it could accept include_calendar too with the inverse behavior, only scheduling if it belongs to one of the time windows, but I think excluding will be enough for most use cases.

       

      Attachments

        Activity

          People

            Unassigned Unassigned
            vxtals Víctor Portals
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated: