Orchestration Pipelines DSL reference

הדף הזה מכיל חומר עזר בנושא Orchestration Pipelines DSL.

מגבלות

אלה המגבלות של Orchestration Pipelines:

  • לפעולות pyspark ו-notebook:

    • אפשר להשתמש רק בקובץ requirements.txt אחד לכל הפעולות של pyspark ו-notebook.
    • פלטפורמת Windows לא נתמכת ליצירת חבילות באמצעות הכלי uv.
    • יש תמיכה רק בחבילות Python עם קובצי בינארי שנבנו מראש.
  • לגבי sql פעולות:

    • ההגדרה של inline במפתח query לא נתמכת.

מידע על הפורמט והערכים

הצינורות מוגדרים בפורמט YAML, וצריך לאחסן אותם בקבצים נפרדים, אחד לכל צינור, במאגר.

יש כמה דרכים להשתמש במשתנים בהגדרות של צינורות עיבוד הנתונים ובהגדרות הפריסה ב-Orchestration Pipelines. לדוגמה, אתם יכולים להגדיר משתנים בהתאמה אישית, להשתמש בסודות של GitHub ולהחליף ערכי משתנים בשורת הפקודה. מידע נוסף זמין במאמר משתנים, סודות והחלפה.

למידע נוסף על הוספת צינורות עיבוד נתונים לחבילת צינורות עיבוד הנתונים, ראו הוספת צינור עיבוד נתונים.

דוגמאות לקוד

במאגר orchestration-pipelines ב-GitHub יש את הדוגמאות העדכניות ביותר לקוד של הרבה שילובים של פעולות ומנועים של צינורות עיבוד נתונים. מומלץ להשתמש בדוגמאות האלה כנקודת התחלה לבדיקת היכולות של Orchestration Pipelines.

הגדרת הפייפליין

להגדרה של צינור עיבוד נתונים יש את המפתחות הבאים ברמה העליונה:

  • ‫modelVersion: הגרסה של מודל הגדרת צינור עיבוד הנתונים. גרסת המודל האחרונה היא 1.0.

  • ‫pipelineId: מזהה ייחודי של צינור עיבוד הנתונים. המזהה הזה נשאר זהה בכמה פריסות וגרסאות, וכך אפשר לעקוב אחרי הישות הלוגית של צינור עיבוד הנתונים ולנהל אותה.

  • ‫description: תיאור של צינור עיבוד הנתונים, שממופה לתיאור של Airflow DAG בסביבת ה-runner.

  • ‫owner: הבעלים של צינור עיבוד הנתונים.

  • ‫tags: מזהי מחרוזות שמוחלים על צינור עיבוד הנתונים, ומשמשים לסינון צינורות עיבוד הנתונים.

  • ‫notifications: התראות על אירועים בצינור עיבוד הנתונים. סוגי ההתראות הנתמכים:

    • ‫onPipelineFailure: אימייל על כשלים בצינור עיבוד הנתונים.

    כדי לקבל התראות, צריך להגדיר את שירותי האימייל של SendGrid בסביבת ה-runner. להוראות, קראו את המאמר הגדרת התראות באימייל.

    דוגמה:

    notifications:
      onPipelineFailure:
        email: ["user1@example.com", "user2@example.com"]
    
  • ‫runner: מציין את מנוע התזמור (orchestration) של היעד. שמור לשימוש בעתיד. מגדירים את הערך הזה בתור airflow.

  • ‫defaults: מגדיר ערכי ברירת מחדל למאפיינים כמו project_id,‏ location ו-executionConfig שחלים על כל הפעולות, אלא אם הם מוחלפים בפעולה ספציפית. אפשר לשנות את המאפיינים project_id ו-location באמצעות מאפייני פעולה ספציפיים. אי אפשר לשנות את המאפיין executionConfig בפעולות ספציפיות, והוא מציין את מספר הניסיונות החוזרים לכל הפעולות בצינור עיבוד הנתונים בשדה retries.

  • ‫triggers: מגדיר איך צינור עיבוד הנתונים מופעל:

    • אין ערך. עדיין אפשר להפעיל את צינור עיבוד הנתונים באופן ידני.

    • ‫schedule. הפעלת צינור עיבוד הנתונים לפי לוח זמנים, באמצעות ביטויי cron.

      לוח זמנים לדוגמה:

      triggers:
        - schedule:
            interval: "0 5 * * *"
            startTime: "2025-10-01T00:00:00"
            endTime: "2026-10-01T00:00:00"
            catchup: false
            timezone: "UTC"
      
  • actions

    מיפוי של המשימות שצריך לבצע. כל רשומת מיפוי תואמת לפעולה אחת. פעולות

