airflow-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Victor Noagbodji <>
Subject Re: How to know the DAG is starting to run
Date Fri, 11 May 2018 12:50:10 GMT

I don't know if airflow has a concept of DAG-level events or callbacks. (Operators do have
callbacks though.). You might get away with subclassing the DAG class or having a class decorator.

The source suggests that ".run()" is the method you want to override. You may want to call
the original "super().run()" then do what you need to do afterwards.

Let's see if that works for you.

> On May 11, 2018, at 8:26 AM, Song Liu <> wrote:
> Yes, I have though this approach, but more elegant way is doing in the DAG since we don't
want to add this "pipeline environment setup" as a single operator, which should be done in
the DAG more gracefully.
> ________________________________
> 发件人: James Meickle <>
> 发送时间: 2018年5月11日 12:09
> 收件人:
> 主题: Re: How to know the DAG is starting to run
> Song:
> You can put an operator as the very first node in the DAG, and have
> everything else in the DAG depend on it. For example, this is the approach
> we use to only execute DAG tasks on stock market trading days.
> -James M.
> On Fri, May 11, 2018 at 3:57 AM, Song Liu <> wrote:
>> Hi,
>> I have something just want to be done only once when DAG is constructed,
>> but it seems that DAG will be instanced every time when run each of
>> operator.
>> So is that there function in DAG that tell us it is starting to run now ?
>> Thanks,
>> Song

View raw message