This is an automated email from the ASF dual-hosted git repository.

lordgamez pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/nifi-minifi-cpp.git


The following commit(s) were added to refs/heads/main by this push:
     new 24c0fe072 MINIFICPP-2843 Retry downloading test llamacpp models in 
case of failure (#2197)
24c0fe072 is described below

commit 24c0fe072b6276451114e1f86fef409588ea3d6b
Author: Gabor Gyimesi <[email protected]>
AuthorDate: Fri Jun 5 14:46:22 2026 +0200

    MINIFICPP-2843 Retry downloading test llamacpp models in case of failure 
(#2197)
    
    Add exponential backoff to llamacpp model download in docker tests to
    eliminate transient download failures in test setup hook
---
 extensions/llamacpp/tests/features/environment.py       | 17 +++++++++++++----
 .../tests/features/resources/wget_with_retry.sh         | 16 ++++++++++++++++
 2 files changed, 29 insertions(+), 4 deletions(-)

diff --git a/extensions/llamacpp/tests/features/environment.py 
b/extensions/llamacpp/tests/features/environment.py
index bcef201bf..d89a597ae 100644
--- a/extensions/llamacpp/tests/features/environment.py
+++ b/extensions/llamacpp/tests/features/environment.py
@@ -28,16 +28,25 @@ from minifi_behave.core.minifi_test_context import 
MinifiTestContext
 def before_all(context: MinifiTestContext):
     minifi_container_image = get_minifi_container_image()
 
+    wget_with_retry_path = Path(__file__).resolve().parent / "resources" / 
"wget_with_retry.sh"
+    wget_with_retry_content = None
+    with open(wget_with_retry_path, "rb") as f:
+        wget_with_retry_content = f.read()
+
     dockerfile = dedent("""\
                 FROM {base_image}
-                RUN mkdir {models_path}
-                RUN wget 
https://huggingface.co/bartowski/Qwen2-VL-2B-Instruct-GGUF/resolve/main/Qwen2-VL-2B-Instruct-Q3_K_M.gguf
 --directory-prefix={models_path}
-                RUN wget 
https://huggingface.co/bartowski/Qwen2-VL-2B-Instruct-GGUF/resolve/main/mmproj-Qwen2-VL-2B-Instruct-f16.gguf
 --directory-prefix={models_path}
+                USER root
+                COPY wget_with_retry.sh /scripts/wget_with_retry.sh
+                RUN chmod 755 /scripts/wget_with_retry.sh && mkdir 
{models_path} && \\
+                    /scripts/wget_with_retry.sh 
https://huggingface.co/bartowski/Qwen2-VL-2B-Instruct-GGUF/resolve/main/Qwen2-VL-2B-Instruct-Q3_K_M.gguf
 {models_path} && \\
+                    /scripts/wget_with_retry.sh 
https://huggingface.co/bartowski/Qwen2-VL-2B-Instruct-GGUF/resolve/main/mmproj-Qwen2-VL-2B-Instruct-f16.gguf
 {models_path}
+                USER minificpp
         """.format(base_image=minifi_container_image, 
models_path='/tmp/models'))
 
     builder = DockerImageBuilder(
         image_tag="apacheminificpp:llama",
-        dockerfile_content=dockerfile
+        dockerfile_content=dockerfile,
+        files_on_context={"wget_with_retry.sh": wget_with_retry_content}
     )
     builder.build()
 
diff --git a/extensions/llamacpp/tests/features/resources/wget_with_retry.sh 
b/extensions/llamacpp/tests/features/resources/wget_with_retry.sh
new file mode 100755
index 000000000..95f768bfc
--- /dev/null
+++ b/extensions/llamacpp/tests/features/resources/wget_with_retry.sh
@@ -0,0 +1,16 @@
+#!/bin/sh
+set -u
+
+URL=$1
+DEST=$2
+
+for i in 1 2 3 4 5 6; do
+    if wget "${URL}" --directory-prefix="${DEST}"; then
+        break
+    elif [ $i -lt 6 ]; then
+        sleep $((i * 5))
+        echo "Attempt $i failed, retrying in $((i * 5))s..."
+    fi
+done
+
+[ -f "${DEST}/$(basename "${URL}")" ] || exit 1

Reply via email to