Hi all,

Thanks for the discussion on the dev call last week (minutes [1]). Here is 
where I'd like to take the AIP based on that feedback, plus a few things that 
are not in the minutes.

1. Remove trigger-time overrides

The feedback from Ash, which Elad agreed with, was that a run shouldn't change 
fields the Dag author didn't opt in. Param binding already gives the author 
that opt-in, so I propose removing overrides from the AIP. For Dags nobody 
prepared, the cluster policy remains the tool: task_instance_mutation_hook can 
read dag_run.conf since 3.3.

This removes the overrides request field, nominated pools and queues, the Dag 
edit permission check, the DB migration, the trigger form editor and the 
fallback rules. What is left needs no migration, no new request field and no 
new permission.

Elad: the case you described was ad hoc runs that need their own pool and 
priority. Without overrides the Dag has to be prepared once: the author adds a 
bounded param, and each ad hoc run passes a value in conf (UI, REST, CLI or 
TriggerDagRunOperator). Does that cover the cases you had in mind, or are there 
ones where the Dag can't be prepared in advance?

2. Syntax (changed since my first email)

There is no Lookup class any more. As discussed with Ash on the wiki page, the 
four fields accept the existing dag.param() reference:

    with DAG(
        "regional_sync",
        params={
            "warehouse_pool": Param("wh_small", enum=["wh_small", "wh_large"]),
        },
    ) as dag:
        LoadOperator(task_id="load", pool=dag.param("warehouse_pool"))

Elad and Amogh, you gave your +1 when the text said Lookup, so please say if 
this changes anything for you. Two smaller changes: .map() is gone (use one 
bounded param per field), and Airflow Variables as a source, which my first 
email mentioned, are future work.

3. Backfills

The AIP has a helper that picks a value by run type, 
by_run_type(backfill="backfill_pool", default="etl_pool"), and Ash questioned 
whether it is needed. I'd like to keep it. It is declared by the Dag author in 
the Dag file and takes no input from whoever creates the run, so it follows the 
same principle as above. It also makes the backfill case automatic: every 
backfill of that Dag goes to the backfill pool.

The alternative is to bind the pool to a param and pass the value in the 
backfill's run conf. That works without the helper, but whoever starts the 
backfill has to remember to pass it, and if they don't, the backfill competes 
with the scheduled runs in the default pool. The cost of keeping the helper is 
one new function in the Task SDK. Ash, does that address your concern? If 
people feel it is not worth it for the first version, I can move it to Future 
work.

4. Name

Ash pointed out that "scheduling controls" reads as controlling when a task 
runs. I propose "AIP-117: Per-Run Task Field Values". Better suggestions are 
welcome.

5. Questions that came up

- Why not template these fields? The scheduler reads them before a task reaches 
a worker, and Jinja renders on the worker. On these four fields the scheduler 
reads the value from the run's validated params when the run is created. 
dag.param() on templated fields behaves as it does today.
- Who can choose a value? Anyone who can trigger the Dag, and only from the 
values the author listed (an enum, or a minimum and maximum for the integer 
fields). Scheduled runs use the param's default.
- How does this relate to the backfill controls? Those limit how many runs are 
active at once. This chooses the pool, slots, priority and queue of the tasks.
- Does priority_weight still matter? Yes, when a pool or parallelism is 
contended: the scheduler's queuing query orders by it. It is the least 
important of the four, though.
- Mapped tasks? With this AIP, partial(pool=dag.param("x")) gives every mapped 
task instance the run's value. Different values per map index are left as 
future work pending discussion/feeback.
- What changes in the scheduler? Nothing in the critical section. Values are 
written to the task instance columns it already reads, and 
task_instance_mutation_hook still runs last.

If there are no objections by Nov 30th noon (PST), I'll update the AIP page and 
start the vote.

Thanks,
Ramit

[1] 
https://cwiki.apache.org/confluence/spaces/AIRFLOW/pages/462817593/2026-11-19+Dev+Call+Minutes