פעולות

פעולות בצינור עיבוד הנתונים מגדירות שלבים ספציפיים בהפעלה של צינור עיבוד הנתונים. לכל פעולה צריך להיות מנוע או מסגרת שצוינו עבורה. המנוע או המסגרת קובעים באילו משאבים משתמשים כדי לבצע את הפעולה.

ב-Orchestration Pipelines אפשר לבצע את הפעולות הבאות:

  • ‫Pyspark (pyspark): הפעלת סקריפט PySpark.
  • ‫Notebook (notebook): הפעלת קובץ Notebook.
  • שאילתת SQL‏ (notebook): הרצת שאילתת SQL.
  • ‫Python‏ (python): הרצת סקריפט Python.
  • ‫Pipeline (pipeline): הפעלה של צינורות עיבוד נתונים.

התכונה Orchestration Pipelines תומכת במנועים ובמסגרות הבאים:

  • ‫dataprocOnGce > existingCluster: אשכול Managed Service for Apache Spark שמזוהה לפי clusterName, ‏ project ו-location.

  • ‫dataprocOnGce > ephemeral: אשכול Managed Service for Apache Spark נוצר ונמחק אחרי ביצוע המשימה.

  • ‫dataprocServerless: שליחת אצווה של Managed Service for Apache Spark.

  • bigquery: משימה ב-BigQuery.

  • ‫python > local: סקריפט Python שמופעל ב-Airflow Worker בסביבת ה-runner.

  • ‫dbt > airflowWorker: מודלים של dbt שמופעלים ב-Airflow worker בסביבת ה-runner באמצעות dbt-core.

  • ‫dataform > airflowWorker: תהליכי עבודה של Dataform שמופעלים ב-Airflow worker בסביבת ה-runner באמצעות dataform core cli.

  • ‫dataform > dataformService: תהליכי עבודה של Dataform שמופעלים בשירות Dataform.

בטבלה הבאה מפורטים שילובים אפשריים של סוג פעולה, מנוע ומסגרת. דוגמאות לקוד פעולה מופיעות בתיאורים של המנוע והמסגרת.

פעולה מנוע או Framework הפלט מועבר אל
pyspark dataprocOnGce > existingCluster יומני משימות של Managed Service for Apache Spark
pyspark dataprocOnGce > ephemeralCluster יומני משימות של Managed Service for Apache Spark
pyspark dataprocServerless יומני Managed Service for Apache Spark Batch
notebook dataprocOnGce > existingCluster קטגוריית Runner, בספרייה composer_declarative_dags_resources
notebook dataprocOnGce > ephemeralCluster יומני משימות של Managed Service for Apache Spark
notebook dataprocServerless קטגוריית Runner, בספרייה composer_declarative_dags_resources
sql bigquery הטבלה שצוינה בפרמטר destinationTable
sql dataprocServerless יומני אצווה של Managed Service for Apache Spark.
python ‫local (הפעלה מקומית) יומנים
pipeline dbt > airflowWorker יומנים ו-BigQuery
pipeline dataform > airflowWorker טבלה שצוינה ב-BigQuery
pipeline dataform > dataformService ב-Dataform

לכל הפעולות יש את המפתחות המשותפים הבאים. מפתחות אחרים תלויים בסוג הפעולה.

  • ‫name: שם הפעולה. השם הזה ממופה לשם המשימה של Airflow בסביבת ה-runner. אם פעולה מסוימת דורשת יותר ממשימה אחת ב-Airflow, השם הזה ממופה לקבוצת המשימות.

  • ‫dependsOn: רשימה של שמות פעולות במעלה הזרם שהפעולה הזו תלויה בהן, שמגדירה את סדר הביצוע. אם אחת מהפעולות במעלה הזרם נכשלת, הפעולות במורד הזרם שתלויות בה לא מבוצעות.

  • ‫executionTimeout: הזמן הקצוב לביצוע הפעולה. דוגמאות: 1h, 30m, 40s.

python

פעולות מסוג python. להריץ סקריפטים ב-Python.

