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-5869] BugFix: Creating DagRuns fails for Deserialized tasks … #6519

Merged
merged 1 commit into from
Nov 11, 2019

Conversation

kaxil
Copy link
Member

@kaxil kaxil commented Nov 8, 2019

…with no start_date

Make sure you have checked all steps below.

Jira

Description

  • Here are some details about my PR, including screenshots of any UI changes:
    Deserialized operators do not always have start_date set.

That, for instance, breaks triggering dags.

See the code from DAG.create_dagrun():

        run = DagRun(...)
        session.add(run)
        session.commit()

        run.dag = self
        run.verify_integrity(session=session) # this validation fails because run assumes that all operators have start_date set
        run.refresh_from_db()

One of the optimisation (https://github.com/coufon/airflow/commit/b5ee858f44f55818c589cf2c8bf3866fa5d50e30) we did as part of DAG Serialization was to not store dates in tasks if they have a matching date (start_date or end_date) in DAG. Unfortunately, when triggering DAG containing such tasks, it fails on DagRun.run.verify_integrity.

The fix is to add the start_date when deserializing the operator.

Tests

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

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"

Documentation

  • In case of new functionality, my PR adds documentation that describes how to use it.
    • All the public functions and the classes in the PR contain docstrings that explain what it does
    • If you implement backwards incompatible changes, please leave a note in the Updating.md so we can assign it to a appropriate release

@kaxil kaxil requested a review from ashb November 8, 2019 00:40
@codecov-io
Copy link

Codecov Report

Merging #6519 into master will decrease coverage by 0.43%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #6519      +/-   ##
==========================================
- Coverage   83.98%   83.54%   -0.44%     
==========================================
  Files         635      635              
  Lines       36722    36725       +3     
==========================================
- Hits        30840    30683     -157     
- Misses       5882     6042     +160
Impacted Files Coverage Δ
airflow/serialization/serialized_dag.py 96% <100%> (+0.16%) ⬆️
airflow/kubernetes/volume_mount.py 44.44% <0%> (-55.56%) ⬇️
airflow/executors/sequential_executor.py 47.61% <0%> (-52.39%) ⬇️
airflow/kubernetes/volume.py 52.94% <0%> (-47.06%) ⬇️
airflow/kubernetes/pod_launcher.py 45.25% <0%> (-46.72%) ⬇️
airflow/kubernetes/kube_client.py 33.33% <0%> (-41.67%) ⬇️
...rflow/contrib/operators/kubernetes_pod_operator.py 70.14% <0%> (-28.36%) ⬇️
airflow/utils/log/colored_log.py 81.81% <0%> (-11.37%) ⬇️
airflow/utils/sqlalchemy.py 86.44% <0%> (-6.78%) ⬇️
airflow/executors/__init__.py 63.26% <0%> (-4.09%) ⬇️
... and 4 more

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 49f8be7...8c5e408. Read the comment docs.

@potiuk
Copy link
Member

potiuk commented Nov 10, 2019

Just make sure description fits in 80 chars when merging.

@kaxil kaxil merged commit 3fa64ea into apache:master Nov 11, 2019
@kaxil kaxil deleted the fix-dag-start-date branch November 11, 2019 13:26
potiuk pushed a commit that referenced this pull request Nov 11, 2019
potiuk pushed a commit that referenced this pull request Nov 12, 2019
eladkal pushed a commit to eladkal/airflow that referenced this pull request Dec 2, 2019
kaxil added a commit that referenced this pull request Dec 12, 2019
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.

3 participants