Skip to content

TypeError: unsupported operand type(s) for +: 'NoneType' and 'datetime.timedelta #11123

@razius

Description

@razius

From the scheduler logs:

Traceback (most recent call last):
  File "/opt/airflow/airflow/jobs/scheduler_job.py", line 1606, in _execute
    self.adopt_or_reset_orphaned_tasks()
  File "/opt/airflow/airflow/utils/session.py", line 65, in wrapper
    return func(*args, **kwargs)
  File "/opt/airflow/airflow/jobs/scheduler_job.py", line 1810, in adopt_or_reset_orphaned_tasks
    to_reset = self.executor.try_adopt_task_instances(tis_to_reset_or_adopt)
  File "/opt/airflow/airflow/executors/celery_executor.py", line 376, in try_adopt_task_instances
    self.adopted_task_timeouts[ti.key] = ti.queued_dttm + self.task_adoption_timeout
TypeError: unsupported operand type(s) for +: 'NoneType' and 'datetime.timedelta'
[2020-09-24 12:13:16,137] {dag_processing.py:521} WARNING - Ending without manager process.
[2020-09-24 12:13:16,138] {scheduler_job.py:1637} INFO - Exited execute loop

Looks like a problem introduced by 59dad1a, I assumed it's a problem with data created before that commit and a missing migration so I did the following for fix it:

airflow=> DELETE FROM task_instance WHERE queued_dttm IS NULL and state = 'scheduled';

Metadata

Metadata

Assignees

No one assigned

    Labels

    Can't ReproduceThe problem cannot be reproducedarea:Schedulerincluding HA (high availability) schedulerkind:bugThis is a clearly a bug

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions