Skip to content

Commit

Permalink
Update demo pipeline with the new package distribution system (#131)
Browse files Browse the repository at this point in the history
Signed-off-by: hoangtungdinh <[email protected]>
  • Loading branch information
hoangtungdinh authored Aug 22, 2024
1 parent 7b3a1c9 commit 3a8126b
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 70 deletions.
4 changes: 1 addition & 3 deletions demo_pipeline/otxBundle
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,5 @@
# with this file, You can obtain one at https://mozilla.org/MPL/2.0/.
readonly CONFIG_FILE=$1

source /app/otx-venv/bin/activate
cd /app/qc-otx
python main.py -c $CONFIG_FILE
qc_otx -c $CONFIG_FILE
cp *.xqar /app/framework/bin/
4 changes: 1 addition & 3 deletions demo_pipeline/xodrBundle
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,5 @@
# with this file, You can obtain one at https://mozilla.org/MPL/2.0/.
readonly CONFIG_FILE=$1

source /app/opendrive-venv/bin/activate
cd /app/qc-opendrive
python main.py -c $CONFIG_FILE
qc_opendrive -c $CONFIG_FILE
cp *.xqar /app/framework/bin/
4 changes: 1 addition & 3 deletions demo_pipeline/xoscBundle
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,5 @@
# with this file, You can obtain one at https://mozilla.org/MPL/2.0/.
readonly CONFIG_FILE=$1

source /app/openscenario-venv/bin/activate
cd /app/qc-openscenarioxml
python main.py -c $CONFIG_FILE
qc_openscenario -c $CONFIG_FILE
cp *.xqar /app/framework/bin/
6 changes: 2 additions & 4 deletions doc/manual/demo_pipeline.md
Original file line number Diff line number Diff line change
Expand Up @@ -154,11 +154,9 @@ docker pull ghcr.io/asam-ev/qc-framework:demo-pipeline-latest

### Local build instructions

The image can only be built on Linux. To build the Docker image locally, you can execute:

```
cd ..
The image can only be built on Linux. To build the Docker image locally, you can execute the following command from the root folder of the repository.

```bash
DOCKER_BUILDKIT=1 \
docker build \
-f docker/Dockerfile.linux \
Expand Down
77 changes: 20 additions & 57 deletions docker/Dockerfile.linux
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ RUN echo "Installing Dependencies..." && \
libqt5xmlpatterns5-dev \
libxerces-c-dev \
pkg-config \
python3.10-venv \
python3-pip \
git && \
echo "Dependencies installed."

Expand Down Expand Up @@ -51,44 +51,22 @@ RUN echo "Building framework..." && \
echo "Done."


# Clone, configure venv, install by copying bash script to install dir - OpenSCENARIO
RUN git clone --single-branch --branch develop https://github.com/asam-ev/qc-openscenarioxml.git && \
python3 -m venv openscenario-venv && \
source openscenario-venv/bin/activate && \
python3 -m pip install --no-cache-dir -r qc-openscenarioxml/requirements.txt && \
chmod +x /app/demo_pipeline/xoscBundle && \
# Copy bash script to install dir - OpenSCENARIO + OpenDRIVE + OTX
RUN chmod +x /app/demo_pipeline/xoscBundle && \
cp /app/demo_pipeline/xoscBundle /home/root/qc-build/bin/xoscBundle && \
rm -rf /app/qc-openscenarioxml/.git

# Clone, configure venv, install by copying bash script to install dir - OpenDRIVE
RUN git clone --single-branch --branch develop https://github.com/asam-ev/qc-opendrive.git && \
python3 -m venv opendrive-venv && \
source opendrive-venv/bin/activate && \
python3 -m pip install --no-cache-dir -r qc-opendrive/requirements.txt && \
chmod +x /app/demo_pipeline/xodrBundle && \
cp /app/demo_pipeline/xodrBundle /home/root/qc-build/bin/xodrBundle && \
rm -rf /app/qc-opendrive/.git

# Clone, configure venv, install by copying bash script to install dir - OTX
RUN git clone --single-branch --branch develop https://github.com/asam-ev/qc-otx.git && \
python3 -m venv otx-venv && \
source otx-venv/bin/activate && \
python3 -m pip install --no-cache-dir -r qc-otx/requirements.txt && \
chmod +x /app/demo_pipeline/otxBundle && \
cp /app/demo_pipeline/otxBundle /home/root/qc-build/bin/otxBundle && \
rm -rf /app/qc-otx/.git

# Create and setup demo and runtime virtual envs
RUN python3 -m venv demo-pipeline-venv && \
source demo-pipeline-venv/bin/activate && \
python3 -m pip install --no-cache-dir -r /app/demo_pipeline/requirements.txt

RUN python3 -m venv runtime-venv && \
source runtime-venv/bin/activate && \
python3 -m pip install --no-cache-dir -r /app/framework/runtime/requirements.txt


# Runtime stage
cp /app/demo_pipeline/otxBundle /home/root/qc-build/bin/otxBundle

RUN python3 -m pip install --no-cache-dir -r /app/demo_pipeline/requirements.txt && \
python3 -m pip install --no-cache-dir -r /app/framework/runtime/requirements.txt && \
python3 -m pip install asam-qc-opendrive@git+https://github.com/asam-ev/qc-opendrive@develop && \
python3 -m pip install asam-qc-openscenarioxml@git+https://github.com/asam-ev/qc-openscenarioxml@develop && \
python3 -m pip install asam-qc-otx@git+https://github.com/asam-ev/qc-otx@develop


# Runtime test stage
FROM ubuntu:22.04 as runtime_test

# Dependancies installation currently required by ResultPooling and TextReport modules
Expand All @@ -109,14 +87,15 @@ COPY --from=framework_builder /home/root/qc-build/bin /app/framework/bin
COPY --from=framework_builder /app/framework/build/test /app/framework/test
# @NOTE this is just because DemoCheckerBundle is not installed by default
COPY --from=framework_builder /app/framework/build/examples/checker_bundle_example/DemoCheckerBundle /app/framework/bin/
# Virtual envs
COPY --from=framework_builder /app/runtime-venv /app/runtime-venv

WORKDIR /app/framework/runtime/

SHELL ["/bin/bash", "-c"]

CMD source /app/runtime-venv/bin/activate && python3 -m pytest -rA > runtime_test.log && cp /app/framework/runtime/runtime_test.log /out/runtime_test.log
COPY --from=framework_builder /usr/local/lib/python3.10/dist-packages /usr/local/lib/python3.10/dist-packages
COPY --from=framework_builder /usr/local/bin /usr/local/bin

CMD python3 -m pytest -rA > runtime_test.log && cp /app/framework/runtime/runtime_test.log /out/runtime_test.log

# Runtime stage
FROM framework_builder as unit_test
Expand All @@ -137,13 +116,6 @@ RUN apt update && apt install -y \

RUN mkdir -p /app

# Virtual envs
COPY --from=framework_builder /app/runtime-venv /app/runtime-venv
COPY --from=framework_builder /app/demo-pipeline-venv /app/demo-pipeline-venv
COPY --from=framework_builder /app/opendrive-venv /app/opendrive-venv
COPY --from=framework_builder /app/openscenario-venv /app/openscenario-venv
COPY --from=framework_builder /app/otx-venv /app/otx-venv

# Framework components
COPY --from=framework_builder /home/root/qc-build/bin /app/framework/bin
COPY --from=framework_builder /app/demo_pipeline /app/demo_pipeline
Expand All @@ -152,18 +124,9 @@ COPY --from=framework_builder /app/framework/runtime /app/framework/runtime
# Framework schemas
COPY --from=framework_builder /app/framework/doc/schema /app/framework/doc/schema

# OpenScenario XML checker bundle
COPY --from=framework_builder /app/qc-openscenarioxml/main.py /app/qc-openscenarioxml/main.py
COPY --from=framework_builder /app/qc-openscenarioxml/qc_openscenario /app/qc-openscenarioxml/qc_openscenario

# OpenDrive XML checker bundle
COPY --from=framework_builder /app/qc-opendrive/main.py /app/qc-opendrive/main.py
COPY --from=framework_builder /app/qc-opendrive/qc_opendrive /app/qc-opendrive/qc_opendrive

# OTX XML checker bundle
COPY --from=framework_builder /app/qc-otx/main.py /app/qc-otx/main.py
COPY --from=framework_builder /app/qc-otx/qc_otx /app/qc-otx/qc_otx
COPY --from=framework_builder /usr/local/lib/python3.10/dist-packages /usr/local/lib/python3.10/dist-packages
COPY --from=framework_builder /usr/local/bin /usr/local/bin

SHELL ["/bin/bash", "-c"]

CMD source /app/demo-pipeline-venv/bin/activate && /app/demo_pipeline/run_pipeline.sh
CMD /app/demo_pipeline/run_pipeline.sh

0 comments on commit 3a8126b

Please sign in to comment.