EOX GitLab Instance

Skip to content
Snippets Groups Projects
Commit a265c30e authored by Lubomir Dolezal's avatar Lubomir Dolezal
Browse files

update CI pipeline randomizing preprocessing bucket used

parent f9c43acc
No related branches found
No related tags found
1 merge request!55Production release 1.2.0
......@@ -9,8 +9,11 @@ cat $emg_db > ../env/emg_db.env
cat $emg_django > ../env/emg_django.env
cat $emg_obs > ../env/emg_obs.env
# use `pvs_testing` bucket instead
# randomize the bucket name to avoid clash of two CI pipelines (linux)
PREPROCESSOR_RESULTS_BUCKET=$(cat /proc/sys/kernel/random/uuid)
echo "PREPROCESSOR_RESULTS_BUCKET=$PREPROCESSOR_RESULTS_BUCKET" >> ../env/emg.env
# use `pvs_testing` bucket instead
sed -i -e 's/emg-data/pvs_testing/g' ../env/emg.env
sed -i -e 's/vhr18-data/pvs_testing/g' ../env/vhr18.env
......@@ -43,14 +46,13 @@ docker stack deploy -c ../docker-compose.emg.yml -c ../docker-compose.emg.dev.ym
./docker-stack-wait.sh -n renderer -n registrar -n preprocessor -n database -n sftp -n ingestor emg-pvs
# perform the testing
swift delete preprocessor_results
bash ./preprocessor_prep.sh preprocessed_list.csv
bash ./registrar_prep.sh product_list.csv
pytest registrar_test.py preprocessor_test.py renderer_test.py
if [ $? -ne 0 ]; then any_test_failed=0;fi
swift delete preprocessor_results
swift delete $PREPROCESSOR_RESULTS_BUCKET
# ingest an item
python3 ingestor_prep.py
......@@ -60,7 +62,8 @@ sleep 60
# test the existance of ingested item
pytest ingestor_test.py
if [ $? -ne 0 ]; then any_test_failed=0;fi
# cleanup
swift delete $PREPROCESSOR_RESULTS_BUCKET
for service in $(docker service ls --format "{{.Name}}"); do
docker service ps $service --no-trunc >> "$CI_PROJECT_DIR/$service.txt"
docker service logs $service --timestamps >> "$CI_PROJECT_DIR/$service.txt"
......
......@@ -19,15 +19,17 @@ def set_gdal_swift_auth():
gdal.SetConfigOption("SWIFT_STORAGE_URL", storage_url)
gdal.SetConfigOption("SWIFT_AUTH_TOKEN", auth_token)
@pytest.fixture
def list_tifs(product='KS03_AIS_PSH_1G_20160101T113020_20160101T113022_KGS_019339_75CE.tar'):
preprocessed_list = []
container = os.getenv('PREPROCESSOR_RESULTS_BUCKET')
with SwiftService() as swift:
# auth_options["prefix"] = product[0]
list_parts_gen = swift.list(
container='preprocessor_results', options= {"prefix": product[0]},
container=container, options={"prefix": product[0]},
)
for page in list_parts_gen:
if page["success"]:
......@@ -36,14 +38,14 @@ def list_tifs(product='KS03_AIS_PSH_1G_20160101T113020_20160101T113022_KGS_01933
preprocessed_list.append(item["name"])
return preprocessed_list
def test_preprocessor(list_tifs):
# check if there are preprocessed results in the buckets
# check if there are preprocessed results in the buckets
assert len(list_tifs) > 0
container = os.getenv('PREPROCESSOR_RESULTS_BUCKET')
for item in list_tifs:
set_gdal_swift_auth()
image = gdal.Open('/vsiswift/preprocessor_results/%s' % item, gdal.GA_ReadOnly)
image = gdal.Open('/vsiswift/%s/%s' % (container, item), gdal.GA_ReadOnly)
srcband = image.GetRasterBand(1)
assert srcband.Checksum() != None
assert srcband.Checksum() > 0
assert srcband.Checksum() is not None
assert srcband.Checksum() > 0
import os
import sys
import re
import csv
import pytest
import subprocess
......@@ -24,16 +23,17 @@ def set_gdal_swift_auth():
gdal.SetConfigOption("SWIFT_STORAGE_URL", storage_url)
gdal.SetConfigOption("SWIFT_AUTH_TOKEN", auth_token)
@pytest.fixture
def list_tifs(products):
preprocessed_list = []
container = os.getenv('PREPROCESSOR_RESULTS_BUCKET')
for product in products:
with SwiftService() as swift:
# auth_options["prefix"] = product[0]
list_parts_gen = swift.list(
container='preprocessor_results', options= {"prefix": product[0]},
container=container, options={"prefix": product[0]},
)
for page in list_parts_gen:
if page["success"]:
......@@ -42,14 +42,14 @@ def list_tifs(products):
preprocessed_list.append(item["name"])
return preprocessed_list
def test_preprocessor(list_tifs):
# check if there are preprocessed results in the buckets
# check if there are preprocessed results in the buckets
assert len(list_tifs) > 0
container = os.getenv('PREPROCESSOR_RESULTS_BUCKET')
for item in list_tifs:
set_gdal_swift_auth()
image = gdal.Open('/vsiswift/preprocessor_results/%s' % item, gdal.GA_ReadOnly)
image = gdal.Open('/vsiswift/%s/%s' % (container, item), gdal.GA_ReadOnly)
srcband = image.GetRasterBand(1)
assert srcband.Checksum() != None
assert srcband.Checksum() > 0
assert srcband.Checksum() is not None
assert srcband.Checksum() > 0
......@@ -22,7 +22,7 @@ target:
auth_version: !env '${ST_AUTH_VERSION}'
auth_url: !env '${OS_AUTH_URL}'
user_domain_name: !env '${OS_USER_DOMAIN_NAME}'
container: preprocessor_results # change this?
container: !env '${PREPROCESSOR_RESULTS_BUCKET}'
workdir: /tmp
keep_temp: false
metadata_glob: "*GSC*.xml"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment