从气流文档:
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
Run Code Online (Sandbox Code Playgroud)
我知道subagoperator实际上是作为BackfillJob实现的,因此我们必须向schedule_interval
运营商提供.但是,有没有办法获得子schedule_interval="@once"
标记的语义等价物?我担心如果我使用set schedule_interval="@daily"
为子标记,如果子标记运行时间超过一天,则子标记可能会运行多次.
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", # <--- this bit here
default_args=args
)
... do more stuff to the subdag here
return subdag
Run Code Online (Sandbox Code Playgroud)
TLDR:如何伪造"每次触发父dag只运行一次这个子标记"
我可以为具有一定数量参数的函数创建一个通用的currying函数.IE)
function curry2<T1,T2,R>(func:(arg1:T1, arg2:T2) => R, param2: T2):(arg:T1) => R{
return (param1:T1) => func(param1, param2);
};
Run Code Online (Sandbox Code Playgroud)
但是,我找不到(类型安全)方法来为具有任意数量参数的函数实现通用curry函数.在另一种语言中,我将所有我的currying函数(即:curry1,curry2,curry3等)命名为相同的东西(curry),然后让函数重载执行正确执行curry的工作.但是,typescript不允许像这样的函数重载.
在每个地方写curry2/curry1/curry3而不是咖喱的单一统一界面并不是太麻烦,但如果有办法做到这一点我会很高兴知道如何!