You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何在Azure Data Factory中创建仅触发一次的触发器

创建仅运行一次的管道触发器(指定时间启动,无结束时间)

Azure DevOps 操作步骤

可视化界面配置

  • 打开目标管道的「触发器」页面,切换到「计划」标签
  • 点击「添加计划」,选择「单次运行」作为计划类型
  • 设置特定开始时间,确认时区匹配你的需求
  • 无需设置结束时间(单次运行默认仅执行一次)
  • 保存后,触发器会在指定时间触发管道一次

YAML 定义方式

schedules:
- cron: "0 12 15 9 *" # 示例:UTC时间9月15日12点整运行,按需调整时间表达式
  displayName: 单次运行触发器
  branches:
    include:
    - main # 替换为你的目标分支
  always: false
  batch: false
# 无需配置endTime,单次运行默认仅执行一次

GitHub Actions 实现

在工作流YAML中,用cron表达式指定唯一时间点作为触发条件,触发器会仅运行一次:

on:
  schedule:
    - cron: '0 12 15 9 *' # UTC时间9月15日12点运行,按需调整
  workflow_dispatch: # 可选:保留手动触发能力

jobs:
  execute-pipeline:
    runs-on: ubuntu-latest
    steps:
      - name: 拉取代码
        uses: actions/checkout@v4
      # 这里添加你的管道执行步骤

说明:cron表达式指向唯一时间点时,GitHub Actions只会在该时间触发一次工作流,无需设置结束时间。

Airflow 数据管道实现

通过配置DAG的start_date和schedule_interval实现单次运行:

from airflow import DAG
from airflow.operators.python import PythonOperator
from datetime import datetime

def run_pipeline_task():
    # 这里写你的管道逻辑
    print("执行单次管道任务")

with DAG(
    dag_id="one_time_pipeline_trigger",
    start_date=datetime(2024, 9, 15, 12, 0), # 指定具体启动时间
    schedule_interval=None, # 设为None或@once表示仅运行一次
    catchup=False
) as dag:
    pipeline_task = PythonOperator(
        task_id="execute_pipeline",
        python_callable=run_pipeline_task
    )

内容的提问来源于stack exchange,提问作者Vivek

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.03 19:03:18