From 7a1eb4d2faafea2d4e7614a5ba91988be334194d Mon Sep 17 00:00:00 2001 From: Steffen Bollmann Date: Fri, 3 May 2024 07:00:56 +0000 Subject: [PATCH] add cdn --- run_transparent_singularity.sh | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/run_transparent_singularity.sh b/run_transparent_singularity.sh index 95b57d3..995de43 100755 --- a/run_transparent_singularity.sh +++ b/run_transparent_singularity.sh @@ -127,22 +127,34 @@ else echo "$container does not exists in cvmfs. Testing Nectar temporary Object storage next: " if curl --output /dev/null --silent --head --fail "https://object-store.rc.nectar.org.au/v1/AUTH_dead991e1fa847e3afcca2d3a7041f5d/neurodesk/temporary-builds-new/$container"; then echo "$container exists in the temporary builds nectar cache" - url="https://object-store.rc.nectar.org.au/v1/AUTH_dead991e1fa847e3afcca2d3a7041f5d/neurodesk/temporary-builds-new/" + url_nectar="https://object-store.rc.nectar.org.au/v1/AUTH_dead991e1fa847e3afcca2d3a7041f5d/neurodesk/temporary-builds-new/" fi echo "Testing standard Nectar Object storage next: " if curl --output /dev/null --silent --head --fail "https://object-store.rc.nectar.org.au/v1/AUTH_dead991e1fa847e3afcca2d3a7041f5d/neurodesk/$container"; then echo "$container exists in the standard nectar object storage" - url="https://object-store.rc.nectar.org.au/v1/AUTH_dead991e1fa847e3afcca2d3a7041f5d/neurodesk/" + url_nectar="https://object-store.rc.nectar.org.au/v1/AUTH_dead991e1fa847e3afcca2d3a7041f5d/neurodesk/" fi - if [[ -v url ]]; then + echo "Testing temporary CDN Object storage next: " + if curl --output /dev/null --silent --head --fail "https://d15yxasja65rk8.cloudfront.net/temporary-builds-new/$container"; then + echo "$container exists in the temporary builds cache" + url_cdn="https://d15yxasja65rk8.cloudfront.net/temporary-builds-new/" + fi + + echo "Testing standard Object storage next: " + if curl --output /dev/null --silent --head --fail "https://d15yxasja65rk8.cloudfront.net/$container"; then + echo "$container exists in the standard object storage" + url_cdn="https://d15yxasja65rk8.cloudfront.net/" + fi + + if [[ -v url_cdn ]]; then # echo "check if aria2 is installed ..." qq=`which aria2c` if [[ ${#qq} -lt 1 ]]; then echo "aria2 is not installed. Defaulting to curl." - urls=($url) + urls=($url_cdn $url_nectar) declare -a speeds echo "testing which server is fastest." @@ -173,7 +185,8 @@ else echo using server $url container_pull="curl -X GET ${url}${container} -O" - else # if aria2c does not exist: + else + # if aria2c does exist: container_pull="aria2c ${url}${container}" fi # end of aria2c check else # end of check if files exist in object storage