You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by "blancocardenas (via GitHub)" <gi...@apache.org> on 2026/02/02 17:39:50 UTC

[D] How to generate a DAG task_id based on a pattern such as {bundle_name}_{name}. [airflow]

GitHub user blancocardenas created a discussion: How to generate a DAG task_id based on a pattern such as {bundle_name}_{name}.

What is the best way to dynamically modify the DAG task_id so that it contains a prefix as described below, based on the bundle name?

```python
@dag(start_date=datetime(2026, 1, 1), schedule="0 4 12 */1 *")
def sample_dag() -> HttpOperator:
    return HttpOperator(
        task_id=f"{{ bundle_name }}_{sample_dag.__name__}",
        endpoint="xml/{{ ds_nodash[:6] }}01",
        extra_options={"timeout": 90},
        log_response=True,
        method="GET",
    );
```

GitHub link: https://github.com/apache/airflow/discussions/61364

----
This is an automatically sent email for commits@airflow.apache.org.
To unsubscribe, please send an email to: commits-unsubscribe@airflow.apache.org


Re: [D] How to generate a DAG task_id based on a pattern such as {bundle_name}_{name}. [airflow]

Posted by "potiuk (via GitHub)" <gi...@apache.org>.
GitHub user potiuk added a comment to the discussion: How to generate a DAG task_id based on a pattern such as {bundle_name}_{name}.

This is not possible currently. This is also being discussed as part of the "multi-team" discussions (https://cwiki.apache.org/confluence/display/AIRFLOW/AIP-67+Multi-team+deployment+of+Airflow+components) - that is scheduled for Airflow 3 (watch the devlist for those discussions). For now you have to instruct your users to use the right convention - if you use git, you should make some kind of gates/ prek hooks or similar as part of your CI for PRs to keep your convention working
  and verify that your users do not break it.

GitHub link: https://github.com/apache/airflow/discussions/61364#discussioncomment-15683940

----
This is an automatically sent email for commits@airflow.apache.org.
To unsubscribe, please send an email to: commits-unsubscribe@airflow.apache.org