מקשים ספציפיים לסוג הפעולה:

  • ‫mainFilePath: נתיב יחסי לקובץ הסקריפט של Python.
  • ‫pythonCallable: השם של ה-callable ב-Python שצריך להריץ בסקריפט Python.
  • ‫opKwargs: מיפוי של ארגומנטים של מילות מפתח לאופרטור.
  • ‫(אופציונלי) environment: מריצים את הסקריפט בסביבה וירטואלית של Python שנוצרה באופן דינמי.

    • ‫requirements: דרישות לסביבה הווירטואלית. הדרישות נפתרות בזמן הריצה.

      • ‫inline: הדרישות מפורטות בתוך השורה.

        • ‫list: רשימת הדרישות. מפרטים את הדרישות הנפרדות בהתאם ל-PEP-508.

          דוגמה:

          environment:
            requirements:
              inline:
                list: ["pandas>=2.0.0"]
          
      • (חלופה) path: הנתיב לקובץ עם הדרישות. הדרישות בקובץ הזה צריכות להיות רשומות בהתאם ל-PEP-508.

        דוגמה:

        environment:
          requirements:
            path: "scripts/requirements.txt"
        
    • ‫systemSitePackages: אם הערך הוא true, הסביבה הווירטואלית יורשת חבילות מספריית site-packages של ה-worker של Airflow. אתם יכולים להתקין חבילות PyPI בהתאמה אישית בסביבת ה-runner.

  • engine:

    • ‫local: הפעלה מקומית בסביבת ה-runner

דוגמה:

מקומי

modelVersion: "1.0"
pipelineId: "python-virtual-env"
description: "A pipeline that runs Python script on isolated virtual environment with specified dependencies."
runner: "airflow"
owner: "data-eng-team"
tags: ["python_virtual_environment", "example"]

defaults:
  projectId: "example-project"
  location: "us-central1"
  executionConfig:
    retries: 1

triggers:
  - schedule:
      interval: "0 5 * * *"
      startTime: "2025-10-01T00:00:00"
      endTime: "2026-10-01T00:00:00"
      catchup: false
      timezone: "UTC"

actions:
  - python:
      name: "first_script_run"
      executionTimeout: "30m"
      mainFilePath: "scripts/venv_test_script_1.py"
      pythonCallable: "main"
      engine:
        local: {}
      environment:
        systemSitePackages: true
        requirements:
          path: "scripts/requirements.txt"

  - python:
      name: "second_script_run"
      executionTimeout: "30m"
      mainFilePath: "scripts/venv_test_script_1.py"
      pythonCallable: "main"
      engine:
        local: {}
      environment:
        requirements:
          inline:
            list: ["pandas>=2.0.0"]
        systemSitePackages: true
      dependsOn: ["first_script_run"]

  - python:
      name: "third_script_run"
      executionTimeout: "30m"
      mainFilePath: "scripts/venv_test_script_2.py"
      pythonCallable: "main"
      engine:
        local: {}
      opKwargs:
        api_endpoint: "https://api.my-vendor.example.com/v1/status"
        api_key_secret_name: "my-vendor-api-key"
      dependsOn: ["first_script_run"]

pyspark

פעולות מסוג pyspark. להריץ סקריפטים של PySpark.

מקשים ספציפיים לסוג הפעולה:

  • ‫mainFilePath: נתיב יחסי לסקריפט PySpark.
  • ‫archiveUris: רשימה של מזהי URI של ארכיון לשימוש עם הפעולה הזו.
  • ‫stagingBucket: קטגוריה של Cloud Storage שבה משתמשים בפעולה הזו.
  • ‫pyFiles: רשימה של קובצי Python לשימוש עם משימת Spark הזו.
  • ‫environment: הגדרת סביבת Python.

    • ‫requirements: קובץ הדרישות של Python שבו צריך להשתמש.

      • ‫path: הנתיב לקובץ עם הדרישות. הדרישות בקובץ הזה צריכות להיות רשומות בהתאם ל-PEP-508.
  • engine:

    • dataprocOnGce > existingCluster
    • dataprocOnGce > ephemeralCluster
    • dataprocServerless

דוגמאות:

existingCluster

modelVersion: "1.0"
pipelineId: "dataproc-existing-cluster-script-pipeline-pyfiles"
description: "A pipeline with a Dataproc Existing cluster running a PySpark task with additional python files."
runner: "airflow"
owner: "data-eng-team"
tags: ["dataproc_create_batch", "example", "pyfiles"]
defaults:
  projectId: "example-project"
  location: "us-central1"
  executionConfig:
    retries: 0
triggers:
  - schedule:
      interval: "0 4 * * *"
      startTime: "2025-10-01T00:00:00"
      endTime: "2026-10-01T00:00:00"
      catchup: false
      timezone: "UTC"
