Tetap teratur dengan koleksi
Simpan dan kategorikan konten berdasarkan preferensi Anda.
DAG yang bergantung pada tugas
Halaman ini menguraikan langkah-langkah untuk mengaktifkan Directed Acyclic Graph (DAG) yang bergantung pada tugas untuk menentukan dependensi tugas antara node tabel SQL dalam satu DAG, bukan mengandalkan penjadwalan cron di beberapa DAG. Setelan yang dapat disesuaikan digunakan untuk membuat
DAG Cloud Composer dengan beberapa node pembaruan tabel yang saling bergantung.
Cortex Framework menyediakan setelan yang direkomendasikan untuk DAG SAP (ECC dan S/4HANA) yang bergantung pada tugas. Namun, Anda dapat
menyesuaikannya lebih lanjut atau menentukan DAG yang bergantung pada tugas untuk
sumber data apa pun.
Mengaktifkan DAG yang bergantung pada tugas
Ubah file config.json dengan menetapkan kolom enableTaskDependencies
ke True. Setelan ini mengaktifkan penelusuran
Cortex Framework untuk file setelan pelaporan yang bergantung pada tugas dengan akhiran _task_dep.yaml.
Buat file setelan pelaporan khusus dengan akhiran _task_dep.yaml
untuk setiap sumber data yang memerlukan dependensi tugas. Untuk mengetahui detail selengkapnya, lihat
Menentukan setelan pelaporan yang bergantung pada tugas.
Sesuaikan dependensi tugas dengan menambahkan
table_setting.dag_setting sebagai bagian baru ke node jenis table.
Untuk mengetahui detail selengkapnya, lihat
Menentukan dan menyesuaikan dependensi tugas.
Periksa file yang dihasilkan yang berada di bucket target di bagian
dags/data_source/reporting/task_dep_dags/dag_name. Folder ini akan
berisi file Python yang menentukan DAG Cloud Composer dan file SQL
dengan kueri refresh untuk setiap node tabel dalam DAG.
Salin file ke bucket DAG Cloud Composer untuk men-deploy
Cortex Framework menggunakan
proses build standar.
Menentukan setelan pelaporan yang bergantung pada tugas
Untuk setiap sumber data yang memerlukan dependensi tugas, Cortex Framework
menghendaki file setelan pelaporan yang bergantung pada tugas dengan akhiran _task_dep.yaml.
Saat membuat dan memperbarui file ini, pertimbangkan hal-hal berikut:
name: String yang diperlukan untuk semua node dalam DAG yang bergantung pada tugas yang
menentukan nama DAG tempat node tabel berada. Hal ini
termasuk node tingkat atas yang direferensikan sebagai induk oleh node
lain dalam DAG.
parents: Daftar string opsional yang berisi jalur sql_file dari
node tabel lain dalam DAG yang sama. Induk ini harus berhasil
berjalan sebelum node dipicu.
Pertimbangan tambahan:
Node tanpa induk yang ditentukan dianggap sebagai node tingkat teratas dan akan berjalan
di awal DAG.
Setidaknya satu node tingkat teratas harus memiliki table_setting.load_frequency
yang ditentukan, yang akan digunakan sebagai jadwal DAG.
Jika beberapa node level teratas telah menentukan load_frequency, node tersebut harus
sama.
Node turunan yang telah menentukan parents tidak dapat menentukan load_frequency.
Node yang tidak memiliki dag_setting yang ditentukan akan dibuat sama seperti
sebelumnya sebagai DAG dengan satu node pembaruan tabel dan tidak ada dependensi tugas.
Jenis node lain seperti tampilan dan skrip tidak dapat disertakan dalam
DAG yang bergantung pada tugas, yang hanya menghasilkan node dengan DML untuk memuat ulang tabel.
[[["Mudah dipahami","easyToUnderstand","thumb-up"],["Memecahkan masalah saya","solvedMyProblem","thumb-up"],["Lainnya","otherUp","thumb-up"]],[["Sulit dipahami","hardToUnderstand","thumb-down"],["Informasi atau kode contoh salah","incorrectInformationOrSampleCode","thumb-down"],["Informasi/contoh yang saya butuhkan tidak ada","missingTheInformationSamplesINeed","thumb-down"],["Masalah terjemahan","translationIssue","thumb-down"],["Lainnya","otherDown","thumb-down"]],["Terakhir diperbarui pada 2025-09-04 UTC."],[],[],null,["# Task dependent DAGs\n===================\n\nThis page outlines the steps to enable task dependent Directed Acyclic Graphs\n(DAGs) to specify task dependencies\nbetween SQL table nodes within a single DAG, rather than relying on cron\nscheduling across multiple DAGs. Customizable settings are used to generate\nCloud Composer DAGs with multiple table refresh nodes that depend on each other.\nCortex Framework provides recommended settings for task dependent\n[SAP DAGs (ECC and S/4HANA)](/cortex/docs/operational-sap). However, you can\ncustomize them further or define task dependent DAGs for any\n[data sources](/cortex/docs/data-sources-and-workloads).\n\nEnable task dependent DAGs\n--------------------------\n\n1. Modify the [*config.json*](https://github.com/GoogleCloudPlatform/cortex-data-foundation/blob/main/config/config.json) file by setting the `enableTaskDependencies` field to `True`. This setting activates the Cortex Framework's search for task-dependent reporting settings files with the suffix `_task_dep.yaml`.\n2. Create a dedicated reporting settings file with the suffix `_task_dep.yaml` for each data source requiring task dependencies. For more details, see [Define task-dependent reporting settings](/cortex/docs/optional-step-task-dependent-dags#define_task-dependent_reporting_settings).\n3. Customize the task dependencies by adding `table_setting.dag_setting` as a new section to `table` type nodes. For more details, see [Specify and customize task dependencies](/cortex/docs/optional-step-task-dependent-dags#specify_and_customize_task_dependencies).\n4. Build Cortex Framework using the [standard build process](/cortex/docs/deployment-step-six#Cloud%20Composer).\n5. Examine the generated files that are located in the target bucket under `dags/`\u003cvar translate=\"no\"\u003edata_source\u003c/var\u003e`/reporting/task_dep_dags/`\u003cvar translate=\"no\"\u003edag_name\u003c/var\u003e. This folder will contain a Python file defining the Cloud Composer DAG and a SQL file with the refresh query for each table node within the DAG.\n6. Copy the files to the Cloud Composer DAG bucket to deploy Cortex Framework using the [standard build process](/cortex/docs/deployment-step-six#Cloud%20Composer).\n\nDefine task-dependent reporting settings\n----------------------------------------\n\nFor each data source requiring task dependencies, Cortex Framework\nexpects task-dependent reporting settings files with the suffix `_task_dep.yaml`.\nWhen creating and updating these files, consider the following:\n\n- For SAP you may customize and use the provided setting files [`reporting_settings_ecc_task_dep.yaml`](https://github.com/GoogleCloudPlatform/cortex-data-foundation/blob/main/src/SAP/SAP_REPORTING/reporting_settings_ecc_task_dep.yaml) and [`reporting_settings_s4_task_dep.yaml`](https://github.com/GoogleCloudPlatform/cortex-data-foundation/blob/main/src/SAP/SAP_REPORTING/reporting_settings_s4_task_dep.yaml).\n- For other data sources, create your own task-dependent reporting settings alongside the original, for example: `reporting_settings_task_dep.yaml.`\n\n| **Note:** These settings are distinct from the standard `reporting_settings.yaml` files so they can be enabled and deployed independently. If a data source lacks a `reporting_settings_task_dep.yaml` file, it will use the regular `reporting_settings.yaml` file without task dependencies regardless of the `enableTaskDependencies` value in *config.json* .\n\nFor more information about the fields available within reporting settings\nfiles, see [dag_types.py](https://github.com/GoogleCloudPlatform/cortex-data-foundation/tree/main/src/common/materializer/dag_types.py).\n\nSpecify and customize task dependencies\n---------------------------------------\n\nCustomize the task dependencies by adding\n`table_setting.dag_setting` as a new section to `table` type nodes: \n\n - sql_file: dependent_table2.sql\n type: table\n table_setting:\n dag_setting:\n name: \"dag1\"\n parents: [\"dependent_table1.sql\"]\n\n- DAG settings include two fields:\n\n - `name`: A required string for **all nodes in a task dependent DAG** that designates the name of the DAG to which the table node belongs. This includes top level nodes which are referenced as a *parent* by other nodes within the DAG.\n - `parents`: An optional list of strings containing the `sql_file` path of other table nodes within the same DAG. These parents must run successfully before the node is triggered.\n\n**Additional considerations**:\n\n- Nodes without defined parents are considered top level nodes and will run at the start of the DAG.\n- At least one top level node must have `table_setting.load_frequency` defined, which will be used as the DAG schedule.\n- If multiple top level nodes have defined `load_frequency`, they must be the same.\n- Child nodes that have `parents` defined can't define `load_frequency`.\n- Nodes that don't have `dag_setting` defined will be generated the same as before as a DAG with a single table refresh node and no task dependencies.\n- Other node types like views and scripts can't be included in task dependent DAGs, which only generate nodes with DML to refresh tables."]]