retry_env.sh 950 Bytes
Newer Older
yyy's avatar
yyy committed
1
2
3
4
5
6
7
#!/bin/bash

max_retries=5
retry_count=0

while true; do
    # prepare env
yyy's avatar
yyy committed
8
    #python -m pip install -r requirements-qa.txt
9
    python -m pip install -U magic-pdf[full] --extra-index-url https://wheels.myhloli.com -i https://mirrors.aliyun.com/pypi/simple
yyy's avatar
yyy committed
10
    python -m pip install paddlepaddle-gpu==3.0.0b1 -i https://www.paddlepaddle.org.cn/packages/stable/cu118/
quyuan's avatar
quyuan committed
11
12
13
    pip install modelscope
    wget https://gitee.com/myhloli/MinerU/raw/master/scripts/download_models.py -O download_models.py
    python download_models.py
yyy's avatar
yyy committed
14
15
16
17
18
19
20
21
22
23
24
    exit_code=$?
    if [ $exit_code -eq 0 ]; then
        echo "test.sh 成功执行!"
        break
    else
        let retry_count+=1
        if [ $retry_count -ge $max_retries ]; then
            echo "达到最大重试次数 ($max_retries),放弃重试。"
            exit 1
        fi
        echo "test.sh 执行失败 (退出码: $exit_code)。尝试第 $retry_count 次重试..."
yyy's avatar
yyy committed
25
        sleep 5
yyy's avatar
yyy committed
26
27
    fi
done