I've hit a problem with dockerized Apache Beam. When trying to run the container I am getting "No id provided." message and nothing more. Here's the code and files:
Dockerfile
FROM apache/beam_python3.8_sdk:latest
RUN apt update
RUN apt install -y wget curl unzip git
COPY ./ /root/data_analysis/
WORKDIR /root/data_analysis
RUN python3 -m pip install -r data_analysis/beam/requirements.txt
ENV PYTHONPATH=/root/data_analysis
ENV WORKER_ID=1
CMD python3 data_analysis/analysis.py
Code analysis.py :
import apache_beam as beam
from apache_beam.options.pipeline_options import PipelineOptions
def run():
options = PipelineOptions(["--runner=DirectRunner"])
with beam.Pipeline(options=options) as p:
p | beam.Create([1, 2, 3]) | beam.Map(lambda x: x-1) | beam.Map(print)
if __name__ == "__main__":
run()
Commands:
% docker build -f Dockerfile_beam -t beam .
[+] Building 242.2s (12/12) FINISHED
...
% docker run --name=beam beam
2021/09/15 13:44:07 No id provided.
I found that this error message is most likely generated by this line: https://github.com/apache/beam/blob/410ad7699621e28433d81809f6b9c42fe7bd6a60/sdks/python/container/boot.go#L98
But what does it mean? Which id is this? What am I missing?