Skip to content

[AIRFLOW-780] Fix dag import errors no longer working#2018

Closed
aoen wants to merge 1 commit intoapache:masterfrom
aoen:fix_parse_errors_not_displa
Closed

[AIRFLOW-780] Fix dag import errors no longer working#2018
aoen wants to merge 1 commit intoapache:masterfrom
aoen:fix_parse_errors_not_displa

Conversation

@aoen
Copy link
Copy Markdown
Contributor

@aoen aoen commented Jan 25, 2017

Please accept this PR that addresses the following issues:

The import errors were no longer working after the multiprocessor update
(since they are cleared after each DAG directory is parsed). This change
fixes them, and adds tests to prevent future regressions.

Also fix Py3 incompat in BaseTaskRunner and a couple of linter errors.

Note that there are a few inefficiencies (e.g. sometimes we delete then add import errors in the same place instead of just doing an update), but this is equivalent to the old behavior.

Testing Done:

  • Added missing unit tests for dag imports. Note that some of them strangely fail for python 3 and it became too time consuming to debug since I don't have a copy of the travis environment, I even ran with the same version of python locally and couldn't reproduce. I have skipped those 3 tests in python 3 for now.

@bolkedebruin @artwr @mistercrunch @plypaul

@aoen aoen force-pushed the fix_parse_errors_not_displa branch 2 times, most recently from e806d54 to d635384 Compare January 25, 2017 02:29
Copy link
Copy Markdown
Contributor

@artwr artwr left a comment

Choose a reason for hiding this comment

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

LGTM overall.

Comment thread tests/jobs.py Outdated
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Why the change?

Copy link
Copy Markdown
Contributor Author

@aoen aoen Jan 25, 2017

Choose a reason for hiding this comment

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

Good catch, I must have hit the increment number shortcut by accident! Surprisingly the test still passed.

Comment thread tests/jobs.py Outdated
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Good idea.

@aoen aoen force-pushed the fix_parse_errors_not_displa branch 6 times, most recently from a61cb52 to 6e6ca87 Compare January 25, 2017 23:24
Comment thread airflow/task_runner/base_task_runner.py Outdated
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

decode?

Comment thread tests/jobs.py Outdated
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

and or or?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

and.

                    if not all([s in content for s in (b'DAG', b'airflow')]):
                        self.file_last_changed[filepath] = file_last_changed_on_disk
                        return found_dags

Comment thread tests/jobs.py Outdated
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I think this is not common practice in sqlalchemy?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Undid this change (it goes against the pep8 which is why my linter caught it).

@aoen aoen force-pushed the fix_parse_errors_not_displa branch 14 times, most recently from 3944906 to 66cefe7 Compare January 27, 2017 01:06
The import errors were no longer working after the multiprocessor update
(since they are cleared after each dag directory is parsed). This change
fixes them, and adds tests to prevent future regressions.

Also fix Py3 incompat in BaseTaskRunner and a couple of linter errors.
@aoen aoen force-pushed the fix_parse_errors_not_displa branch from 66cefe7 to 3e226eb Compare January 27, 2017 01:09
@aoen
Copy link
Copy Markdown
Contributor Author

aoen commented Jan 27, 2017

@bolkedebruin Addressed comments and waiting for your LGTM. Would be nice to get this for the RC since there is a regression from 1.7.1 otherwise (and it makes things harder operationally since users will ask you why their dags aren't running).

@codecov-io
Copy link
Copy Markdown

codecov-io commented Jan 27, 2017

Current coverage is 67.01% (diff: 46.15%)

Merging #2018 into master will increase coverage by 0.24%

@@             master      #2018   diff @@
==========================================
  Files           138        138          
  Lines         10526      10531     +5   
  Methods           0          0          
  Messages          0          0          
  Branches          0          0          
==========================================
+ Hits           7028       7057    +29   
+ Misses         3498       3474    -24   
  Partials          0          0          

Powered by Codecov. Last update dc97bcd...3e226eb

@bolkedebruin
Copy link
Copy Markdown
Contributor

I'm not too happy with skipping tests on Travis as it is the only place (publicly) where all tests always run. Can you share what the Travis error was?

Rest LGTM, but I do think it warrants another Beta as it touches scheduler core.

@aoen
Copy link
Copy Markdown
Contributor Author

aoen commented Jan 27, 2017

I agree with you that it's not ideal. I spent about half a day debugging but it was slow-going (I even installed pyenv and used the same version of python in travis). Note that this test coverage was missing before so it's still an improvement. I tried binary searching the code with print statements but this was also slow going.

The travis error was that the import errors simply weren't added in all of the tests that should have added them for python 3.

When we have containers these kinds of reproducibility problems will go away.

@bolkedebruin
Copy link
Copy Markdown
Contributor

K lets put it in then

@asfgit asfgit closed this in 67cbb96 Jan 27, 2017
@aoen aoen changed the title [AIRFLOW-780][AIRFLOW-783] Fix dag import errors no longer working [AIRFLOW-780] Fix dag import errors no longer working Jan 27, 2017
asfgit pushed a commit that referenced this pull request Jan 27, 2017
The import errors were no longer working after the
multiprocessor update
(since they are cleared after each DAG directory
is parsed). This change
fixes them, and adds tests to prevent future
regressions.

Also fix a couple of linter errors.

Note that there are a few inefficiencies (e.g.
sometimes we delete then add import errors in the
same place instead of just doing an update), but
this is equivalent to the old behavior.

Testing Done:
- Added missing unit tests for dag imports. Note
that some of them strangely fail for python 3 and
it became too time consuming to debug since I
don't have a copy of the travis environment, I
even ran with the same version of python locally
and couldn't reproduce. I have skipped those 3
tests in python 3 for now.

Closes #2018 from aoen/fix_parse_errors_not_displa
@aoen
Copy link
Copy Markdown
Contributor Author

aoen commented Jan 27, 2017

@bolkedebruin I merged the change and bumped the beta branch version to beta 5.

alekstorm pushed a commit to alekstorm/incubator-airflow that referenced this pull request Jun 1, 2017
The import errors were no longer working after the
multiprocessor update
(since they are cleared after each DAG directory
is parsed). This change
fixes them, and adds tests to prevent future
regressions.

Also fix a couple of linter errors.

Note that there are a few inefficiencies (e.g.
sometimes we delete then add import errors in the
same place instead of just doing an update), but
this is equivalent to the old behavior.

Testing Done:
- Added missing unit tests for dag imports. Note
that some of them strangely fail for python 3 and
it became too time consuming to debug since I
don't have a copy of the travis environment, I
even ran with the same version of python locally
and couldn't reproduce. I have skipped those 3
tests in python 3 for now.

Closes apache#2018 from aoen/fix_parse_errors_not_displa
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