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

Feature/upgrade to networkx 2 #1509

Merged
merged 5 commits into from
Jun 12, 2019
Merged

Feature/upgrade to networkx 2 #1509

merged 5 commits into from
Jun 12, 2019

Conversation

heisencoder
Copy link
Contributor

Changes to make linker.py work with both networkx version 1 and 2.

See #1496

@heisencoder
Copy link
Contributor Author

I'm investigating the failures now...

@drewbanin
Copy link
Contributor

drewbanin commented Jun 6, 2019

Hey @heisencoder - thanks for making this PR!!

I think you'll want to rebase this one against the latest version of dev/wilt-chamberlain. Looks like you picked up a couple of extra commits in this PR.

We don't automatically run integration tests when PRs are submitted. These things run against our internal Snowflake/Redshift/BQ databases, so someone nefarious could log our credentials if they were so inclined :).

You mentioned in the commit message that the unit tests are passing. Let me take a quick look at this one, then I can try to kick off tests for you

@heisencoder
Copy link
Contributor Author

After running some local unit tests against networkx 1.11, I discovered that the migration guide lied about it being sufficient to just drop the _iter suffix on in_degree_iter. That said, I've got a work-around that works in both networkx 1 and 2:

def _find_new_additions(self):
    for node, in_degree in dict(self.graph.in_degree()).items():

I had based this change on the dev/Louisa May Alcott because #1496 was tagged with Louisa May Alcott, but I'm happy to rebase this against the main development branch.

@drewbanin
Copy link
Contributor

🤦‍♂ you're totally right! I'm actually not certain that we want to merge this into dev/louisa-may-alcott, but this probably won't make it into dev/wilt-chamberlain either. I'd like to do this for our 0.14.1 patch release, which should happen before LMA is ready to be released. This is a-ok for now, but we'll get it sorted when it comes to time merge. Sorry for the confusion :)

@heisencoder
Copy link
Contributor Author

Looks like I've got the merge messed up right now, so I'll need to look into getting it fixed.

So, to conclude, I'm assuming that rebasing against dev/wilt-chamberlain is the best way forward? This seems to have the least friction against the pull-request system. For me, it doesn't matter too much which release this ultimately gets into, since I'm maintaining a local patch to unblock my work.

@heisencoder
Copy link
Contributor Author

In any case, version 71e3f46 has the full change in it.

Also, update test_linker.py to run under Python 2 unit tests and add
test coverage for the modified functions.

linker.py should now be compatible with both networkx-1 and -2.

This addresses #1496

This change was tested via unit tests, but was not tested via
integration tests.

As a follow-up change, core/setup.py should have its networkx dependency
updated to allow version 2.x.
@heisencoder
Copy link
Contributor Author

I think I've successfully wrestled git to now make this pull request be a single commit off of dev/wilt-chamberlain! The only thing left would be to update core/setup.py to allow for networkx version 2.x. I'm happy to make that change as a second commit in this branch depending on how this will fit into the bigger picture of dbt releases.

Please feel free to review this version. Thanks!

@heisencoder
Copy link
Contributor Author

I went ahead and bumped the networkx version in core/setup.py in change 7ed0036

@heisencoder
Copy link
Contributor Author

Looks like I need to also make some changes to test_graph.py. I'll dig in further to see what else has been affected.

Current error:
def test__model_incremental(self):
...

  self.assertEqual(linker.nodes(), [node])

E AssertionError: NodeView(('model.test_models_compile.model_one',)) != ['model.test_models_compile.model_one']

(networkx 2 is using a tuple instead of a list in this case)

@beckjake
Copy link
Contributor

beckjake commented Jun 6, 2019

Hey @heisencoder! It looks like you're seeing issues between networkx 1.11 vs 2.x - you should feel comfortable dropping support for 1.x entirely, I think that will make life easier for everyone!

@heisencoder
Copy link
Contributor Author

@beckjake -- sounds good! As I run into any other issues I'll keep that in mind.

@heisencoder
Copy link
Contributor Author

At this point, it looks like the unit tests are passing, but integration tests are failing (apparently due to set up issues). I ran the unit tests locally against networkx 1.11, and they pass with that version as well.

@beckjake beckjake self-requested a review June 10, 2019 14:15
Copy link
Contributor

@beckjake beckjake left a comment

Choose a reason for hiding this comment

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

This looks great! Non-postgres tests run on hosted cloud services that have real credentials, so they require manual review from us before they can run, hence the permissions errors.

There's one one unit test change if you would be so kind, then I'll kick off a full CI build and we can get this merged.

I'm so glad we're moving to networkx 2, thanks for your contribution!

test/unit/test_linker.py Outdated Show resolved Hide resolved
Copy link
Contributor

@beckjake beckjake left a comment

Choose a reason for hiding this comment

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

This looks great, thanks @heisencoder - I've triggered the tests, and once they pass I'll merge this in for 0.14.0!

@beckjake
Copy link
Contributor

The tests did pass, I'm not sure why but github is linking the wrong result: this is correct

@beckjake beckjake merged commit fb69b89 into dbt-labs:dev/wilt-chamberlain Jun 12, 2019
@drewbanin
Copy link
Contributor

Thanks for your contribution to dbt @heisencoder!

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