actions:
  - pyspark:
      name: "run-pyspark-with-pyfiles-on-existing-cluster"
      engine:
        dataprocOnGce:
          existingCluster:
            clusterName: "example-dataproc-cluster"
            location: "us-central1"
            projectId: "example-project"
            impersonationChain: "example-account@example-project."
      mainFilePath: "scripts/my_spark_job_with_pyfiles.py"
      pyFiles:
        - "data/lib1.py"

ephemeralCluster

pipelineId: "dataproc-ephemeral-inline-pyspark"
description: "A pipeline with a Dataproc Ephemeral cluster running the PySpark task."
runner: "airflow"
owner: "data-eng-team"
tags: ["dataproc_create_batch", "example"]
modelVersion: "1.0"

defaults:
  projectId: "example-project"
  location: "us-central1"
  executionConfig:
    retries: 0

triggers:
  - schedule:
      interval: "0 5 * * *"
      startTime: "2025-10-01T00:00:00"
      endTime: "2026-10-01T00:00:00"
      catchup: false
      timezone: "UTC"

actions:
  - pyspark:
      name: "run_dataproc_ephemeral"
      executionTimeout: "1h"
      mainFilePath: "scripts/my_spark_job_with_pyfiles.py"
      pyFiles:
        - "data/lib1.py"
      engine:
        dataprocOnGce:
          ephemeralCluster:
            projectId: "example-project"
            location: "us-central1"
            clusterName: "ephemeral-cluster-inline"
            resourceProfile:
              inline:
                config:
                  masterConfig:
                    numInstances: 1
                    machineTypeUri: "n1-standard-4"
                    diskConfig:
                      bootDiskType: "pd-standard"
                      bootDiskSizeGb: 1024
                  workerConfig:
                    numInstances: 2
                    machineTypeUri: "n1-standard-4"
                    diskConfig:
                      bootDiskType: "pd-standard"
                      bootDiskSizeGb: 1024
            properties:
              spark.submit.deployMode: "cluster"

dataprocServerless

modelVersion: "1.0"
pipelineId: "dataproc-create-batch-pipeline-pyspark"
description: "A pipeline with a Batch task."
runner: "airflow"
owner: "data-eng-team"
tags: ["dataproc_create_batch", "example"]

defaults:
  projectId: "example-project"
  location: "us-central1"
  executionConfig:
    retries: 0

actions:
  - pyspark:
      name: "run-pyspark-on-dataproc-serverless"
      mainFilePath: "scripts/my_spark_job_with_pyfiles.py"
      pyFiles:
        - "data/lib1.py"
      engine:
        dataprocServerless:
          location: "us-central1"
          resourceProfile:
            inline:
              environmentConfig:
                executionConfig:
                  serviceAccount: "example-account@example-project."
                  networkUri: "projects/example-project/global/networks/default"
              runtimeConfig:
                version: "2.3"
                properties:
                  spark.app.name: "run-notebook-on-dataproc-serverless"
                  spark.executor.instances: "2"
                  spark.driver.cores: "4"

notebook

פעולות מסוג notebook. הפעלת קובץ ‎ .ipynb של Notebook באמצעות Papermill.

מקשים ספציפיים לסוג הפעולה:

  • ‫mainFilePath: הנתיב היחסי לקובץ ה-notebook.
  • ‫archiveUris: רשימה של מזהי URI של ארכיון לשימוש עם הפעולה הזו.
  • ‫stagingBucket: קטגוריה של Cloud Storage שבה משתמשים בפעולה הזו.
  • ‫environment: הגדרת סביבת Python.

    • ‫requirements: קובץ הדרישות של Python שבו צריך להשתמש.

      • ‫path: הנתיב לקובץ עם הדרישות. הדרישות בקובץ הזה צריכות להיות רשומות בהתאם ל-PEP-508.
  • engine:

    • dataprocOnGce > existingCluster
    • dataprocOnGce > ephemeralCluster
    • dataprocServerless

דוגמה:

dataprocServerless

modelVersion: "1.0"
pipelineId: "dataproc-create-batch-pipeline-resource-profile-gcs-overrides"
description: "A pipeline with a DataprocCreateBatch task."
runner: "airflow"
owner: "data-eng-team"
tags: ["dataproc_create_batch", "example"]

defaults:
  projectId: "example-project"
  location: "us-central1"
  executionConfig:
    retries: 0

triggers:
  - schedule:
      interval: "0 5 * * *"
      startTime: "2025-10-01T00:00:00"
      endTime: "2026-10-01T00:00:00"
      catchup: false
      timezone: "UTC"

actions:
  - notebook:
      name: "run-notebook-on-dataproc-serverless"
      mainFilePath: "scripts/notebookWithArchivesCheck.ipynb"
      archiveUris:
        - "gs://example-bucket-additional-data/custom_venv.tar.gz"
      staging_bucket: "example-bucket-additional-data-additional-data"
      engine:
        dataprocServerless:
          location: "us-central1"
          resourceProfile:
            externalConfigPath: "gs://example-runner-bucket/data/batch-resource-profile.yml"
            overrides:
              runtimeConfig:
                properties:
                  spark.app.name: "run-notebook-on-dataproc-serverless"
                  spark.executor.instances: "2"
                  spark.driver.cores: "4"

sql

פעולות מסוג sql. להריץ שאילתות SQL.

מקשים ספציפיים לסוג הפעולה:

  • ‫query: מגדיר שאילתה.

    • ‫path: השאילתה מוגדרת בקובץ שנמצא בנתיב היחסי לקובץ התצורה של הפריסה.
    • ‫inline: השאילתה מוגדרת בתוך השורה.

  • engine:

    • bigQuery
    • dataprocServerless
    • dataprocOnGce > existingCluster
    • dataprocOnGce > ephemeralCluster

bigQuery

modelVersion: "1.0"
pipelineId: "sql-on-bigquery"
description: "A pipeline with a BigQueryInsertJob task."
runner: "airflow"
tags: ["bigquery", "example"]
owner: "data-eng-team"

defaults:
  projectId: "example-project"
  location: "us-central1"
  executionConfig:
    retries: 0

triggers:
  - schedule:
      interval: "0 5 * * *"
      startTime: "2025-10-01T00:00:00"
      endTime: "2026-10-01T00:00:00"
      catchup: false
      timezone: "UTC"

actions:
  - sql:
      name: "run_bigquery_insert_job_create"
      query:
        inline: "CREATE TABLE IF NOT EXISTS `example-project.example_dataset.example_table` (id INT64, name STRING, timestamp TIMESTAMP );"
      engine:
        bigquery:
          location: "US"
  - sql:
      name: "run_bigquery_insert_job_select"
      query:
        path: "sql-scripts/count_rows.sql"
      engine:
        bigquery:
          location: "US"
          destinationTable: "example-project.example_dataset.example_table_query_results"
      dependsOn:
        - "run_bigquery_insert_job_create"

dataprocServerless

modelVersion: "1.0"
pipelineId: "sql-on-dataproc-serverless"
description: "A pipeline with a cluster running the PySpark task."
runner: "airflow"
owner: "data-eng-team"
tags: ["dataproc-serverless", "example"]

defaults:
  projectId: "example-project"
  location: "us-central1"
  executionConfig:
    retries: 0

triggers:
  - schedule:
      interval: "0 5 * * *"
      startTime: "2025-10-01T00:00:00"
      endTime: "2026-10-01T00:00:00"
      catchup: false
      timezone: "UTC"

actions:
  - sql:
      name: "run-sql-on-dataproc"
      query:
        path: "sql-scripts/test_query.sql"
      engine:
        dataprocServerless:
          location: "us-central1"
          impersonationChain: "example-account@example-project."
          resourceProfile:
            inline:
              runtimeConfig:
                properties:
                  spark.sql.catalog.bigquery: "com.google.cloud.spark.bigquery.BigQueryCatalog"
                  spark.sql.catalog.bigquery.project: "example-project"
                  dataproc.sparkBqConnector.version: "0.42.3"

existingCluster

modelVersion: "1.0"
pipelineId: "sql-on-dataproc-gce-existing"
description: "A pipeline running a SQL query on an existing Dataproc cluster."
runner: "airflow"
owner: "data-eng-team"
tags: ["dataproc-gce", "example", "existing-cluster"]

defaults:
  projectId: "example-project"
  location: "us-central1"
  executionConfig:
    retries: 0

triggers:
  - schedule:
      interval: "0 5 * * *"
      startTime: "2025-10-01T00:00:00"
      endTime: "2026-10-01T00:00:00"
      catchup: false
      timezone: "UTC"

actions:
  - sql:
      name: "run-sql-on-existing-cluster"
      query:
        path: "sql-scripts/test_query.sql"
      engine:
        dataprocOnGce:
          existingCluster:
            clusterName: "cluster-sql"
            projectId: "example-project"
            location: "us-central1"
            impersonationChain: "example-account@example-project."
            properties:
              spark.sql.catalog.bigquery: "com.google.cloud.spark.bigquery.BigQueryCatalog"
              spark.sql.catalog.bigquery.project: "example-project"
              # This field is needed and important for the Spark-BigQuery connector.
              spark.jars: "gs://spark-lib/bigquery/spark-bigquery-with-dependencies_2.12-0.42.3.jar"