> On Nov 19, 2026, at 12:34 AM, Kataria, Ramit via dev <[email protected]> 
> wrote:
> 
> Thanks for the pointer, Stephen. AIP-117 is narrower than #77021. It covers 
> only pool, pool_slots, priority_weight and queue, and sets them when the run 
> is created. It doesn't change operator arguments or templated fields, at 
> trigger or at clear. The overlap is storage: overrides are kept on the Dag 
> run and reapplied on clear and retry, so a clear-time feature could reuse 
> that. I'd keep #77021 as its own discussion, since whether a user should 
> change what a task does without changing the Dag is a different question.
> 
> ________________________________
> From: Stephen Bracken <[email protected]>
> Date: Friday, November 13, 2026 at 3:11 PM
> To: [email protected] <[email protected]>
> Subject: RE: [EXT] [DISCUSS] AIP-117: Per-run Task Scheduling Controls
> 
> 
> 
> Hi Ramit,
> 
> This AIP has some overlap with my gihub issue, Allow updating Task
> attributes on clear. Interested to hear your thoughts on how this could
> be integrated.
> 
> https://github.com/apache/airflow/issues/77021
> 
> Regards,
> 
> Stephen
> 
> 
>> On 2026-10-31 00:23 UTC Ramit Kataria via dev wrote:
>> 
>> Hi all,
>> 
>> I'd like to start the discussion on AIP-117, Per-run Task Scheduling
> Controls:
>> 
> https://cwiki.apache.org/confluence/spaces/AIRFLOW/pages/446071748/WIP+AIP-117+Per-Run+Task+Scheduling+Controls
>> 
>> A task's pool, pool_slots, priority_weight and queue are fixed in the
> Dag file. You can't change them for one run when you trigger it, and a
> Dag author can't make them depend on a param or on the kind of run.
> Today people duplicate tasks and branch between them, keep two copies of
> a Dag, or ask their Deployment Manager for a cluster policy that reads
> dag_run.conf.
>> 
>> The proposal has two parts.
>> 
>> 1. Lookups, for Dag authors. A task field can take its value from a
> Dag param, the run type, or an Airflow Variable instead of a literal,
> for example pool=Lookup.param("warehouse_pool"). A param used this way
> must declare enum (or minimum and maximum for numbers), so whoever
> triggers the run can only pick values the author listed, and trigger
> permission is enough.
>> 
>> 2. Trigger-time overrides, for operators. An optional "overrides"
> field on the trigger request sets these fields for specific tasks,
> TaskGroups or pools, for Dags whose author didn't prepare anything. It
> needs Dag edit permission and only works with pools and queues an
> administrator has nominated. Nothing is nominated by default, so nothing
> changes on upgrade.
>> 
>> Values are resolved when the run is created and applied whenever task
> instances are created, cleared or retried. A task_instance_mutation_hook
> still runs last and wins. The scheduler never runs user code, and its
> critical section is unchanged.
>> 
>> To make this concrete, here is roughly what the docs would say once
> it lands:
>> 
>> - Params: "A task's pool, pool slots, priority weight or queue can
> come from a param, for example pool=Lookup.param("warehouse_pool") with
> Param(default="wh_small", enum=["wh_small", "wh_large"]). The trigger
> form shows it as a dropdown and notes which tasks it affects. Scheduled
> runs use the default. The same value can be passed as conf from the REST
> API, the CLI, TriggerDagRunOperator or a backfill."
>> 
>> - Dag runs: "If you can edit a Dag, you can override these fields for
> one run without changing the Dag, for example {"overrides": {"tasks":
> {"extract": {"pool": "heavy_pool"}}}}. Keys can be task IDs or TaskGroup
> IDs, and "pools": {"etl_pool": "etl_overflow_pool"} moves every task of
> the run from one pool to another. Only pools and queues your
> administrator has nominated can be used."
>> 
>> - Pools: "A pool can't be used for trigger-time overrides until it's
> marked as an override target. Treat that as letting anyone who can edit
> a Dag send its tasks to this pool. Removing the mark takes effect
> immediately, and runs already in progress fall back to their normal pool."
>> 
>> - Cluster policies: "Lookups and overrides are applied before
> task_instance_mutation_hook, so the hook keeps the last word.
> task_policy runs at parse time and only sees defaults, so put rules that
> must hold for every run in task_instance_mutation_hook."
>> 
>> I'd especially like feedback on:
>> 
>> - The security model: authors bound what the person triggering can
> pick, and administrators nominate what Dag editors can override to.
>> - The name "Lookup", which is a working name.
>> 
>> Thanks,
>> Ramit
>> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
> 

Reply via email to