From 226714b3cb98bb448f48efc9576d9a116e0e6157 Mon Sep 17 00:00:00 2001 From: Tonio Fincke Date: Wed, 1 Mar 2023 18:23:15 +0100 Subject: [PATCH 01/11] cate-1041: Writing feature collection fails --- cate/webapi/geojson.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/cate/webapi/geojson.py b/cate/webapi/geojson.py index e119b5f47..7dfadb949 100644 --- a/cate/webapi/geojson.py +++ b/cate/webapi/geojson.py @@ -276,6 +276,18 @@ def write_feature_collection(feature_collection: Union[fiona.Collection, Iterabl if num_features_written > 0: io.write(',\n') io.flush() + # fiona >=1.9 returns features of type fiona.model.Feature + # rather than JSON-serializable dictionaries. + if hasattr(feature, '__geo_interface__'): + # We fall back on the traditional geo-interface: + feature = feature.__geo_interface__ + # Fiona =1.9.0 adds empty "geometries" field + # to any "geometry", we fix this too: + geometry = feature.get('geometry') + if geometry \ + and "geometries" in geometry \ + and geometry.get("type") != "GeometryCollection": + del geometry["geometries"] if res_id is not None: feature['_resId'] = res_id feature['_idx'] = feature_index From 056e62e2e8c3c1c27512b15e23dabd2cc78ab95a Mon Sep 17 00:00:00 2001 From: Tonio Fincke Date: Wed, 1 Mar 2023 22:27:40 +0100 Subject: [PATCH 02/11] use python 39 for appveyor --- appveyor.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/appveyor.yml b/appveyor.yml index 7a211e882..8cb988989 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -3,7 +3,7 @@ version: '{build}' environment: global: - PYTHON_LOC: "C:\\Miniconda37-x64" + PYTHON_LOC: "C:\\Miniconda39-x64" install: - call %PYTHON_LOC%\Scripts\activate.bat From cfbf4f047e6be2e62a53173921942088fa6fd69b Mon Sep 17 00:00:00 2001 From: Tonio Fincke Date: Wed, 1 Mar 2023 22:39:01 +0100 Subject: [PATCH 03/11] use python 38 for appveyor --- appveyor.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/appveyor.yml b/appveyor.yml index 8cb988989..2d4d0a8b8 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -3,7 +3,7 @@ version: '{build}' environment: global: - PYTHON_LOC: "C:\\Miniconda39-x64" + PYTHON_LOC: "C:\\Miniconda38-x64" install: - call %PYTHON_LOC%\Scripts\activate.bat From 40310722229fa912ac37901ee9695fd7427d32af Mon Sep 17 00:00:00 2001 From: Tonio Fincke Date: Wed, 1 Mar 2023 22:41:09 +0100 Subject: [PATCH 04/11] revert --- appveyor.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/appveyor.yml b/appveyor.yml index 2d4d0a8b8..7a211e882 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -3,7 +3,7 @@ version: '{build}' environment: global: - PYTHON_LOC: "C:\\Miniconda38-x64" + PYTHON_LOC: "C:\\Miniconda37-x64" install: - call %PYTHON_LOC%\Scripts\activate.bat From 530fd2f1b77d43853385f537960f057c3c957e73 Mon Sep 17 00:00:00 2001 From: Tonio Fincke Date: Thu, 2 Mar 2023 10:13:46 +0100 Subject: [PATCH 05/11] updated appveyor script --- appveyor.yml | 39 ++++++++++++++++++++++++++++++--------- 1 file changed, 30 insertions(+), 9 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index 7a211e882..b2b7dbb3f 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -1,35 +1,56 @@ # version here is only relevant for the AppVeyor CI, no need to adjust version: '{build}' -environment: - global: - PYTHON_LOC: "C:\\Miniconda37-x64" +image: + - macOS + - Ubuntu2004 + +platform: + - x64 + +for: +- + matrix: + only: + - image: macOS + install: + - curl -L https://repo.continuum.io/miniconda/Miniconda3-latest-MacOSX-x86_64.sh > miniconda.sh + - bash miniconda.sh -b -p $HOME/miniconda +- + matrix: + only: + - image: Ubuntu2004 + install: + - wget https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh -O miniconda.sh + - bash miniconda.sh -b -p $HOME/miniconda install: - - call %PYTHON_LOC%\Scripts\activate.bat + - export PATH="$HOME/miniconda/bin:$PATH" + - hash -r - conda config --set always_yes yes --set changeps1 no - conda config --set channel_priority strict - conda update -q conda - conda info -a - - conda install -c conda-forge -n base mamba + - conda init bash + - export CONDA_BASE=$(conda info --base) + - conda install -c conda-forge -n base mamba pip build_script: - - call %PYTHON_LOC%\Scripts\activate.bat - git clone https://github.com/dcs4cop/xcube.git - git clone https://github.com/dcs4cop/xcube-cci.git # Install xcube env and xcube - cd xcube - mamba env create - conda activate xcube - - python setup.py develop + - pip install -e . # Install xcube-cci - cd ..\xcube-cci - mamba install -c conda-forge lxml pydap aiohttp nest-asyncio - - python setup.py develop + - pip install -e . # Install cate-specific packages - cd .. - mamba install -c conda-forge cartopy - - python setup.py develop + - pip install -e . - conda list # For the unit-tests, disable Numba JIT, otherwise Coverage wont reach the actual Python code - set NUMBA_DISABLE_JIT=1 From 915d7b2ceea67526f5de26ff9fd17a78b2be21f6 Mon Sep 17 00:00:00 2001 From: Tonio Fincke Date: Thu, 2 Mar 2023 10:26:45 +0100 Subject: [PATCH 06/11] moved section to build --- appveyor.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index b2b7dbb3f..cde6c9ead 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -24,7 +24,7 @@ for: - wget https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh -O miniconda.sh - bash miniconda.sh -b -p $HOME/miniconda -install: +build_script: - export PATH="$HOME/miniconda/bin:$PATH" - hash -r - conda config --set always_yes yes --set changeps1 no @@ -35,7 +35,6 @@ install: - export CONDA_BASE=$(conda info --base) - conda install -c conda-forge -n base mamba pip -build_script: - git clone https://github.com/dcs4cop/xcube.git - git clone https://github.com/dcs4cop/xcube-cci.git # Install xcube env and xcube From 89d6349e0ab5ea4dcf7a6547b89dbcd36ff50aa4 Mon Sep 17 00:00:00 2001 From: Tonio Fincke Date: Thu, 2 Mar 2023 10:40:13 +0100 Subject: [PATCH 07/11] added source command --- appveyor.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/appveyor.yml b/appveyor.yml index cde6c9ead..269140cb4 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -33,6 +33,7 @@ build_script: - conda info -a - conda init bash - export CONDA_BASE=$(conda info --base) + - source $CONDA_BASE/etc/profile.d/conda.sh - conda install -c conda-forge -n base mamba pip - git clone https://github.com/dcs4cop/xcube.git From 66c0af758d3227adff82943ee5fab02ac4cb882d Mon Sep 17 00:00:00 2001 From: Tonio Fincke Date: Thu, 2 Mar 2023 13:24:25 +0100 Subject: [PATCH 08/11] fix --- appveyor.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/appveyor.yml b/appveyor.yml index 269140cb4..6375d261d 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -44,7 +44,8 @@ build_script: - conda activate xcube - pip install -e . # Install xcube-cci - - cd ..\xcube-cci + - cd .. + - cd xcube-cci - mamba install -c conda-forge lxml pydap aiohttp nest-asyncio - pip install -e . # Install cate-specific packages From 8032073f08b005bb8f003b4c020c64427cd6df90 Mon Sep 17 00:00:00 2001 From: Tonio Fincke Date: Thu, 2 Mar 2023 13:55:58 +0100 Subject: [PATCH 09/11] set environment variables --- appveyor.yml | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index 6375d261d..c43ffc7b5 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -8,6 +8,16 @@ image: platform: - x64 +environment: + # For the unit-tests, disable Numba JIT, otherwise Coverage wont reach the actual Python code + NUMBA_DISABLE_JIT: 1 + # Uncomment following line if web testing on travis breaks our build + CATE_DISABLE_WEB_TESTS: 1 + # geopandas in tests break the build on appveyor (maybe the problem of gdal?) + CATE_DISABLE_GEOPANDAS_TESTS: 1 + CATE_DISABLE_PLOT_TESTS: 1 + CATE_DISABLE_CLI_UPDATE_TESTS: 1 + for: - matrix: @@ -53,12 +63,4 @@ build_script: - mamba install -c conda-forge cartopy - pip install -e . - conda list - # For the unit-tests, disable Numba JIT, otherwise Coverage wont reach the actual Python code - - set NUMBA_DISABLE_JIT=1 - # Uncomment following line if web testing on travis breaks our build - - set CATE_DISABLE_WEB_TESTS=1 - # geopandas in tests break the build on appveyor (maybe the problem of gdal?) - - set CATE_DISABLE_GEOPANDAS_TESTS=1 - - set CATE_DISABLE_PLOT_TESTS=1 - - set CATE_DISABLE_CLI_UPDATE_TESTS=1 - pytest -v --cov=cate tests From 0075743ff96b6c2b163d32f64cb2f339ab7b816d Mon Sep 17 00:00:00 2001 From: Tonio Fincke Date: Thu, 2 Mar 2023 14:48:45 +0100 Subject: [PATCH 10/11] prevent memory exhaustion during testing --- tests/ops/test_utility.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/ops/test_utility.py b/tests/ops/test_utility.py index 78119f86d..2103b5ad1 100644 --- a/tests/ops/test_utility.py +++ b/tests/ops/test_utility.py @@ -276,7 +276,7 @@ def test_alloc_memory(self): no_op(step_duration=0, num_steps=3, memory_alloc='120M') no_op(step_duration=0, num_steps=200, memory_alloc='124B') no_op(step_duration=0, num_steps=2, memory_alloc='0.1G') - no_op(step_duration=0, num_steps=1, memory_alloc='0.01T') + no_op(step_duration=0, num_steps=1, memory_alloc='0.001T') with self.assertRaises(ValueError): no_op(step_duration=0, num_steps=5, memory_alloc='x') From 96a4949ac80a807d1f287b3380730c515dace6c5 Mon Sep 17 00:00:00 2001 From: Tonio Fincke Date: Thu, 2 Mar 2023 16:20:32 +0100 Subject: [PATCH 11/11] removed reference to travis --- appveyor.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/appveyor.yml b/appveyor.yml index c43ffc7b5..436c411dc 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -11,7 +11,7 @@ platform: environment: # For the unit-tests, disable Numba JIT, otherwise Coverage wont reach the actual Python code NUMBA_DISABLE_JIT: 1 - # Uncomment following line if web testing on travis breaks our build + # Uncomment following line if web testing breaks our build CATE_DISABLE_WEB_TESTS: 1 # geopandas in tests break the build on appveyor (maybe the problem of gdal?) CATE_DISABLE_GEOPANDAS_TESTS: 1