ephemeralCluster

modelVersion: "1.0"
pipelineId: "sql-on-dataproc-gce-ephemeral"
description: "A pipeline running a SQL query on an ephemeral Dataproc cluster."
runner: "airflow"
owner: "data-eng-team"
tags: ["dataproc-gce", "example", "ephemeral-cluster"]

defaults:
  projectId: "example-project"
  location: "us-central1"
  executionConfig:
    retries: 0

triggers:
  - schedule:
      interval: "0 5 * * *"
      startTime: "2025-10-01T00:00:00"
      endTime: "2026-10-01T00:00:00"
      catchup: false
      timezone: "UTC"

actions:
  - sql:
      name: "run-sql-on-ephemeral-cluster"
      query:
        path: "sql-scripts/test_query.sql"
      engine:
        dataprocOnGce:
          ephemeralCluster:
            clusterName: "example-ephemeral-cluster"
            projectId: "example-project"
            location: "us-central1"
            impersonationChain: "example-account@example-project."
            properties:
              spark.sql.catalog.bigquery: "com.google.cloud.spark.bigquery.BigQueryCatalog"
              spark.sql.catalog.bigquery.project: "example-project"
              # This field is needed and important for the Spark-BigQuery connector.
              spark.jars: "gs://spark-lib/bigquery/spark-bigquery-with-dependencies_2.12-0.42.3.jar"
            resourceProfile:
              inline:
                clusterConfig:
                  gceClusterConfig:
                    zoneUri: "us-central1-a"
                    metadata: # This metadata field is needed and important for the Spark-BigQuery connector.
                      SPARK_BQ_CONNECTOR_URL: "gs://spark-lib/bigquery/spark-3.5-bigquery-0.43.1.jar"
                  masterConfig:
                    numInstances: 1
                    machineTypeUri: "n1-standard-4"
                  workerConfig:
                    numInstances: 2
                    machineTypeUri: "n1-standard-4"

פייפליין

פעולות מסוג pipeline. להפעיל צינור עיבוד נתונים.

מקשים ספציפיים לסוג הפעולה:

  • framework:

    • dbt
    • dataform > airflowWorker
    • dataform > dataformService

דוגמאות:

dbt

modelVersion: "1.0"
pipelineId: "dbt-pipeline"
description: "A pipeline that runs a dbt workflow."
runner: "airflow"
owner: "example-owner"
defaults:
  projectId: "example-project"
  location: "us-central1"
  executionConfig:
    retries: 0
triggers:
  - schedule:
      interval: "0 5 * * *"
      startTime: "2025-10-01T00:00:00"
      endTime: "2026-10-01T00:00:00"
      catchup: false
      timezone: "UTC"
actions:
  - pipeline:
      name: "dbt-action"
      framework:
        dbt:
          airflowWorker:
            projectDirectoryPath: "dbt_project"
            selectModels: ["model_1", "model_2"]

dataform>airflowWorker

modelVersion: "1.0"
pipelineId: "dataform-pipeline-local"
description: "A pipeline that runs a Dataform workflow."
runner: "airflow"
owner: "example-owner"
defaults:
  projectId: "example-project"
  location: "us-central1"
  executionConfig:
    retries: 0
triggers:
  - schedule:
      interval: "0 5 * * *"
      startTime: "2025-10-01T00:00:00"
      endTime: "2026-10-01T00:00:00"
      catchup: false
      timezone: "UTC"
actions:
  - pipeline:
      name: "run_dataform"
      framework:
        dataform:
          airflowWorker:
            projectDirectoryPath: "dataform_local"

dataform>dataformService

modelVersion: "1.0"
pipelineId: dataform-service
description: "A pipeline that runs a Dataform workflow."
owner: "example-owner"
tags: ["dataform", "example"]
runner: "airflow"

defaults:
  projectId: "example-project"
  location: "us-central1"
  executionConfig:
    retries: 0

actions:
  - pipeline:
      name: "run_dataform"
      framework:
        dataform:
          dataformService:
            location: "us-central1"
            projectId: "example-project"
            repositoryId: "example-repository"
            workflowInvocation:
              workflowConfig: "projects/example-project/locations/us-central1/repositories/example-repository/workflowConfigs/example-test"

  - pipeline:
      name: "run_dataform_compilation"
      framework:
        dataform:
          dataformService:
            location: "us-central1"
            projectId: "example-project"
            repositoryId: "example-repository"
            workflowInvocation:
              compilationResult: "projects/example-project/locations/us-central1/repositories/tets/compilationResults/8027975f-9692-42da-a13b-2267a4909f76"
              invocationConfig:
                serviceAccount: "example-account@example-project."

