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

   ### Apache Airflow version
   
   main (development)
   
   ### If "Other Airflow 2 version" selected, which one?
   
   _No response_
   
   ### What happened?
   
   Noticed scheduler is crashing when running mapped task
   
   ### What you think should happen instead?
   
   Scheduler should not crash
   
   ### How to reproduce
   
   1. Executed below mapped DAG
   2. check scheduler logs
   
   
   **DAG CODE**
   
   ```
   from datetime import datetime, timedelta
   from time import sleep
   
   from airflow.sdk import DAG
   from airflow.decorators import task
   from airflow.models.taskinstance import TaskInstance
   from airflow.providers.standard.operators.python import PythonOperator
   from airflow.providers.standard.sensors.date_time import DateTimeSensor, 
DateTimeSensorAsync
   from airflow.providers.standard.sensors.time_delta import TimeDeltaSensor, 
TimeDeltaSensorAsync
   
   delays = [30, 60, 90]
   
   
   @task
   def get_delays():
       return delays
   
   
   @task
   def get_wakes(delay, **context):
       "Wake {delay} seconds after the task starts"
       ti: TaskInstance = context["ti"]
       return (ti.start_date + timedelta(seconds=delay)).isoformat()
   
   
   with DAG(
       dag_id="datetime_mapped",
       start_date=datetime(1970, 1, 1),
       schedule=None,
       tags=["taskmap"] 
   ) as dag:
   
       wake_times = get_wakes.expand(delay=get_delays())
   
       
DateTimeSensor.partial(task_id="expanded_datetime").expand(target_time=wake_times)
       TimeDeltaSensor.partial(task_id="expanded_timedelta").expand(
           delta=list(map(lambda x: timedelta(seconds=x), [30, 60, 90]))
       )
   
       DateTimeSensorAsync.partial(task_id="expanded_datetime_async").expand(
           target_time=wake_times
       )
       TimeDeltaSensorAsync.partial(task_id="expanded_timedelta_async").expand(
           delta=list(map(lambda x: timedelta(seconds=x), [30, 60, 90]))
       )
   
       TimeDeltaSensor(task_id="static_timedelta", delta=timedelta(seconds=90))
       DateTimeSensor(
           task_id="static_datetime",
           target_time="{{macros.datetime.now() + 
macros.timedelta(seconds=90)}}",
       )
   
       PythonOperator(task_id="op_sleep_90", python_callable=lambda: sleep(90))
   ```
   
   ### Operating System
   
   linux
   
   ### Versions of Apache Airflow Providers
   
   _No response_
   
   ### Deployment
   
   Astronomer
   
   ### 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