-
Notifications
You must be signed in to change notification settings - Fork 2
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
Don't Install Tableau API on arm64 #218
Conversation
.envrc
Outdated
export BUILDPLATFORM=$(uname -m) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is passed to docker compose, which passes it to the dockerfile, which uses it to install tableau deps or not.
docker-compose.yml
Outdated
args: | ||
BUILDPLATFORM: $BUILDPLATFORM |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pass arg to dockerfile which is used to install poetry or not.
python_src/Dockerfile
Outdated
# Tableau dependencies for arm64 cannot be resolved (since salesforce doesn't | ||
# support them yet). For that buildplatform build without those dependencies | ||
ARG BUILDPLATFORM | ||
RUN echo "Installing python dependencies for ${BUILDPLATFORM}." | ||
RUN if [ "$BUILDPLATFORM" = "arm64" ]; then \ | ||
poetry install --without tableau --no-interaction --no-ansi -v ;\ | ||
else poetry install --no-interaction --no-ansi -v ;\ | ||
fi |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if its an arm64 build platform, install without the tableau dep group.
@@ -27,10 +27,15 @@ psutil = "^5.9.1" | |||
schedule = "^1.1.0" | |||
alembic = "^1.10.2" | |||
types-pytz = "^2023.3.0.1" | |||
|
|||
[tool.poetry.group.tableau] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
add dependency group for tableau dependencies. its not optional, meaning a user will have to change behavior to build without it.
@@ -1 +1,21 @@ | |||
"""Utilites for Interacting with Tableau and Hyper files""" | |||
"""Utilities for Interacting with Tableau and Hyper files""" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
update the tableau init file to catch exceptions when the tableau modues arent found.
from lamp_py.tableau.pipeline import start_parquet_updates | ||
from lamp_py.tableau import start_parquet_updates |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is the only part i don't like. if we import directly from the file we're doing to get the import error and it felt like catch that error should be left to the subdir.
The tableauhyperapi module is unavailable on mac with arm64 processors. * Update poetry to take advantage of dependency groups. * Add a tableau dependency group that can be excluded when installing dependencies. * Update python_src to fallback with error messages when using the tableau subdir that creates hyperfiles fails to import everything. * Use new `BUILDPLATFORM` arg in dockerfile to build without tableau deps on an arm64 platform. * Add an export for the BUILDPLATFORM variable to .envrc and pass it through via docker-compose when building the lamp py images.
89662bd
to
39a5843
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This all looks like it's functioning as expected for me locally.
I think we need to add some documentation regarding why/how we are doing this in a README file. We are also missing a README for the "tableau" applications, which is my oversight when originally adding that functionality.
@paulswartz Could you also please review this approach and see if you can find any potential issues with this approach? Are any other TID apps doing anything similar with a different approach?
.envrc
Outdated
|
||
# used in dockercompose and dockerfile | ||
export BUILDPLATFORM=$(uname -m) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
question: Do you need to set this? At least according to the Docker documentation this should be provided already.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i tried this out locally based on this same documentation and found that the value evaluated to an empty string when I ran on my machine.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This diff worked for me without needing to set any additional variables:
diff --git a/python_src/Dockerfile b/python_src/Dockerfile
index 06a3e1e..40d69a6 100644
--- a/python_src/Dockerfile
+++ b/python_src/Dockerfile
@@ -25,9 +25,9 @@ COPY pyproject.toml pyproject.toml
# Tableau dependencies for arm64 cannot be resolved (since salesforce doesn't
# support them yet). For that buildplatform build without those dependencies
-ARG BUILDPLATFORM
-RUN echo "Installing python dependencies for ${BUILDPLATFORM}."
-RUN if [ "$BUILDPLATFORM" = "arm64" ]; then \
+ARG TARGETARCH BUILDPLATFORM TARGETPLATFORM
+RUN echo "Installing python dependencies for build: ${BUILDPLATFORM} target: ${TARGETPLATFORM}"
+RUN if [ "$TARGETARCH" = "arm64" ]; then \
poetry install --without tableau --no-interaction --no-ansi -v ;\
else poetry install --no-interaction --no-ansi -v ;\
fi
@@ -1 +1,29 @@ | |||
"""Utilites for Interacting with Tableau and Hyper files""" | |||
"""Utilities for Interacting with Tableau and Hyper files""" | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
suggestion(non-blocking):
try:
import .pipeline as pipeline
except ModuleNotFoundError:
pipeline = None
def start_parquet_updates(db_manager: DatabaseManager) -> None
if pipeline is None:
logging.exception(...)
else:
pipeline.start_parquet_updates(db_manager)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oh. i like this much better.
20fcbba
to
fa19ad6
Compare
* Change some of the details in the tableau __init__ file. * No need to pass in build platform arg. remove from direnv and docker-compose.
fa19ad6
to
1bdb816
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, working locally for me.
The tableauhyperapi module is unavailable on mac with arm64 processors.
BUILDPLATFORM
arg in dockerfile to build without tableau deps on an arm64 platform.Asana Task: <asana_ticket_url>