Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[AIRFLOW-2870] Use abstract TaskInstance for migration #3720

Merged
merged 1 commit into from
Aug 8, 2018

Conversation

bolkedebruin
Copy link
Contributor

Make sure you have checked all steps below.

Jira

  • My PR addresses the following Airflow Jira issues and references them in the PR title. For example, "[AIRFLOW-XXX] My Airflow PR"

Description

  • Here are some details about my PR, including screenshots of any UI changes:

If we use the full model for migration it can have columns
added that are not available yet in the database. Using
an abstraction ensures only the columns that are required
for data migration are present.

Tests

  • My PR adds the following unit tests OR does not need testing for this extremely good reason:

Db migration

Commits

  • My commits all reference Jira issues in their subject lines, and I have squashed multiple commits if they address the same issue. In addition, my commits follow the guidelines from "How to write a good git commit message":
    1. Subject is separated from body by a blank line
    2. Subject is limited to 50 characters (not including Jira issue reference)
    3. Subject does not end with a period
    4. Subject uses the imperative mood ("add", not "adding")
    5. Body wraps at 72 characters
    6. Body explains "what" and "why", not "how"

@ashb @gwax PTAL

Documentation

  • In case of new functionality, my PR adds documentation that describes how to use it.
    • When adding new operators/hooks/sensors, the autoclass documentation generation needs to be added.

Code Quality

  • Passes git diff upstream/master -u -- "*.py" | flake8 --diff

@bolkedebruin bolkedebruin force-pushed the AIRFLOW-2870 branch 2 times, most recently from 8432654 to 0d85793 Compare August 8, 2018 11:44
Copy link
Member

@ashb ashb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@codecov-io
Copy link

codecov-io commented Aug 8, 2018

Codecov Report

Merging #3720 into master will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #3720   +/-   ##
=======================================
  Coverage   77.63%   77.63%           
=======================================
  Files         204      204           
  Lines       15800    15800           
=======================================
  Hits        12267    12267           
  Misses       3533     3533

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 8687ab9...311bc91. Read the comment docs.

@gwax
Copy link
Contributor

gwax commented Aug 8, 2018

Clever approach; thanks for taking this on @bolkedebruin

On attempting upgradedb, I run into the following error with this branch:

  File "/Users/georgelesliewaksman/.pyenv/versions/2.7.15/envs/temp2/lib/python2.7/site-packages/airflow/migrations/versions/cc1e65623dc7_add_max_tries_column_to_task_instance.py", line 98, in upgrade
    ti.max_tries = ti.try_number
AttributeError: 'TaskInstance' object has no attribute 'try_number'

Looks like we also need the "try_number" column on the migration version of the model:

try_number = Column(Integer, default=0)

@bolkedebruin
Copy link
Contributor Author

Ah let me fix that

If we use the full model for migration it can have columns
added that are not available yet in the database. Using
an abstraction ensures only the columns that are required
for data migration are present.
@bolkedebruin
Copy link
Contributor Author

@gwax done. PTAL

@gwax
Copy link
Contributor

gwax commented Aug 8, 2018

That works for me now.

:shipit: !

@bolkedebruin bolkedebruin merged commit 546f1cd into apache:master Aug 8, 2018
bolkedebruin added a commit that referenced this pull request Aug 8, 2018
If we use the full model for migration it can have columns
added that are not available yet in the database. Using
an abstraction ensures only the columns that are required
for data migration are present.

(cherry picked from commit 546f1cd)
Signed-off-by: Bolke de Bruin <[email protected]>
bolkedebruin added a commit that referenced this pull request Aug 8, 2018
If we use the full model for migration it can have columns
added that are not available yet in the database. Using
an abstraction ensures only the columns that are required
for data migration are present.

(cherry picked from commit 546f1cd)
Signed-off-by: Bolke de Bruin <[email protected]>
(cherry picked from commit 95aa49a)
Signed-off-by: Bolke de Bruin <[email protected]>
lxneng pushed a commit to lxneng/incubator-airflow that referenced this pull request Aug 10, 2018
If we use the full model for migration it can have columns
added that are not available yet in the database. Using
an abstraction ensures only the columns that are required
for data migration are present.
aliceabe pushed a commit to aliceabe/incubator-airflow that referenced this pull request Jan 3, 2019
If we use the full model for migration it can have columns
added that are not available yet in the database. Using
an abstraction ensures only the columns that are required
for data migration are present.
cfei18 pushed a commit to cfei18/incubator-airflow that referenced this pull request Jan 23, 2019
If we use the full model for migration it can have columns
added that are not available yet in the database. Using
an abstraction ensures only the columns that are required
for data migration are present.

(cherry picked from commit 546f1cd)
Signed-off-by: Bolke de Bruin <[email protected]>
(cherry picked from commit 95aa49a)
Signed-off-by: Bolke de Bruin <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants