다음을 통해 공유


대상 설정으로 재정의

이 페이지에서는 Databricks 자산 번들에서 최상위 설정을 대상 설정으로 재정의하거나 결합하는 방법을 설명합니다. 번들 설정에 대한 자세한 내용은 Databricks 자산 번들 구성을 참조하세요.

아티팩트 설정 재정의

예를 들어, artifacts 매핑의 아티팩트 설정을 사용하여 최상위 targets 매핑의 아티팩트 설정을 재정의할 수 있습니다.

# ...
artifacts:
  <some-unique-programmatic-identifier-for-this-artifact>:
    # Artifact settings.

targets:
  <some-unique-programmatic-identifier-for-this-target>:
    artifacts:
      <the-matching-programmatic-identifier-for-this-artifact>:
        # Any more artifact settings to join with the settings from the
        # matching top-level artifacts mapping.

최상위 artifacts 매핑 및 targets 동일한 아티팩트 매핑에 아티팩트 설정이 모두 정의된 경우 매핑의 설정 targets 이 최상위 artifacts 매핑의 설정보다 우선합니다.

예제 1: 최상위 아티팩트 매핑에만 정의된 아티팩트 설정

이것이 실제로 어떻게 작동하는지를 보여주기 위해, 다음 예에서 path는 아티팩트의 모든 설정을 정의하는 최상위 artifacts 매핑에 정의됩니다.

# ...
artifacts:
  my-artifact:
    type: whl
    path: ./my_package
# ...

이 예제를 실행 databricks bundle validate 하면 결과 그래프는 다음과 같습니다.

{
  "...": "...",
  "artifacts": {
    "my-artifact": {
      "type": "whl",
      "path": "./my_package",
      "...": "..."
    }
  },
  "...": "..."
}

예제 2: 여러 아티팩트 매핑에 정의된 충돌 아티팩트 설정

이 예제에서 pathartifacts 내의 최상위 artifacts 매핑과 targets 매핑 모두에 정의되어 있습니다. 이 예제에서는 path 매핑의 artifacts가 최상위 targets 매핑의 path보다 우선권을 가져 아티팩트의 설정을 정의합니다.

# ...
artifacts:
  my-artifact:
    type: whl
    path: ./my_package

targets:
  dev:
    artifacts:
      my-artifact:
        path: ./my_other_package
    # ...

이 예제를 실행 databricks bundle validate 하면 결과 그래프는 다음과 같습니다.

{
  "...": "...",
  "artifacts": {
    "my-artifact": {
      "type": "whl",
      "path": "./my_other_package",
      "...": "..."
    }
  },
  "...": "..."
}

클러스터 설정 무시

대상에 대한 작업 또는 파이프라인 클러스터 설정을 재정의하거나 조인할 수 있습니다.

작업 정의 내의 job_cluster_key를 사용하여 최상위 resources 매핑에서 작업 클러스터 설정을 식별하고, targets 매핑 내의 작업 클러스터 설정과 조인합니다.

# ...
resources:
  jobs:
    <some-unique-programmatic-identifier-for-this-job>:
      # ...
      job_clusters:
        - job_cluster_key: <some-unique-programmatic-identifier-for-this-key>
          new_cluster:
            # Cluster settings.

targets:
  <some-unique-programmatic-identifier-for-this-target>:
    resources:
      jobs:
        <the-matching-programmatic-identifier-for-this-job>:
          # ...
          job_clusters:
            - job_cluster_key: <the-matching-programmatic-identifier-for-this-key>
              # Any more cluster settings to join with the settings from the
              # resources mapping for the matching top-level job_cluster_key.
          # ...

최상위 resources 매핑과 동일한 targetsjob_cluster_key 매핑에서 클러스터 설정이 모두 정의된 경우, targets 매핑의 설정이 최상위 resources 매핑의 설정보다 우선합니다.

Lakeflow Spark 선언적 파이프라인의 경우, 파이프라인 정의에서 클러스터 설정을 식별하려면 최상위 label 매핑 내의 클러스터 설정과 resources 매핑 내의 클러스터 설정을 조인하기 위해, 클러스터 설정에서 targets 을(를) 사용하십시오. 예를 들면 다음과 같습니다.

# ...
resources:
  pipelines:
    <some-unique-programmatic-identifier-for-this-pipeline>:
      # ...
      clusters:
        - label: default | maintenance
          # Cluster settings.

targets:
  <some-unique-programmatic-identifier-for-this-target>:
    resources:
      pipelines:
        <the-matching-programmatic-identifier-for-this-pipeline>:
          # ...
          clusters:
            - label: default | maintenance
              # Any more cluster settings to join with the settings from the
              # resources mapping for the matching top-level label.
          # ...

최상위 resources 매핑과 동일한 targetslabel 매핑에서 클러스터 설정이 모두 정의된 경우, targets 매핑의 설정이 최상위 resources 매핑의 설정보다 우선합니다.

예제 1: 여러 리소스 매핑에 정의되고 설정 충돌이 없는 새 작업 클러스터 설정

이 예제에서 최상위 spark_version 매핑의 resourcesnode_type_idnum_workers와 결합되어 resources에서 명명된 targets 설정을 정의합니다.

# ...
resources:
  jobs:
    my-job:
      name: my-job
      job_clusters:
        - job_cluster_key: my-cluster
          new_cluster:
            spark_version: 13.3.x-scala2.12

targets:
  development:
    resources:
      jobs:
        my-job:
          name: my-job
          job_clusters:
            - job_cluster_key: my-cluster
              new_cluster:
                node_type_id: Standard_DS3_v2
                num_workers: 1
          # ...

이 예제에 대해 databricks bundle validate 실행하면 결과 그래프는 다음과 같습니다.

{
  "...": "...",
  "resources": {
    "jobs": {
      "my-job": {
        "job_clusters": [
          {
            "job_cluster_key": "my-cluster",
            "new_cluster": {
              "node_type_id": "Standard_DS3_v2",
              "num_workers": 1,
              "spark_version": "13.3.x-scala2.12"
            }
          }
        ],
        "...": "..."
      }
    }
  }
}

예제 2: 여러 리소스 매핑에 정의된 새 작업 클러스터 설정 충돌

이 예제에서는 spark_versionnum_workers이 최상위 resources 매핑과 resourcestargets 매핑에서 모두 정의됩니다. 이 예제에서는 spark_versionnum_workersresourcestargets 매핑에서 최상위 spark_version 매핑의 num_workersresources 보다 우선 적용되어, job_cluster_key으로 명명된 my-cluster의 설정을 정의합니다.

# ...
resources:
  jobs:
    my-job:
      name: my-job
      job_clusters:
        - job_cluster_key: my-cluster
          new_cluster:
            spark_version: 13.3.x-scala2.12
            node_type_id: Standard_DS3_v2
            num_workers: 1

targets:
  development:
    resources:
      jobs:
        my-job:
          name: my-job
          job_clusters:
            - job_cluster_key: my-cluster
              new_cluster:
                spark_version: 12.2.x-scala2.12
                num_workers: 2
          # ...

이 예제에 대해 databricks bundle validate 실행하면 결과 그래프는 다음과 같습니다.

{
  "...": "...",
  "resources": {
    "jobs": {
      "my-job": {
        "job_clusters": [
          {
            "job_cluster_key": "my-cluster",
            "new_cluster": {
              "node_type_id": "Standard_DS3_v2",
              "num_workers": 2,
              "spark_version": "12.2.x-scala2.12"
            }
          }
        ],
        "...": "..."
      }
    }
  }
}

예제 3: 여러 리소스 매핑에 정의되고 설정 충돌이 없는 파이프라인 클러스터 설정

예시에서 최상위 node_type_id 매핑의 resourcesnum_workers에서 resources 매핑의 targets와 결합되어, label로 명명된 default의 설정을 정의합니다.

# ...
resources:
  pipelines:
    my-pipeline:
      clusters:
        - label: default
          node_type_id: Standard_DS3_v2

targets:
  development:
    resources:
      pipelines:
        my-pipeline:
          clusters:
            - label: default
              num_workers: 1
          # ...

이 예제에 대해 databricks bundle validate 실행하면 결과 그래프는 다음과 같습니다.

{
  "...": "...",
  "resources": {
    "pipelines": {
      "my-pipeline": {
        "clusters": [
          {
            "label": "default",
            "node_type_id": "Standard_DS3_v2",
            "num_workers": 1
          }
        ],
        "...": "..."
      }
    }
  }
}

예제 4: 여러 리소스 매핑에 정의된 충돌하는 파이프라인 클러스터 설정

이 예제에서 num_workersresources 내의 최상위 resources 매핑과 targets 매핑 모두에 정의되어 있습니다. num_workersresources 매핑에서 targets는 최상위 num_workers 매핑의 resources보다 우선하여 label라는 default의 설정을 정의합니다.

