Skip to content

Commit

Permalink
CI: Remove useless verbosity in CI
Browse files Browse the repository at this point in the history
  • Loading branch information
remi-braun committed Dec 3, 2024
1 parent aa71515 commit 41a2472
Show file tree
Hide file tree
Showing 16 changed files with 77 additions and 35 deletions.
1 change: 1 addition & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
- FIX: Don't throw an error in case of missing cloud coverage, only a warning and set the cloud coverage to 0 [#159](https://github.com/sertit/eoreader/issues/159)
- FIX: Use the sun elevation angle rather than the sun zenith angle for STAC [#158](https://github.com/sertit/eoreader/issues/158)
- FIX: Create comparison operators for `BandNames`, removing the `xarray RuntimeWarning` about `sort order is undefined for incomparable objects`.
- CI: Remove useless verbosity in CI
- DOC: Update `conf.py` (remove useless hunks and set Sphinx 7 as base)
- DOC: Added the [PAZ product guide](https://earth.esa.int/eogateway/documents/20142/37627/PAZ-Image-Products-Guide.pdf) to the PAZ Product documentation instead of the TerraSAR-X one - by @guillemc23

Expand Down
4 changes: 3 additions & 1 deletion CI/SCRIPTS/test_bands.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
""" Script testing EOReader bands """

from CI.scripts_utils import READER, opt_path, s3_env
from CI.scripts_utils import READER, opt_path, reduce_verbosity, s3_env
from eoreader.bands import BLUE, YELLOW

reduce_verbosity()


@s3_env
def test_bands_s3_olci():
Expand Down
12 changes: 10 additions & 2 deletions CI/SCRIPTS/test_custom.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,14 @@
from rasterio.windows import Window
from sertit import ci

from CI.scripts_utils import READER, dask_env, get_db_dir, others_path, s3_env
from CI.scripts_utils import (
READER,
dask_env,
get_db_dir,
others_path,
reduce_verbosity,
s3_env,
)
from eoreader import EOREADER_NAME
from eoreader.bands import BLUE, CA, GREEN, HILLSHADE, NDVI, NIR, RED, SWIR_1
from eoreader.env_vars import DEM_PATH
Expand All @@ -16,7 +23,8 @@

LOGGER = logging.getLogger(EOREADER_NAME)

ci.reduce_verbosity()

reduce_verbosity()


@s3_env
Expand Down
5 changes: 3 additions & 2 deletions CI/SCRIPTS/test_end_to_end.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

import pytest
import xarray as xr
from sertit import AnyPath, ci, path
from sertit import AnyPath, path

from CI.scripts_utils import (
CI_EOREADER_S3,
Expand All @@ -18,6 +18,7 @@
get_db_dir,
get_db_dir_on_disk,
opt_path,
reduce_verbosity,
)
from eoreader import EOREADER_NAME
from eoreader.bands import (
Expand Down Expand Up @@ -46,7 +47,7 @@
from eoreader.products.product import Product, SensorType
from eoreader.reader import CheckMethod

ci.reduce_verbosity()
reduce_verbosity()

LOGGER = logging.getLogger(EOREADER_NAME)

Expand Down
11 changes: 9 additions & 2 deletions CI/SCRIPTS/test_index.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,22 @@
import numpy as np
from sertit import ci, rasters

from CI.scripts_utils import READER, dask_env, get_ci_data_dir, opt_path, s3_env
from CI.scripts_utils import (
READER,
dask_env,
get_ci_data_dir,
opt_path,
reduce_verbosity,
s3_env,
)
from eoreader import EOREADER_NAME
from eoreader.bands import BAI, NBR, NDVI

LOGGER = logging.getLogger(EOREADER_NAME)

RES = 2000.0 # 2000 meters

ci.reduce_verbosity()
reduce_verbosity()


@s3_env
Expand Down
5 changes: 3 additions & 2 deletions CI/SCRIPTS/test_others.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
import tempenv
import xarray as xr
from rasterio.windows import Window
from sertit import AnyPath, ci, path, unistra
from sertit import AnyPath, path, unistra

from CI.scripts_utils import (
READER,
Expand All @@ -19,6 +19,7 @@
get_db_dir_on_disk,
opt_path,
others_path,
reduce_verbosity,
s3_env,
sar_path,
)
Expand Down Expand Up @@ -64,7 +65,7 @@
from eoreader.products import SensorType
from eoreader.reader import Constellation

ci.reduce_verbosity()
reduce_verbosity()


@pytest.mark.xfail
Expand Down
4 changes: 2 additions & 2 deletions CI/SCRIPTS/test_satellites.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
get_db_dir,
get_db_dir_on_disk,
opt_path,
reduce_verbosity,
s3_env,
sar_path,
)
Expand Down Expand Up @@ -49,8 +50,7 @@
from eoreader.products import Product, SensorType, SlstrRadAdjust
from eoreader.reader import CheckMethod

ci.reduce_verbosity(["dicttoxml"])
logging.getLogger("rasterio._env").setLevel(logging.ERROR)
reduce_verbosity()

LOGGER = logging.getLogger(EOREADER_NAME)

Expand Down
7 changes: 3 additions & 4 deletions CI/SCRIPTS/test_stac_items.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,15 @@
import tempfile

import xarray as xr
from sertit import ci, s3
from sertit import s3
from tempenv import tempenv

from CI.scripts_utils import READER, compare
from CI.scripts_utils import READER, compare, reduce_verbosity
from eoreader import EOREADER_NAME
from eoreader.products import Product
from eoreader.reader import Constellation

ci.reduce_verbosity(["dicttoxml"])
logging.getLogger("rasterio._env").setLevel(logging.ERROR)
reduce_verbosity()

LOGGER = logging.getLogger(EOREADER_NAME)

Expand Down
6 changes: 3 additions & 3 deletions CI/SCRIPTS_WEEKLY/test_all_sat_end_to_end_on_disk.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

import xarray as xr
from lxml import etree
from sertit import AnyPath, ci, path, types
from sertit import AnyPath, path, types

from CI.scripts_utils import (
CI_EOREADER_S3,
Expand All @@ -17,6 +17,7 @@
get_db_dir,
get_db_dir_on_disk,
opt_path,
reduce_verbosity,
)
from eoreader import EOREADER_NAME
from eoreader.bands import (
Expand Down Expand Up @@ -53,8 +54,7 @@
from eoreader.products.product import Product, SensorType
from eoreader.reader import CheckMethod

ci.reduce_verbosity(["dicttoxml"])
logging.getLogger("rasterio._env").setLevel(logging.ERROR)
reduce_verbosity()

LOGGER = logging.getLogger(EOREADER_NAME)

Expand Down
5 changes: 2 additions & 3 deletions CI/SCRIPTS_WEEKLY/test_broken_s2.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,15 @@
import logging

import pytest
from sertit import ci

from CI.scripts_utils import READER, broken_s2_path, dask_env, s3_env
from CI.scripts_utils import READER, broken_s2_path, dask_env, reduce_verbosity, s3_env
from eoreader import EOREADER_NAME
from eoreader.bands import NIR, RED
from eoreader.exceptions import InvalidProductError

LOGGER = logging.getLogger(EOREADER_NAME)

ci.reduce_verbosity()
reduce_verbosity()


@s3_env
Expand Down
4 changes: 2 additions & 2 deletions CI/SCRIPTS_WEEKLY/test_custom.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from sertit import ci

from CI.SCRIPTS.test_custom import test_custom_invalid, test_custom_optical
from CI.scripts_utils import READER, dask_env, others_path, s3_env
from CI.scripts_utils import READER, dask_env, others_path, reduce_verbosity, s3_env
from eoreader import EOREADER_NAME
from eoreader.bands import (
BLUE,
Expand All @@ -27,7 +27,7 @@

LOGGER = logging.getLogger(EOREADER_NAME)

ci.reduce_verbosity()
reduce_verbosity()


@s3_env
Expand Down
12 changes: 10 additions & 2 deletions CI/SCRIPTS_WEEKLY/test_index.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,14 @@
import numpy as np
from sertit import ci, rasters

from CI.scripts_utils import READER, dask_env, get_ci_data_dir, opt_path, s3_env
from CI.scripts_utils import (
READER,
dask_env,
get_ci_data_dir,
opt_path,
reduce_verbosity,
s3_env,
)
from eoreader import EOREADER_NAME
from eoreader.bands import (
BAI,
Expand All @@ -28,7 +35,8 @@

RES = 2000.0 # 2000 meters

ci.reduce_verbosity()

reduce_verbosity()


@s3_env
Expand Down
4 changes: 2 additions & 2 deletions CI/SCRIPTS_WEEKLY/test_satellites.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
get_ci_data_dir,
get_db_dir_on_disk,
opt_path,
reduce_verbosity,
s3_env,
sar_path,
)
Expand Down Expand Up @@ -47,8 +48,7 @@
from eoreader.products.product import OrbitDirection
from eoreader.reader import Constellation

ci.reduce_verbosity(["dicttoxml"])
logging.getLogger("rasterio._env").setLevel(logging.ERROR)
reduce_verbosity()

LOGGER = logging.getLogger(EOREADER_NAME)

Expand Down
6 changes: 3 additions & 3 deletions CI/SCRIPTS_WEEKLY/test_stac_creation.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import pystac
import pytest
import xarray as xr
from sertit import ci, path
from sertit import path
from sertit.vectors import WGS84
from shapely.geometry import mapping

Expand All @@ -19,6 +19,7 @@
compare,
dask_env,
opt_path,
reduce_verbosity,
s3_env,
sar_path,
)
Expand Down Expand Up @@ -66,8 +67,7 @@
VIEW_SUN_ELEVATION,
)

ci.reduce_verbosity(["dicttoxml"])
logging.getLogger("rasterio._env").setLevel(logging.ERROR)
reduce_verbosity()

LOGGER = logging.getLogger(EOREADER_NAME)

Expand Down
7 changes: 3 additions & 4 deletions CI/SCRIPTS_WEEKLY/test_stac_items.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,15 @@
import xarray as xr
from botocore.exceptions import ClientError
from rasterio.windows import Window
from sertit import ci, s3
from sertit import s3
from tempenv import tempenv

from CI.scripts_utils import READER, compare
from CI.scripts_utils import READER, compare, reduce_verbosity
from eoreader import EOREADER_NAME
from eoreader.products import Product
from eoreader.reader import Constellation

ci.reduce_verbosity(["dicttoxml"])
logging.getLogger("rasterio._env").setLevel(logging.ERROR)
reduce_verbosity()

LOGGER = logging.getLogger(EOREADER_NAME)

Expand Down
19 changes: 18 additions & 1 deletion CI/scripts_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,13 @@

import logging
import os
import warnings
from functools import wraps
from typing import Callable

import rasterio
import tempenv
from sertit import AnyPath, s3, unistra
from sertit import AnyPath, ci, s3, unistra
from sertit.types import AnyPathType
from sertit.unistra import get_db2_path, get_db3_path, get_geodatastore

Expand Down Expand Up @@ -166,3 +168,18 @@ def compare(to_be_checked, ref, topic):
assert str(to_be_checked).startswith("No") and str(to_be_checked).endswith(
"available"
), f"Non equal {topic}: ref={ref} != to_be_checked={to_be_checked}"


def reduce_verbosity():
# Ignore warning
warnings.filterwarnings("ignore", category=rasterio.errors.NotGeoreferencedWarning)

# Reduce verbosity to warning
ci.reduce_verbosity(["dicttoxml", "pyogrio"])

# Errors
logging.getLogger("rasterio._env").setLevel(logging.ERROR)
logging.getLogger("urllib3.connectionpool").setLevel(logging.ERROR)

# Critical
logging.getLogger("distributed.worker").setLevel(logging.CRITICAL)

0 comments on commit 41a2472

Please sign in to comment.