tensorflow / tfx-addons

Developers helping developers. TFX-Addons is a collection of community projects to build new components, examples, libraries, and tools for TFX. The projects are organized under the auspices of the special interest group, SIG TFX-Addons. Join the group at http://goo.gle/tfx-addons-group
Apache License 2.0
125 stars 64 forks source link

Add FirebasePublisher Implementation #175

Closed deep-diver closed 2 years ago

deep-diver commented 2 years ago

This is a draft PR. Some codes, doc-strings, and comments should be polished. Once they are done, reviews will be requested.

it is now ready. lmk if unit tests are required.

cc: @sayakpaul

github-actions[bot] commented 2 years ago

Thanks for the PR! :rocket:

Instructions: Approve using /lgtm and mark for automatic merge by using /merge.

casassg commented 2 years ago

Btw would love feedback on precommit docs at CONTRIBUTING.md to make sure they make sense

deep-diver commented 2 years ago

Thanks for the comment @casassg :) Will check out the CONTRIBUTING.md, and I will request reviews by today or tomorrow

deep-diver commented 2 years ago

@casassg

should I write unit tests? I have checked it works

casassg commented 2 years ago

Preferably some small unit tests would be great. That helps us do upgrades of dependencies while making sure it's fine. As an example, it helps us bump up what version of tfx is compatible without requiring all contributors to test their components individually for each upgrade.

deep-diver commented 2 years ago

@casassg

some tests are added

deep-diver commented 2 years ago

@sayakpaul addressed your comments :) @casassg ready to have your reviews :D

sayakpaul commented 2 years ago

@deep-diver thanks!

deep-diver commented 2 years ago

addressed your comments @casassg

casassg commented 2 years ago

Seems CI unfortunately still timesout. can you try running locally pip install --dry-run --ignore-installed -e ".[ci_min, firebase_publisher]" This will attempt to resolve the component against our lower support TFX (aka TFX 1.4). ( you may need to upgrade pip - pip install --upgrade pip in order to get --dry-run).

Guessing you may need even a lower version of firebase-admin. It seems to be conflicting with versions of shared google libraries that beam and tensorflow depend on for TFX 1.4

casassg commented 2 years ago

(also if you don't mind can you set the name of the PR to something that describes better the change? We use PR titles as release notes on release)

deep-diver commented 2 years ago

when I run pip install --dry-run --ignore-installed -e ".[ci_min, firebase_publisher]", I get the following error: ERROR: No matching distribution found for tfx<1.10.0,>=1.4.0; extra == "firebase_publisher"

casassg commented 2 years ago

What python version are you in? You may need to reduce the version of python to one that is supported by tfx 1.4

deep-diver commented 2 years ago

I was in Python 3.10, let me try with 3.8

deep-diver commented 2 years ago

I get the same errors with Python 3.6, 3.7, 3.8, 3.9

casassg commented 2 years ago

Okay, I think I found a fix. Change this in version.py

_CI_MIN_CONSTRAINTS = [
    f"tfx~={_INCLUSIVE_MIN_TFX_VERSION}", "tensorflow~=2.6.0",
    "apache-beam[gcp]<2.35", "firebase-admin<5.0.3"
]

The issue is due to https://github.com/firebase/firebase-admin-python/releases/tag/v5.0.3 adding google-api-core 2.X which breaks a lot of stuff w tfx 1.4 and similar as those were released before the 2.X changes. This triggers a tone of backtracking with pip, the fix above just basically tells our CI to bothering looking at any version of firebase_admin above 5.0.3 so it doesnt go down the rabithole of backtracking

deep-diver commented 2 years ago

great! should I fix version.py or are you going to?

casassg commented 2 years ago

you should fix it as part of the PR as otherwise CI wont let you merge it (as CI as of now its failing)

deep-diver commented 2 years ago

I am a little confused, how should I write

_CI_MIN_CONSTRAINTS = [
    f"tfx~={_INCLUSIVE_MIN_TFX_VERSION}", "tensorflow~=2.6.0",
    "apache-beam[gcp]<2.35", "firebase-admin<5.0.3"
]

into version.py ?

since other packages are already defined in _CI_MIN_CONSTRAINTS, I just need like

    "firebase_publisher":
    [f"tfx{_TFXVERSION_CONSTRAINT}", "firebase-admin>=5.0.3,<6.0.0"],

is this right?

casassg commented 2 years ago

Sorry I should have specified more. I meant if you can add "firebase-admin<5.0.3" to https://github.com/tensorflow/tfx-addons/blob/183ee57e8d28edf0252931d9f6b499f719a003da/tfx_addons/version.py#L40

You will need to leave _PKG_METADATA as is but we need modify the CI constraints in order to make sure we can test the component at all

casassg commented 2 years ago

I believe I may also be able to commit to your branch if you prefer me to do that

deep-diver commented 2 years ago

please do

casassg commented 2 years ago

this looks better now :D /lgtm

will let you merge at your own discretion (just comment the merge command to merge that should merge the code)

github-actions[bot] commented 2 years ago

Approval received from @casassg! :white_check_mark:

PR is approved. Missing merge command to auto-merge PR!

deep-diver commented 2 years ago

/merge

deep-diver commented 2 years ago

oh it looks like there is a pending review by @hanneshapke I will wait until he checks this out then. Huge thanks @casassg

github-actions[bot] commented 2 years ago

Merged with approvals from casassg - thanks for the contribution! :tada: