infamax opened a new issue, #56374:
URL: https://github.com/apache/airflow/issues/56374

   ### Apache Airflow version
   
   3.1.0
   
   ### If "Other Airflow 2 version" selected, which one?
   
   _No response_
   
   ### What happened?
   
   Hello!
   
   I create custom Timetable. In 
[doc](https://airflow.apache.org/docs/apache-airflow/stable/howto/timetable.html#changing-generated-run-id)
  timetable has method for generate custom run_id. This feature works for 
scheduled runs but not working for manual and backfill trigger dag runs. 
   
   ### What you think should happen instead?
   
   Method `generate_run_id` for custom timetable work correct in backfill and 
manual triggers modes.
   
   ### How to reproduce
   
   Write airflow plugins with custom Timetable. File location in plugins folder 
and name `my_timetable.py`. Example like this
   
   ```python
   from airflow.plugins_manager import AirflowPlugin
   from airflow.timetables.base import DataInterval
   from airflow.timetables.events import EventsTimetable
   from airflow.utils.types import DagRunType
   from pendulum import DateTime
   
   class MyTimeTable(EventsTimetable):
       def generate_run_id(self, *, run_type: DagRunType, run_after: DateTime, 
data_interval: DataInterval, **kwargs):
           return data_interval.end.format("YYYY-MM-DD")
   
   class MyTimeTablePlugin(AirflowPlugin):
       name = "my_timetable_plugin"
       timetables = [MyTimeTable]
   ```
   
   Write a simple dag using this timetable. Example like this
   ```
   import pendulum
   
   from airflow.sdk import DAG
   from airflow.providers.standard.operators.bash import BashOperator
   from my_timetable import MyTimeTable
   
   event_dates = [
       pendulum.datetime(2025, 9, 5, 8, 27, 15),
       pendulum.datetime(2025, 9, 10, 10, 27, 15),
       pendulum.datetime(2025, 10, 5, 8, 27, 15),
   ]
   
   start_date = pendulum.datetime(2022, 1, 1)
   
   
   with DAG(dag_id="my_dag", start_date=start_date, 
schedule=EventsTimetable(event_dates=event_dates, restrict_to_events=True):
       bash_operator = BashOperator(task_id="hello", bash_command="echo hello")
       bash_operator
   ```
   
   When run this code for schedule `run_id` for generate dag is correct. But 
when is using backfill added prefix `backfill__`  but timetable method 
`generate_run_id` not add this prefix :( 
   
   ### Operating System
   
   Ubuntu 22.04
   
   ### Versions of Apache Airflow Providers
   
   _No response_
   
   ### Deployment
   
   Official Apache Airflow Helm Chart
   
   ### Deployment details
   
   _No response_
   
   ### Anything else?
   
   _No response_
   
   ### Are you willing to submit PR?
   
   - [ ] Yes I am willing to submit a PR!
   
   ### Code of Conduct
   
   - [x] I agree to follow this project's [Code of 
Conduct](https://github.com/apache/airflow/blob/main/CODE_OF_CONDUCT.md)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to