# ...
resources:
  pipelines:
    my-pipeline:
      clusters:
        - label: default
          node_type_id: Standard_DS3_v2
          num_workers: 1

targets:
  development:
    resources:
      pipelines:
        my-pipeline:
          clusters:
            - label: default
              num_workers: 2
          # ...

이 예제에 대해 databricks bundle validate 실행하면 결과 그래프는 다음과 같습니다.

{
  "...": "...",
  "resources": {
    "pipelines": {
      "my-pipeline": {
        "clusters": [
          {
            "label": "default",
            "node_type_id": "Standard_DS3_v2",
            "num_workers": 2
          }
        ],
        "...": "..."
      }
    }
  }
}

작업 설정 재정의

작업 정의 내의 tasks 매핑을 사용하여 resources 매핑의 최상위 작업 설정과 targets 매핑의 작업 설정을 연결할 수 있습니다. 예를 들면 다음과 같습니다.

# ...
resources:
  jobs:
    <some-unique-programmatic-identifier-for-this-job>:
      # ...
      tasks:
        - task_key: <some-unique-programmatic-identifier-for-this-task>
          # Task settings.

targets:
  <some-unique-programmatic-identifier-for-this-target>:
    resources:
      jobs:
        <the-matching-programmatic-identifier-for-this-job>:
          # ...
          tasks:
            - task_key: <the-matching-programmatic-identifier-for-this-key>
              # Any more task settings to join with the settings from the
              # resources mapping for the matching top-level task_key.
          # ...

최상위 resources 매핑 및 targets 동일한 작업에 대한 매핑을 조인하려면 작업 매핑을 task_key 동일한 값으로 설정해야 합니다.

최상위 resources 매핑 및 targets 매핑과 동일한 task 매핑에서 작업 설정이 모두 정의된 경우, targets 매핑의 설정이 최상위 resources 매핑의 설정보다 우선합니다.

예제 1: 여러 리소스 매핑에 정의되고 설정 충돌이 없는 작업 작업 설정

이 예제에서 최상위 spark_version 매핑의 resourcesnode_type_idnum_workers와 결합되어 resources에서 명명된 targets 설정을 정의합니다.

# ...
resources:
  jobs:
    my-job:
      name: my-job
      tasks:
        - task_key: my-key
          new_cluster:
            spark_version: 13.3.x-scala2.12

targets:
  development:
    resources:
      jobs:
        my-job:
          name: my-job
          tasks:
            - task_key: my-task
              new_cluster:
                node_type_id: Standard_DS3_v2
                num_workers: 1
          # ...

이 예제를 실행 databricks bundle validate 하면 결과 그래프는 다음과 같습니다(줄임표는 간결하게 하기 위해 생략된 콘텐츠를 나타낸다).

{
  "...": "...",
  "resources": {
    "jobs": {
      "my-job": {
        "tasks": [
          {
            "new_cluster": {
              "node_type_id": "Standard_DS3_v2",
              "num_workers": 1,
              "spark_version": "13.3.x-scala2.12"
            },
            "task-key": "my-task"
          }
        ],
        "...": "..."
      }
    }
  }
}

예제 2: 여러 리소스 매핑에 정의된 충돌하는 작업 작업 설정

이 예제에서는 spark_versionnum_workers이 최상위 resources 매핑과 resourcestargets 매핑에서 모두 정의됩니다. spark_versionnum_workersresourcestargets 매핑에서 최상위 spark_version 매핑에 있는 num_workersresources보다 우선합니다. 명명된 task_key, my-task에 대한 설정을 정의합니다 (생략된 콘텐츠를 간결하게 나타내기 위해 줄임표 적용).

# ...
resources:
  jobs:
    my-job:
      name: my-job
      tasks:
        - task_key: my-task
          new_cluster:
            spark_version: 13.3.x-scala2.12
            node_type_id: Standard_DS3_v2
            num_workers: 1

targets:
  development:
    resources:
      jobs:
        my-job:
          name: my-job
          tasks:
            - task_key: my-task
              new_cluster:
                spark_version: 12.2.x-scala2.12
                num_workers: 2
          # ...

이 예제에 대해 databricks bundle validate 실행하면 결과 그래프는 다음과 같습니다.

{
  "...": "...",
  "resources": {
    "jobs": {
      "my-job": {
        "tasks": [
          {
            "new_cluster": {
              "node_type_id": "Standard_DS3_v2",
              "num_workers": 2,
              "spark_version": "12.2.x-scala2.12"
            },
            "task_key": "my-task"
          }
        ],
        "...": "..."
      }
    }
  }
}