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

python_template_launcher.go:37: Failed to initialize fluentd logger #13213

Open
pbonito opened this issue Mar 6, 2025 · 3 comments
Open

python_template_launcher.go:37: Failed to initialize fluentd logger #13213

pbonito opened this issue Mar 6, 2025 · 3 comments
Assignees
Labels
priority: p2 Moderately-important priority. Fix may not be included in next release. samples Issues that are directly related to samples. triage me I really want to be triaged. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns.

Comments

@pbonito
Copy link

pbonito commented Mar 6, 2025

In which file did you encounter the issue?

python-docs-samples/dataflow/flex-templates/pipeline_with_dependencies

Did you change the file? If so, how?

Yes, used a different base image in docker file

Describe the issue

Jon start but I got following error:
2025/03/06 17:38:45.885541 python_template_launcher.go:37: Failed to initialize fluentd logger: failed to create log file /var/log/dataflow/template_launcher/runner-json.log: open /var/log/dataflow/template_launcher/runner-json.log: permission denied

python_template_launcher fails if running with non root user or an user that have no write access to /var/log

@pbonito pbonito added priority: p2 Moderately-important priority. Fix may not be included in next release. triage me I really want to be triaged. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns. labels Mar 6, 2025
@product-auto-label product-auto-label bot added the samples Issues that are directly related to samples. label Mar 6, 2025
@iennae
Copy link
Contributor

iennae commented Mar 8, 2025

Thanks @pbonito. Can you share more details about your Dockerfile configuration? which base image are you using?

@pbonito
Copy link
Author

pbonito commented Mar 8, 2025

This is an example, my real image is hardened and running with nonroot user and no access to /var/log.

FROM nvcr.io/nvidia/cuda:12.6.1-cudnn-devel-ubuntu24.04

ARG WORKDIR=/template
WORKDIR ${WORKDIR}

COPY requirements.txt .
COPY .py ./
RUN apt-get update
# Install Python and other system dependencies.
&& apt-get install -y --no-install-recommends software-properties-common
&& add-apt-repository ppa:deadsnakes/ppa -y
&& apt-get install -y --no-install-recommends
curl g++ python3.11-dev python3.11-venv apt-transport-https ca-certificates gnupg
&& rm -rf /var/lib/apt/lists/

&& update-alternatives --install /usr/bin/python python /usr/bin/python3.11 11
&& curl https://bootstrap.pypa.io/get-pip.py | python
# Install the pipeline requirements.
&& pip install --no-cache-dir -r requirements.txt
&& pip check

COPY --from=gcr.io/cloud-dataflow/v1beta3/beam_python3.11_sdk:2.61.0 /opt/apache/beam /opt/apache/beam
COPY --from=gcr.io/dataflow-templates-base/python311-template-launcher-base:latest /opt/google/dataflow/python_template_launcher /opt/google/dataflow/python_template_launcher

COPY main.py .
COPY pyproject.toml .
COPY setup.py .
COPY src src

RUN pip install .
ENV FLEX_TEMPLATE_PYTHON_PY_FILE="${WORKDIR}/main.py"
RUN pip freeze
RUN pip list

ENTRYPOINT [ "/opt/apache/beam/boot" ]

@iennae
Copy link
Contributor

iennae commented Mar 13, 2025

@pbonito thanks so much for the information. I can see the challenge with the current sample for custom Docker images. We're investigating what the right path is here. If you have a support contract with Google, please create an issue in the support console as well. Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
priority: p2 Moderately-important priority. Fix may not be included in next release. samples Issues that are directly related to samples. triage me I really want to be triaged. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns.
Projects
None yet
Development

No branches or pull requests

3 participants