我像这样配置了DAG:
String jsonData = ...;
WebRequest request = WebRequest.Create("http://www.mywebservice.com/");
request.ContentType = "application/json";
request.Method = "POST";
using (Stream postStream = request.GetRequestStream())
{
using (StreamWriter postWriter = new StreamWriter(postStream))
postWriter.Write(jsonData);
}
WebResponse response = request.GetResponse();
String responseContent;
using (Stream stream = response.GetResponseStream())
{
using (StreamReader reader = new StreamReader(stream, Encoding.UTF8))
responseContent = reader.ReadToEnd();
}
由于某种原因,当我取消暂停DAG时,它立即被执行两次。 知道为什么吗?是否有任何规则我可以申请告诉这个DAG在同一时间内不会超过一次?
答案 0 :(得分:2)
您可以像这样指定max_active_runs
:
dag = airflow.DAG(
'customer_staging',
schedule_interval="@daily",
dagrun_timeout=timedelta(minutes=60),
template_searchpath=tmpl_search_path,
default_args=args,
max_active_runs=1)
我从未见过这种情况,你确定这些运行不是回填,请参阅:https://stackoverflow.com/a/47953439/9132848
答案 1 :(得分:0)
我认为是因为你已经错过了预定的时间,并且当你再次打开气流时气流会自动回填。你可以通过禁用它 catchflow_by_default = airflow.cfg中的False。