Skip to content

Commit 3b0658f

Browse files
authored
[video bricks] Add restart wrapper (#28)
1 parent 4d7b991 commit 3b0658f

File tree

7 files changed

+42
-8
lines changed

7 files changed

+42
-8
lines changed

containers/ei-models-runner/Dockerfile

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,16 +10,18 @@ RUN set -ex; \
1010
groupadd -g 29 audio || true; \
1111
groupadd -g 991 render || true; \
1212
groupadd -g 1000 arduino || true; \
13-
useradd -u 1000 -g arduino -G audio,video,render -ms /bin/bash arduino;
13+
useradd -u 1000 -g arduino -G audio,video,render -ms /bin/bash arduino
1414

1515
# Add all EI OOTB models to the container with specific ownership
1616
COPY --chown=arduino:arduino ./models/ei-ootb-models/arm64/* /models/ootb/ei/
17+
COPY --chown=arduino:arduino ./src/start-runner.sh /home/arduino/start-runner.sh
1718

18-
USER arduino
19-
20-
WORKDIR /app
19+
RUN chmod +x /home/arduino/start-runner.sh
2120

21+
WORKDIR /home/arduino
2222
ENV HOME=/home/arduino
23+
24+
USER arduino
2325
ENV USER=arduino
2426

25-
ENTRYPOINT ["node", "/app/linux/node/build/cli/linux/runner.js"]
27+
ENTRYPOINT ["/home/arduino/start-runner.sh"]
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
#!/bin/bash
2+
3+
# SPDX-FileCopyrightText: Copyright (C) ARDUINO SRL (http://www.arduino.cc)
4+
#
5+
# SPDX-License-Identifier: MPL-2.0
6+
7+
NODE_COMMAND=("node" "/app/linux/node/build/cli/linux/runner.js" "$@")
8+
9+
trap_signal() {
10+
echo "Caught signal $1. Exiting wrapper immediately..."
11+
exit 0
12+
}
13+
14+
trap 'trap_signal TERM' TERM
15+
trap 'trap_signal INT' INT
16+
17+
while true; do
18+
echo "🚀 Starting EI inference runner..."
19+
20+
"${NODE_COMMAND[@]}"
21+
22+
EXIT_CODE=$?
23+
24+
# Check the exit code
25+
if [ $EXIT_CODE -eq 0 ]; then
26+
echo "✅ Application exited successfully (Exit Code: 0). Stopping restart loop."
27+
break
28+
else
29+
echo "⚠️ Application exited with error (Exit Code: $EXIT_CODE). Restarting in 1 seconds..."
30+
sleep 1
31+
fi
32+
done

src/arduino/app_bricks/streamlit_ui/addons.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ def arduino_header(title: str):
3131
3232
Additionally, custom components like `st.arduino_header()` are provided to streamline Arduino integration.
3333
"""
34-
svg_path = os.path.join(os.path.dirname(__file__), "assets", "RGB-Arduino-Logo_Color Inline Loop.svg")
34+
svg_path = os.path.join(os.path.dirname(__file__), "assets", "RGB-Arduino-Logo-Color-Inline-Loop.svg")
3535
svg_path = os.path.abspath(svg_path)
3636
try:
3737
with open(svg_path, "r", encoding="utf-8") as f:

src/arduino/app_bricks/streamlit_ui/assets/RGB-Arduino-Logo_Color Inline Loop.svg renamed to src/arduino/app_bricks/streamlit_ui/assets/RGB-Arduino-Logo-Color-Inline-Loop.svg

File renamed without changes.

src/arduino/app_bricks/streamlit_ui/assets/RGB-Arduino-Logo_Color Inline Loop.svg.license renamed to src/arduino/app_bricks/streamlit_ui/assets/RGB-Arduino-Logo-Color-Inline-Loop.svg.license

File renamed without changes.

src/arduino/app_utils/ledmatrix.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# SPDX-FileCopyrightText: Copyright (C) 2025 ARDUINO SA <http://www.arduino.cc>
1+
# SPDX-FileCopyrightText: Copyright (C) ARDUINO SRL (http://www.arduino.cc)
22
#
33
# SPDX-License-Identifier: MPL-2.0
44

tests/arduino/app_utils/ledmatrix/test_frame.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# SPDX-FileCopyrightText: Copyright (C) 2025 ARDUINO SA <http://www.arduino.cc>
1+
# SPDX-FileCopyrightText: Copyright (C) ARDUINO SRL (http://www.arduino.cc)
22
#
33
# SPDX-License-Identifier: MPL-2.0
44

0 commit comments

Comments
 (0)