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

Fix openr.thrift Python Module Build #96

Closed
wants to merge 2 commits into from

Conversation

MatthewWEdwards
Copy link
Contributor

@MatthewWEdwards MatthewWEdwards commented May 21, 2021

[Open/R] Fix openr.thrift Python Module Build

Description:

  • Build cython thrift py3 clients etc.

Fixes #72

cooperlees and others added 2 commits May 21, 2021 14:35
- Add a build_breeze.sh
- Have a Docker file that only builds breeze
  - Make both Docker files use new build_breeze.sh so there is no copy pasta
- Make a common.sh shareing what common code we can
- Refactor thrift install into a seperate Docker step + scripts (out of setup.py)
- Generate mstch_cpp2 + mstch_py3

TODO: Workout how to use cython to compule thrift.py.* + openr.thrift.* .so's

Test Plan:
- Bulld both containers
- `breeze --help`
Summary:
Add Dockerfile build for openr.thrift python module.

The python module is built by:
1. Building and installing Facebook libraries with fbcode_builder
2. Building Open/R
3. Generating Cython files from thrift files with the FB thrift compiler
4. Generating C++ files from the Cython modules with the Cython compiler
5. Compiling the C++ modules into shared objects

Future work for building and distributing Breeze:

- Fix the hacks in build_breeze.sh, see comments therein
- Use a staged Dockerfile build for the Open/R and Breeze build
- Install openr.thrift. The openr.thrift shared objects are build and
  stored in the Docker image generated by Dockerfile, but are unused.
- Install all the openr python submodules in a single openr site-package
- Add cross-compilation to the openr.thrift build. This is needed for
  Terragraph
- Upload the openr python package to PyPi
Copy link
Contributor

@cooperlees cooperlees left a comment

Choose a reason for hiding this comment

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

LGTM - Going to pull into Facebook to run CI there and hope we don't break anything.


# Cleanup all we can to keep container as lean as possible
# TODO: We can use Dockerfile stages instead
Copy link
Contributor

Choose a reason for hiding this comment

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

Yeah we really need to do this. Our image is way to big.

[
"cython3",
"--fast-fail",
"-3",
Copy link
Contributor

Choose a reason for hiding this comment

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

Why is this even an option anymore :P

if not fb303_py_pacakge_path.exists():
fb303_py_pacakge_path.symlink_to(fb_fb303_path)

# TODO: Build thrift.py + py3 fb303 libraries ... :|
Copy link
Contributor

Choose a reason for hiding this comment

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

Remove / make accurate statement?

@cooperlees cooperlees requested a review from zsol May 21, 2021 21:26
@facebook-github-bot
Copy link
Contributor

@cooperlees has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.

@cooperlees
Copy link
Contributor

This is merged FB OSS team ... :\

@cooperlees
Copy link
Contributor

cooperlees commented May 27, 2021

Closing (as it's merged) - I screwed up internal tooling editing commit mesages.

@cooperlees cooperlees closed this May 27, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

FBThrift 'py3' support needed: No module named 'openr.thrift'
3 participants