<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Support Multiple Tasks DAG Inside a `for_each_task` Iteration in Data Engineering</title>
    <link>https://community.databricks.com/t5/data-engineering/support-multiple-tasks-dag-inside-a-for-each-task-iteration/m-p/165128#M55398</link>
    <description>&lt;P&gt;Thanks Thomaz for detailed solutions and approaches.&lt;/P&gt;&lt;P&gt;On the serverless point we've benchmarked it, and it doesn't close the gap. Both figures below are serverless jobs compute on PERFORMANCE_OPTIMIZED, same 10-asset source system, same concurrency of 4. The only variable is architecture.&lt;BR /&gt;run_job_task per item (child job holding a 6-task graph): wave 1 averaged 3m43s; steady state settled at ~2m42s per item. Total 10 minutes wall clock.&lt;BR /&gt;ForEach with a single collapsed notebook task: wave 1 averaged 1m53s; steady state ~44s per item. Total 3.5 minutes wall clock.&lt;BR /&gt;That's 2. The per-item overhead in the fan-out is roughly two minutes, and it does not amortize — it's incurred per run, and each item is a run. Projected to our full 56-asset workload at the same concurrency: roughly 39 minutes versus 11.&lt;BR /&gt;In addition to that time depends on number tasks in for each dag more the tasks more is the time for each task.&lt;BR /&gt;We're not arguing cost alone — your framing advice is right, and we'll lead with orchestration fidelity and the unified iteration-scoped run view. But we'd ask that the cost dimension not be treated as solved by serverless. We measured it on the fastest tier available and it isn't.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Nitin&lt;/P&gt;</description>
    <pubDate>Sat, 08 Aug 2026 05:07:28 GMT</pubDate>
    <dc:creator>NitinDatta</dc:creator>
    <dc:date>2026-08-08T05:07:28Z</dc:date>
    <item>
      <title>Support Multiple Tasks DAG Inside a `for_each_task` Iteration</title>
      <link>https://community.databricks.com/t5/data-engineering/support-multiple-tasks-dag-inside-a-for-each-task-iteration/m-p/164227#M55241</link>
      <description>&lt;DIV&gt;&lt;SPAN&gt;Databricks Jobs &lt;/SPAN&gt;&lt;SPAN&gt;`for_each_task`&lt;/SPAN&gt;&lt;SPAN&gt; accepts exactly one nested task. For workloads that run the *same&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;multi-step pipeline over many datasets* — a very common metadata-driven pattern — this forces a&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;choice between two architectures, each of which gives up something important:&lt;/SPAN&gt;&lt;/DIV&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;&lt;SPAN&gt;-&lt;/SPAN&gt; &lt;SPAN&gt;**One task per iteration.**&lt;/SPAN&gt;&lt;SPAN&gt; Iterations reuse warm compute within a run, so per-item compute&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; acquisition cost is amortised. But because only one task is permitted, every step of the pipeline&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; must be collapsed into a single notebook, and all per-step orchestration provided by the Jobs&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; scheduler (per-step status, per-step retry, &lt;/SPAN&gt;&lt;SPAN&gt;`condition_task`&lt;/SPAN&gt;&lt;SPAN&gt; branching, repair-from-failed-step)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; is lost.&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;-&lt;/SPAN&gt; &lt;SPAN&gt;**&lt;/SPAN&gt;&lt;SPAN&gt;`run_job_task`&lt;/SPAN&gt;&lt;SPAN&gt; per iteration.**&lt;/SPAN&gt;&lt;SPAN&gt; Each item runs a child job with a proper multi-task graph, so&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; all of the above is retained — but each item pays its own compute acquisition.&lt;/SPAN&gt;&lt;/DIV&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;&lt;SPAN&gt;We are asking for the ability to define &lt;/SPAN&gt;&lt;SPAN&gt;**multiple tasks within a single ForEach iteration**&lt;/SPAN&gt;&lt;SPAN&gt;: a&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;small sub-DAG per item, with &lt;/SPAN&gt;&lt;SPAN&gt;`depends_on`&lt;/SPAN&gt;&lt;SPAN&gt;, &lt;/SPAN&gt;&lt;SPAN&gt;`run_if`&lt;/SPAN&gt;&lt;SPAN&gt;, and &lt;/SPAN&gt;&lt;SPAN&gt;`condition_task`&lt;/SPAN&gt;&lt;SPAN&gt; scoped to the iteration,&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;all tasks sharing that iteration's compute. This would remove the trade-off rather than making it&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;cheaper to live with.&lt;/SPAN&gt;&lt;/DIV&gt;</description>
      <pubDate>Tue, 28 Jul 2026 04:40:03 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/support-multiple-tasks-dag-inside-a-for-each-task-iteration/m-p/164227#M55241</guid>
      <dc:creator>NitinDatta</dc:creator>
      <dc:date>2026-07-28T04:40:03Z</dc:date>
    </item>
    <item>
      <title>Re: Support Multiple Tasks DAG Inside a `for_each_task` Iteration</title>
      <link>https://community.databricks.com/t5/data-engineering/support-multiple-tasks-dag-inside-a-for-each-task-iteration/m-p/165089#M55390</link>
      <description>&lt;P&gt;Hey droid,&lt;/P&gt;&lt;P&gt;First — your analysis is correct and still current. I re-checked the docs: a ForEach task takes exactly one nested task (you can't even nest another ForEach), and the dependency scope sits at the ForEach level, so you can't fan out a heterogeneous sub-graph inside the loop. You're not missing an option — the trade-off you laid out is real.&lt;/P&gt;&lt;P&gt;That said, before resigning yourself to the trade-off: the run_job_task-per-iteration path is cheaper than it used to be, and for a lot of metadata-driven fan-outs the compute-acquisition penalty is mostly solvable today.&lt;/P&gt;&lt;P&gt;- Serverless jobs compute for the child job. There's no cluster to acquire per item in the classic sense — startup is fast and you're not amortizing a warm cluster. For many fan-outs this alone neutralizes most of the "each item pays its own acquisition" cost. Benchmark it on your actual item profile rather than trusting a blanket claim, but it's usually the biggest lever.&lt;BR /&gt;- Instance pools if you're on classic compute. Pre-warmed nodes mean each child run grabs a ready node instead of provisioning cold — the classic amortization trick for many short child jobs.&lt;BR /&gt;- Concurrency. ForEach runs iterations concurrently (up to your configured concurrency), so wall-clock for run_job_task-per-item often isn't worse than serialized steps collapsed into one task.&lt;/P&gt;&lt;P&gt;Net: run_job_task per item keeps your real multi-task graph — per-step status, retry, condition_task, repair-from-failed-step — and with serverless or pools the cost gap narrows a lot. I'd measure that before collapsing anything.&lt;/P&gt;&lt;P&gt;The collapsed-single-notebook route can claw back some observability (sub-notebooks via dbutils.notebook.run, your own per-step try/except and logging), but as you already know it does NOT give you scheduler-native per-step status, repair-from-failed-step, or condition_task. Partial workaround, not a substitute — I wouldn't take it if per-step repair matters.&lt;/P&gt;&lt;P&gt;On the request itself: it's a good one, and worth filing properly — account team plus the Ideas/feature-request portal, not the forum (the forum won't route it to the Jobs PM reliably). One tip to make it land: frame it around what serverless does NOT solve, because that's the first thing Databricks will point to. Even with serverless, run_job_task-per-item still means N separate child runs — N run pages, no single iteration-scoped sub-DAG view, and clumsier task-value/context sharing within an item. A true in-iteration sub-DAG (depends_on / run_if / condition_task scoped to the iteration, sharing that iteration's context) is about orchestration fidelity and a unified run view, not just cost. Leading with that makes the ask much harder to wave off as "just use serverless."&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 07 Aug 2026 11:29:36 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/support-multiple-tasks-dag-inside-a-for-each-task-iteration/m-p/165089#M55390</guid>
      <dc:creator>ThomazNeto</dc:creator>
      <dc:date>2026-08-07T11:29:36Z</dc:date>
    </item>
    <item>
      <title>Re: Support Multiple Tasks DAG Inside a `for_each_task` Iteration</title>
      <link>https://community.databricks.com/t5/data-engineering/support-multiple-tasks-dag-inside-a-for-each-task-iteration/m-p/165128#M55398</link>
      <description>&lt;P&gt;Thanks Thomaz for detailed solutions and approaches.&lt;/P&gt;&lt;P&gt;On the serverless point we've benchmarked it, and it doesn't close the gap. Both figures below are serverless jobs compute on PERFORMANCE_OPTIMIZED, same 10-asset source system, same concurrency of 4. The only variable is architecture.&lt;BR /&gt;run_job_task per item (child job holding a 6-task graph): wave 1 averaged 3m43s; steady state settled at ~2m42s per item. Total 10 minutes wall clock.&lt;BR /&gt;ForEach with a single collapsed notebook task: wave 1 averaged 1m53s; steady state ~44s per item. Total 3.5 minutes wall clock.&lt;BR /&gt;That's 2. The per-item overhead in the fan-out is roughly two minutes, and it does not amortize — it's incurred per run, and each item is a run. Projected to our full 56-asset workload at the same concurrency: roughly 39 minutes versus 11.&lt;BR /&gt;In addition to that time depends on number tasks in for each dag more the tasks more is the time for each task.&lt;BR /&gt;We're not arguing cost alone — your framing advice is right, and we'll lead with orchestration fidelity and the unified iteration-scoped run view. But we'd ask that the cost dimension not be treated as solved by serverless. We measured it on the fastest tier available and it isn't.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Nitin&lt;/P&gt;</description>
      <pubDate>Sat, 08 Aug 2026 05:07:28 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/support-multiple-tasks-dag-inside-a-for-each-task-iteration/m-p/165128#M55398</guid>
      <dc:creator>NitinDatta</dc:creator>
      <dc:date>2026-08-08T05:07:28Z</dc:date>
    </item>
  </channel>
</rss>