מנועים

מנועים שמשמשים לפעולות.

dataprocOnGce > existingCluster

הפעלה באשכול קיים של Managed Service for Apache Spark, שמזוהה לפי clusterName,‏ project ו-location.

אתם יכולים לנהל את האשכול שציינתם בהגדרות הפריסה, או באופן ידני ב-Managed Service for Apache Spark. מומלץ לשדרג את האשכול באופן קבוע.

מפתחות:

  • ‫clusterName: שם האשכול
  • ‫location: האזור שבו נמצא האשכול
  • ‫projectId: מזהה הפרויקט שבו נמצא האשכול
  • ‫properties: מפה של מאפייני משימות Spark.

דוגמה:

engine:
  dataprocOnGce:
    existingCluster:
      clusterName: "example-dataproc-cluster"
      location: "us-central1"
      projectId: "example-project"
      impersonationChain: "example-account@example-project."

dataprocOnGce > ephemeralCluster

הפעלה באשכול זמני של Managed Service for Apache Spark, שנוצר ונמחק אחרי הפעלת המשימה.

מפתחות:

  • ‫clusterName: שם האשכול
  • ‫location: האזור שבו נמצא האשכול
  • ‫projectId: מזהה הפרויקט שבו נמצא האשכול
  • ‫impersonationChain: שרשרת ההתחזות לחשבון שירות שבה משתמשים כדי להריץ את הפעולה.
  • ‫resourceProfile: פרופיל המשאבים של אשכול Managed Service for Apache Spark.

    לתיאור של השדות הזמינים, ראו ClusterConfig במסמכי התיעוד של Managed Service for Apache Spark.

    אפשר לציין פרופיל משאבים בדרכים הבאות:

    • ‫inline: מוגדר כחלק מהגדרות צינור עיבוד הנתונים.
    • ‫path: מוגדר בקובץ שנמצא בנתיב היחסי.
    • ‫external_config_path: מוגדר בקובץ שנמצא בקטגוריה של Cloud Storage. בניגוד לאפשרויות inline ו-path, שבהן צריך לבצע commit ופריסה כדי לעדכן את הערכים של פרופיל המשאבים, פרופיל משאבים חיצוני נפתר בכל הפעלה של צינור עיבוד הנתונים, ואפשר לעדכן אותו בלי לפרוס מחדש את צינור עיבוד הנתונים.

    אפשר להחיל שינויים על פרופיל המשאבים שצוין באמצעות המפתח override. ההגדרות החדשות מוחלות באמצעות מיזוג עמוק בפרופיל המשאב שצוין.

  • ‫properties: מפה של מאפייני משימת Spark.

דוגמה:

engine:
  dataprocOnGce:
    ephemeralCluster:
      projectId: "example-project"
      location: "us-central1"
      clusterName: "example-ephemeral-cluster"
      resourceProfile:
        inline:
          config:
            masterConfig:
              numInstances: 1
              machineTypeUri: "n1-standard-4"
              diskConfig:
                bootDiskType: "pd-standard"
                bootDiskSizeGb: 1024
            workerConfig:
              numInstances: 2
              machineTypeUri: "n1-standard-4"
              diskConfig:
                bootDiskType: "pd-standard"
                bootDiskSizeGb: 1024
      properties:
        spark.submit.deployMode: "cluster"

dataprocServerless

מריצים שליחת אצווה ב-Managed Service for Apache Spark.

