title: Airflow: pattern to run airflow subdag once
body: <p>From the airflow documentation:</p>
  
  <pre><code>SubDAGs must have a schedule and be enabled. If the SubDAG’s schedule is set to None or @once, the SubDAG will succeed without having done anything
  </code></pre>
  
  <p>I understand the subdagoperator is actually implemented as a BackfillJob and thus we must provide a <code>schedule_interval</code> to the operator. However, is there a way to get the semantic equivalent of <code>schedule_interval="@once"</code> for a subdag? I'm worried that if I use set <code>schedule_interval="@daily"</code> for the subdag that the subdag may run more than once if the subdag takes longer than a day to run. </p>
  
  <pre><code>def subdag_factory(parent_dag_name, child_dag_name, args):
      subdag = DAG(
          dag_id="{parent_dag_name}.{child_dag_name}".format(
              parent_dag_name=parent_dag_name, child_dag_name=child_dag_name
          ),
          schedule_interval="@daily", # &lt;--- this bit here
          default_args=args
      )
  
      ... do more stuff to the subdag here
      return subdag
  </code></pre>
  
  <p>TLDR: how to fake out "only run this subdag once per trigger of the parent dag" </p>