kaxil opened a new pull request #14406:
URL: https://github.com/apache/airflow/pull/14406


   closes https://github.com/apache/airflow/issues/13799
   
   Without it the migration from 1.10.14 to 2.0.0 can fail with following error 
for old TIs:
   
   ```
   Traceback (most recent call last):
     File 
"/usr/local/lib/python3.6/dist-packages/airflow/jobs/scheduler_job.py", line 
1275, in _execute
       self._run_scheduler_loop()
     File 
"/usr/local/lib/python3.6/dist-packages/airflow/jobs/scheduler_job.py", line 
1377, in _run_scheduler_loop
       num_queued_tis = self._do_scheduling(session)
     File 
"/usr/local/lib/python3.6/dist-packages/airflow/jobs/scheduler_job.py", line 
1533, in _do_scheduling
       num_queued_tis = 
self._critical_section_execute_task_instances(session=session)
     File 
"/usr/local/lib/python3.6/dist-packages/airflow/jobs/scheduler_job.py", line 
1132, in _critical_section_execute_task_instances
       queued_tis = self._executable_task_instances_to_queued(max_tis, 
session=session)
     File "/usr/local/lib/python3.6/dist-packages/airflow/utils/session.py", 
line 62, in wrapper
       return func(*args, **kwargs)
     File 
"/usr/local/lib/python3.6/dist-packages/airflow/jobs/scheduler_job.py", line 
1034, in _executable_task_instances_to_queued
       if task_instance.pool_slots > open_slots:
   TypeError: '>' not supported between instances of 'NoneType' and 'int'
   ```
   
   Workaround was to run manually:
   
   ```
   UPDATE task_instance SET pool_slots = 1 WHERE pool_slots IS NULL;
   ```
   
   This commit makes adds a DB migration to change the value to 1 for records 
with NULL value. And makes the column NOT NULLABLE.
   
   This bug was caused by https://github.com/apache/airflow/pull/7160
   
   <!--
   Thank you for contributing! Please make sure that your code changes
   are covered with tests. And in case of new features or big changes
   remember to adjust the documentation.
   
   Feel free to ping committers for the review!
   
   In case of existing issue, reference it using one of the following:
   
   closes: #ISSUE
   related: #ISSUE
   
   How to write a good git commit message:
   http://chris.beams.io/posts/git-commit/
   -->
   
   ---
   **^ Add meaningful description above**
   
   Read the **[Pull Request 
Guidelines](https://github.com/apache/airflow/blob/master/CONTRIBUTING.rst#pull-request-guidelines)**
 for more information.
   In case of fundamental code change, Airflow Improvement Proposal 
([AIP](https://cwiki.apache.org/confluence/display/AIRFLOW/Airflow+Improvements+Proposals))
 is needed.
   In case of a new dependency, check compliance with the [ASF 3rd Party 
License Policy](https://www.apache.org/legal/resolved.html#category-x).
   In case of backwards incompatible changes please leave a note in 
[UPDATING.md](https://github.com/apache/airflow/blob/master/UPDATING.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.

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


Reply via email to