מפתחות:

  • ‫location: האזור שבו צריך להריץ את משימת Spark.
  • ‫impersonationChain: שרשרת ההתחזות לחשבון שירות שבה משתמשים כדי להריץ את הפעולה.
  • ‫resourceProfile: פרופיל המשאבים של Managed Service for Apache Spark.

    אפשר לציין פרופיל משאבים בדרכים הבאות:

    • ‫inline: מוגדר כחלק מהגדרות צינור עיבוד הנתונים.
    • ‫path: מוגדר בקובץ שנמצא בנתיב היחסי.
    • ‫external_config_path: מוגדר בקובץ שנמצא בקטגוריה של Cloud Storage. בניגוד לאפשרויות inline ו-path, שבהן צריך לבצע commit ופריסה כדי לעדכן את הערכים של פרופיל המשאבים, פרופיל משאבים חיצוני נפתר בכל הפעלה של צינור עיבוד הנתונים, ואפשר לעדכן אותו בלי לפרוס מחדש את צינור עיבוד הנתונים.

    המפתחות הבאים מציינים את ההגדרות של פרופיל המשאבים:

    • ‫environmentConfig: הגדרת הסביבה
    • ‫runtimeConfig: הגדרת זמן ריצה

    לתיאור של השדות הזמינים, ראו RuntimeConfig ו-EnvironmentConfig במסמכי התיעוד של Managed Service for Apache Spark.

    אפשר להחיל שינויים על פרופיל המשאבים שצוין באמצעות המפתח override. ההגדרות שהוחלפו מוחלות באמצעות מיזוג עמוק בפרופיל המשאבים שצוין.

דוגמה (בתוך השורה):

engine:
  dataprocServerless:
    location: "us-central1"
    resourceProfile:
      inline:
        environmentConfig:
          executionConfig:
            serviceAccount: "example-account@example-project."
            networkUri: "projects/example-project/global/networks/default"
        runtimeConfig:
          version: "2.3"
          properties:
            spark.app.name: "run-notebook-on-dataproc-serverless"
            spark.executor.instances: "2"
            spark.driver.cores: "4"

דוגמה (נתיב חיצוני ושינויים):

      engine:
        dataprocServerless:
          location: "us-central1"
          resourceProfile:
            externalConfigPath: "gs://example-runner-bucket/data/batch-resource-profile.yml"
            overrides:
              runtimeConfig:
                properties:
                    spark.app.name: "run-notebook-on-dataproc-serverless"
                    spark.executor.instances: "2"
                    spark.driver.cores: "4"

bigQuery

מריצים כמשימה ב-BigQuery.

מפתחות:

  • ‫location: האזור שבו נמצאת טבלת היעד.
  • ‫destinationTable: טבלה ב-BigQuery לפלט של הנתונים
  • ‫impersonationChain: שרשרת ההתחזות לחשבון שירות שבה משתמשים כדי להריץ את הפעולה.

דוגמה:

      engine:
        bigquery:
          location: "US"
          destinationTable: "example-project.example_dataset.example_table_query_results"

מקומי

מריצים באופן מקומי בסביבת ה-runner.

בפעולה python מפורטות דרכים להגדרת הסביבה הווירטואלית.

דוגמה:

    engine:
      local: {}

Frameworks

מסגרות שמשמשות בפעולות.

dbt > airflowWorker

מריצים מודל dbt על Airflow worker בסביבת ה-runner באמצעות dbt-core.

מפתחות:

  • ‫projectDirectoryPath: נתיב יחסי לתיקייה שמכילה את פרויקט ה-DBT.
  • ‫selectModels: רשימת המודלים שצריך לכלול בהרצה לפי שם (מקביל ל-dbt --select).
  • ‫tags: רשימת המודלים שצריך לכלול בהרצה לפי תג (מקביל ל-dbt --select).

דוגמה:

framework:
  dbt:
    airflowWorker:
      projectDirectoryPath: "dbt_project"
      selectModels: ["model_1", "model_2"]

dataform > airflowWorker

תהליכי עבודה של Dataform שמופעלים ב-Airflow worker בסביבת ה-runner באמצעות dataform core cli.

מפתחות:

  • ‫projectDirectoryPath: נתיב יחסי לתיקייה שמכילה את ההגדרות של תהליך העבודה ב-Dataform.

דוגמה:

framework:
  dataform:
    airflowWorker:
      projectDirectoryPath: "dataform_local"

dataform > dataformService

מריץ תהליכי עבודה של Dataform שמופעלים בשירות Dataform.

מפתחות:

  • ‫location: המיקום של המאגר ב-Dataform.
  • ‫projectId: הפרויקט שבו נמצא מאגר Dataform.
  • ‫repositoryId: מזהה המאגר ב-Dataform
  • ‫workflowInvocation: הגדרת ההפעלה של תהליך העבודה, שמציינת אילו פעולות להריץ. אפשר לעיין במאמר WorkflowInvocation.

דוגמה:

framework:
  dataform:
    dataformService:
      location: "us-central1"
      projectId: "example-project"
      repositoryId: "example-repository"
      workflowInvocation:
        compilationResult: "projects/example-project/locations/us-central1/repositories/example-repository/compilationResults/example-compilation-id"
        invocationConfig:
          serviceAccount: "example-account@example-project."