Skip to content

Benchmark: max_ndvi #646

Description

@github-actions

Benchmark scenario ID: max_ndvi
Benchmark scenario definition: https://github.com/ESA-APEx/apex_algorithms/blob/5a07db738153cddebaae8a8539b43591dc60fca5/algorithm_catalog/vito/max_ndvi/benchmark_scenarios/max_ndvi.json
openEO backend: openeofed.dataspace.copernicus.eu

GitHub Actions workflow run: https://github.com/ESA-APEx/apex_algorithms/actions/runs/31714894906
Workflow artifacts: https://github.com/ESA-APEx/apex_algorithms/actions/runs/31714894906#artifacts

Test start: 2026-08-13 15:23:49.428464+00:00
Test duration: 0:01:55.632526
Test outcome: ❌ failed

Last successful test phase: download-reference
Failure in test phase: compare:derived_from-change

Process Graph

{
  "maxndvi1": {
    "process_id": "max_ndvi",
    "namespace": "https://raw.githubusercontent.com/ESA-APEx/apex_algorithms/11c27fb1a90cfc8f2eb285b881d1db8a96c358f4/openeo_udp/examples/max_ndvi/max_ndvi.json",
    "arguments": {
      "bbox": {
        "west": 5.07,
        "east": 5.09,
        "south": 51.21,
        "north": 51.23
      },
      "temporal_extent": [
        "2023-08-01",
        "2023-09-30"
      ]
    },
    "result": true
  }
}

Error Logs

scenario = BenchmarkScenario(id='max_ndvi', description='max_ndvi example', backend='openeofed.dataspace.copernicus.eu', process_...'/home/runner/work/apex_algorithms/apex_algorithms/algorithm_catalog/vito/max_ndvi/benchmark_scenarios/max_ndvi.json'))
connection_factory = <function connection_factory.<locals>.get_connection at 0x7fb9e7401d00>
tmp_path = PosixPath('/home/runner/work/apex_algorithms/apex_algorithms/qa/benchmarks/tmp_path_root/test_run_benchmark_max_ndvi_0')
track_metric = <function track_metric.<locals>.track at 0x7fb9e7401bc0>
track_phase = <apex_algorithm_qa_tools.pytest.pytest_track_metrics._PhaseTracker object at 0x7fb9e7416300>
upload_assets_on_fail = <apex_algorithm_qa_tools.pytest.pytest_upload_assets.upload_assets_on_fail.<locals>._Collector object at 0x7fb9e7414d70>
request = <FixtureRequest for <Function test_run_benchmark[max_ndvi]>>

    @pytest.mark.parametrize(
        "scenario",
        [
            # Use scenario id as parameterization id to give nicer test names.
            pytest.param(uc, id=uc.id)
            for uc in get_benchmark_scenarios()
        ],
    )
    def test_run_benchmark(
        scenario: BenchmarkScenario,
        connection_factory,
        tmp_path: Path,
        track_metric,
        track_phase,
        upload_assets_on_fail,
        request,
    ):
        track_metric("scenario_id", scenario.id)

        with track_phase(phase="connect"):
            # Check if a backend override has been provided via cli options.
            override_backend = request.config.getoption("--override-backend")
            backend_filter = request.config.getoption("--backend-filter")
            if backend_filter and not re.match(backend_filter, scenario.backend):
                # TODO apply filter during scenario retrieval, but seems to be hard to retrieve cli param
                pytest.skip(
                    f"skipping scenario {scenario.id} because backend {scenario.backend} does not match filter {backend_filter!r}"
                )
            backend = scenario.backend
            if override_backend:
                _log.info(f"Overriding backend URL with {override_backend!r}")
                backend = override_backend

            connection: openeo.Connection = connection_factory(url=backend)

        report_path = None
        if request.config.getoption("--upload-benchmark-report"):
            report_path = tmp_path / "benchmark_report.json"
            report_path.write_text(json.dumps({
                "scenario_id": scenario.id,
                "scenario_description": scenario.description,
                "scenario_backend": scenario.backend,
                "scenario_source": str(scenario.source) if scenario.source else None,
                "reference_data": scenario.reference_data,
                "reference_options": scenario.reference_options,
            }, indent=2))
            upload_assets_on_fail(report_path)

        def _on_phase_exception(phase: str, exc: Exception):
            if report_path is not None:
                report = json.loads(report_path.read_text())
                report["test_failed"] = True
                report["test_failed_phase"] = phase
                report["test_error_message"] = str(exc)
                report_path.write_text(json.dumps(report, indent=2))
                cwd_report_dir = Path("benchmark_reports")
                cwd_report_dir.mkdir(exist_ok=True)
                (cwd_report_dir / f"{scenario.id}_benchmark_report.json").write_text(
                    json.dumps(report, indent=2)
                )
                report_url = upload_assets_on_fail.get_url(report_path)
                if report_url:
                    exc.add_note(f"Benchmark report: {report_url}")

        track_phase.on_exception = _on_phase_exception

        with track_phase(phase="create-job"):
            # TODO #14 scenario option to use synchronous instead of batch job mode?
            job = connection.create_job(
                process_graph=scenario.process_graph,
                title=f"APEx benchmark {scenario.id}",
                additional=scenario.job_options,
            )
            track_metric("job_id", job.job_id)

            if report_path is not None:
                report = json.loads(report_path.read_text())
                report["job_id"] = job.job_id
                report_path.write_text(json.dumps(report, indent=2))

        with track_phase(phase="run-job"):
            # TODO: monitor timing and progress
            # TODO: separate "job started" and run phases?
            max_minutes = request.config.getoption("--maximum-job-time-in-minutes")
            if max_minutes:
                def _timeout_handler(signum, frame):
                    raise TimeoutError(
                        f"Batch job {job.job_id} exceeded maximum allowed time of {max_minutes} minutes"
                    )

                old_handler = signal.signal(signal.SIGALRM, _timeout_handler)
                signal.alarm(max_minutes * 60)
            try:
                job.start_and_wait()
            finally:
                if max_minutes:
                    signal.alarm(0)
                    signal.signal(signal.SIGALRM, old_handler)

        with track_phase(phase="collect-metadata"):
            collect_metrics_from_job_metadata(job, track_metric=track_metric)

            results = job.get_results()
            collect_metrics_from_results_metadata(results, track_metric=track_metric)

        with track_phase(phase="download-actual"):
            # Download actual results
            actual_dir = tmp_path / "actual"
            paths = results.download_files(target=actual_dir, include_stac_metadata=True)

            # Upload assets on failure
            upload_assets_on_fail(*paths)

        # Pre-compute S3 URLs for actual files (used in error messages and benchmark reports)
        actual_s3_urls = {
            str(p.relative_to(actual_dir)): upload_assets_on_fail.get_url(p)
            for p in sorted(actual_dir.rglob("*")) if p.is_file()
        }
        actual_s3_urls = {k: v for k, v in actual_s3_urls.items() if v is not None}

        with track_phase(phase="download-reference"):
            reference_dir = download_reference_data(
                scenario=scenario, reference_dir=tmp_path / "reference"
            )

        if report_path is not None:
            report = json.loads(report_path.read_text())
            report["actual_files"] = {
                str(p.relative_to(actual_dir)): f"{p.stat().st_size / 1024:.1f} kb"
                for p in sorted(actual_dir.rglob("*")) if p.is_file()
            }
            ref_files = {}
            for p in sorted(reference_dir.rglob("*")):
                if not p.is_file():
                    continue
                rel = p.relative_to(reference_dir)
                size_str = f"{p.stat().st_size / 1024:.1f} kb"
                actual_counterpart = actual_dir / rel
                if not actual_counterpart.exists():
                    size_str += " (missing in actual)"
                elif actual_counterpart.stat().st_size != p.stat().st_size:
                    size_str += f" (actual: {actual_counterpart.stat().st_size / 1024:.1f} kb)"
                ref_files[str(rel)] = size_str
            report["reference_files"] = ref_files
            if actual_s3_urls:
                report["actual_data"] = actual_s3_urls
            report_path.write_text(json.dumps(report, indent=2))
            # Also write to CWD so the report is accessible on Jenkins workspace
            cwd_report_dir = Path("benchmark_reports")
            cwd_report_dir.mkdir(exist_ok=True)
            (cwd_report_dir / f"{scenario.id}_benchmark_report.json").write_text(
                json.dumps(report, indent=2)
            )

        with track_phase(
            phase="compare", describe_exception=analyse_results_comparison_exception
        ):
            # Compare actual results with reference data
            try:
                assert_job_results_allclose(
                    actual=actual_dir,
                    expected=reference_dir,
                    tmp_path=tmp_path,
                    rtol=scenario.reference_options.get("rtol", 1e-3),
                    atol=scenario.reference_options.get("atol", 1),
                    pixel_tolerance=scenario.reference_options.get("pixel_tolerance", 1),
                )
            except AssertionError as e:
                msg = str(e)
                if scenario.reference_data:
                    msg += "\n\nReference data URLs:"
                    for name, url in scenario.reference_data.items():
                        msg += f"\n  {name}: {url}"
                if actual_s3_urls:
                    msg += "\n\nActual data S3 URLs (uploaded on failure):"
                    for name, url in actual_s3_urls.items():
                        msg += f"\n  {name}: {url}"
>               raise AssertionError(msg) from None
E               AssertionError: File set mismatch: {'8cfe56c3-f3e2-43c1-ad3f-e539219c28f3_openEO-openEO.tif', 'job-results.json'} != {'job-results.json', 'openEO.tif'}
E               Issues for metadata file 'job-results.json':
E               Differing 'derived_from' links (0 common, 1 only in actual, 24 only in expected):
E                 only in actual: {'https://s3.waw3-1.openeo.v1.dataspace.copernicus.eu/openeo-data-prod-waw4-1/batch_jobs/j-260813152352403eba752a2e8a91d11f/stac-item-collection-loadcollection1.json?X-Proxy-Head-As-Get=true&X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=ca4408195f764775bcd7cfb87a081f91%2F20260813%2Fwaw4-1%2Fs3%2Faws4_request&X-Amz-Date=20260813T152540Z&X-Amz-Expires=86400&X-Amz-SignedHeaders=host&X-Amz-Security-Token=eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJyb2xlX2FybiI6ImFybjpvcGVuZW93czppYW06Ojpyb2xlL29wZW5lby1kYXRhLXByb2Qtd2F3NC0xLXdvcmtzcGFjZSIsImluaXRpYWxfaXNzdWVyIjoib3BlbmVvLnByb2Qud2F3My0xLm9wZW5lby1pbnQudjEuZGF0YXNwYWNlLmNvcGVybmljdXMuZXUiLCJodHRwczovL2F3cy5hbWF6b24uY29tL3RhZ3MiOnsicHJpbmNpcGFsX3RhZ3MiOnsiam9iX2lkIjpbImotMjYwODEzMTUyMzUyNDAzZWJhNzUyYTJlOGE5MWQxMWYiXSwidXNlcl9pZCI6WyI2YTc3ZmNkMS05YzA4LTQ2ZTktYjg3NS01NGZiOTk5YWIyMDAiXX0sInRyYW5zaXRpdmVfdGFnX2tleXMiOlsidXNlcl9pZCIsImpvYl9pZCJdfSwiaXNzIjoic3RzLndhdzMtMS5vcGVuZW8udjEuZGF0YXNwYWNlLmNvcGVybmljdXMuZXUiLCJzdWIiOiJvcGVuZW8tZHJpdmVy...
E                 only in expected: {'S2B_MSIL2A_20230917T104639_N0509_R051_T31UFS_20230917T134005', 'S2A_MSIL2A_20230830T103631_N0510_R008_T31UFS_20241023T055052', 'S2A_MSIL2A_20230922T104741_N0510_R051_T31UFS_20241027T084641', 'S2B_MSIL2A_20230907T104629_N0510_R051_T31UFS_20241026T083843', 'S2B_MSIL2A_20230825T103629_N0510_R008_T31UFS_20241015T164304', 'S2A_MSIL2A_20230810T103631_N0510_R008_T31UFS_20241022T015940', 'S2B_MSIL2A_20230808T104629_N0510_R051_T31UFS_20241021T220636', 'S2A_MSIL2A_20230820T103631_N0510_R008_T31UFS_20241023T045441', 'S2B_MSIL2A_20230805T103629_N0510_R008_T31UFS_20241027T005114', 'S2A_MSIL2A_20230929T103821_N0510_R008_T31UFS_20241106T062041', 'S2B_MSIL2A_20230904T103629_N0510_R008_T31UFS_20241029T101947', 'S2A_MSIL2A_20230823T104631_N0510_R051_T31UFS_20241025T201737', 'S2A_MSIL2A_20230919T103721_N0510_R008_T31UFS_20241105T191503', 'S2A_MSIL2A_20230803T104631_N0510_R051_T31UFS_20241015T081205', 'S2B_MSIL2A_20230927T104719_N0510_R051_T31UFS_20241027T094215', 'S2A_MSIL2A_20230813T105031_N0510_R0....
E
E               Reference data URLs:
E                 job-results.json: https://s3.waw3-1.cloudferro.com/apex-benchmarks/gh-22559915879!tests_test_benchmarks.py__test_run_benchmark_max_ndvi_!actual/job-results.json
E                 openEO.tif: https://s3.waw3-1.cloudferro.com/apex-benchmarks/gh-22559915879!tests_test_benchmarks.py__test_run_benchmark_max_ndvi_!actual/openEO.tif
E
E               Actual data S3 URLs (uploaded on failure):
E                 8cfe56c3-f3e2-43c1-ad3f-e539219c28f3_openEO-openEO.tif: https://s3.waw3-1.cloudferro.com/apex-benchmarks/gh-31714894906!tests_test_benchmarks.py__test_run_benchmark_max_ndvi_!actual/8cfe56c3-f3e2-43c1-ad3f-e539219c28f3_openEO-openEO.tif
E                 job-results.json: https://s3.waw3-1.cloudferro.com/apex-benchmarks/gh-31714894906!tests_test_benchmarks.py__test_run_benchmark_max_ndvi_!actual/job-results.json

tests/test_benchmarks.py:201: AssertionError
----------------------------- Captured stdout call -----------------------------
0:00:00 Job 'cdse-j-260813152352403eba752a2e8a91d11f': send 'start'
0:00:02 Job 'cdse-j-260813152352403eba752a2e8a91d11f': created (progress 0%)
0:00:07 Job 'cdse-j-260813152352403eba752a2e8a91d11f': queued (progress 0%)
0:00:15 Job 'cdse-j-260813152352403eba752a2e8a91d11f': queued (progress 0%)
0:00:23 Job 'cdse-j-260813152352403eba752a2e8a91d11f': running (progress N/A)
0:00:33 Job 'cdse-j-260813152352403eba752a2e8a91d11f': running (progress N/A)
0:00:45 Job 'cdse-j-260813152352403eba752a2e8a91d11f': running (progress N/A)
0:01:01 Job 'cdse-j-260813152352403eba752a2e8a91d11f': running (progress N/A)
0:01:20 Job 'cdse-j-260813152352403eba752a2e8a91d11f': running (progress N/A)
0:01:45 Job 'cdse-j-260813152352403eba752a2e8a91d11f': finished (progress 100%)
------------------------------ Captured log call -------------------------------
INFO     conftest:conftest.py:151 Connecting to 'openeofed.dataspace.copernicus.eu'
INFO     conftest:conftest.py:162 Checking for auth_env_var='OPENEO_AUTH_CLIENT_CREDENTIALS_CDSE' to drive auth against url='openeofed.dataspace.copernicus.eu'.
INFO     conftest:conftest.py:166 Extracted provider_id='CDSE' client_id='openeo-apex-benchmarks-service-account' from auth_env_var='OPENEO_AUTH_CLIENT_CREDENTIALS_CDSE'
INFO     openeo.rest.connection:connection.py:315 Found OIDC providers: ['CDSE']
INFO     openeo.rest.auth.oidc:oidc.py:410 Doing 'client_credentials' token request 'https://identity.dataspace.copernicus.eu/auth/realms/CDSE/protocol/openid-connect/token' with post data fields ['grant_type', 'client_id', 'client_secret', 'scope'] (client_id 'openeo-apex-benchmarks-service-account')
INFO     openeo.rest.connection:connection.py:414 Obtained tokens: ['token_type', 'access_token', 'expires_in', 'id_token', 'scope']
INFO     openeo.rest.job:job.py:509 Downloading job result asset '8cfe56c3-f3e2-43c1-ad3f-e539219c28f3_openEO' from https://s3.waw3-1.openeo.v1.dataspace.copernicus.eu/openeo-data-prod-waw4-1/batch_jobs/j-260813152352403eba752a2e8a91d11f/openEO.tif?X-Proxy-Head-As-Get=true&X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=ca4408195f764775bcd7cfb87a081f91%2F20260813%2Fwaw4-1%2Fs3%2Faws4_request&X-Amz-Date=20260813T152540Z&X-Amz-Expires=86400&X-Amz-SignedHeaders=host&X-Amz-Security-Token=eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJyb2xlX2FybiI6ImFybjpvcGVuZW93czppYW06Ojpyb2xlL29wZW5lby1kYXRhLXByb2Qtd2F3NC0xLXdvcmtz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apex_algorithms/qa/benchmarks/tmp_path_root/test_run_benchmark_max_ndvi_0/actual/8cfe56c3-f3e2-43c1-ad3f-e539219c28f3_openEO-openEO.tif
INFO     apex_algorithm_qa_tools.scenarios:util.py:345 Downloading reference data for scenario.id='max_ndvi' to reference_dir=PosixPath('/home/runner/work/apex_algorithms/apex_algorithms/qa/benchmarks/tmp_path_root/test_run_benchmark_max_ndvi_0/reference'): start 2026-08-13 15:25:43.542511
INFO     apex_algorithm_qa_tools.scenarios:util.py:345 Downloading source='https://s3.waw3-1.cloudferro.com/apex-benchmarks/gh-22559915879!tests_test_benchmarks.py__test_run_benchmark_max_ndvi_!actual/job-results.json' to path=PosixPath('/home/runner/work/apex_algorithms/apex_algorithms/qa/benchmarks/tmp_path_root/test_run_benchmark_max_ndvi_0/reference/job-results.json'): start 2026-08-13 15:25:43.542782
INFO     apex_algorithm_qa_tools.scenarios:util.py:351 Downloading source='https://s3.waw3-1.cloudferro.com/apex-benchmarks/gh-22559915879!tests_test_benchmarks.py__test_run_benchmark_max_ndvi_!actual/job-results.json' to path=PosixPath('/home/runner/work/apex_algorithms/apex_algorithms/qa/benchmarks/tmp_path_root/test_run_benchmark_max_ndvi_0/reference/job-results.json'): end 2026-08-13 15:25:44.111423, elapsed 0:00:00.568641
INFO     apex_algorithm_qa_tools.scenarios:util.py:345 Downloading source='https://s3.waw3-1.cloudferro.com/apex-benchmarks/gh-22559915879!tests_test_benchmarks.py__test_run_benchmark_max_ndvi_!actual/openEO.tif' to path=PosixPath('/home/runner/work/apex_algorithms/apex_algorithms/qa/benchmarks/tmp_path_root/test_run_benchmark_max_ndvi_0/reference/openEO.tif'): start 2026-08-13 15:25:44.111671
INFO     apex_algorithm_qa_tools.scenarios:util.py:351 Downloading source='https://s3.waw3-1.cloudferro.com/apex-benchmarks/gh-22559915879!tests_test_benchmarks.py__test_run_benchmark_max_ndvi_!actual/openEO.tif' to path=PosixPath('/home/runner/work/apex_algorithms/apex_algorithms/qa/benchmarks/tmp_path_root/test_run_benchmark_max_ndvi_0/reference/openEO.tif'): end 2026-08-13 15:25:45.059099, elapsed 0:00:00.947428
INFO     apex_algorithm_qa_tools.scenarios:util.py:351 Downloading reference data for scenario.id='max_ndvi' to reference_dir=PosixPath('/home/runner/work/apex_algorithms/apex_algorithms/qa/benchmarks/tmp_path_root/test_run_benchmark_max_ndvi_0/reference'): end 2026-08-13 15:25:45.059274, elapsed 0:00:01.516763
INFO     openeo.testing.results:results.py:429 Comparing job results: PosixPath('/home/runner/work/apex_algorithms/apex_algorithms/qa/benchmarks/tmp_path_root/test_run_benchmark_max_ndvi_0/actual') vs PosixPath('/home/runner/work/apex_algorithms/apex_algorithms/qa/benchmarks/tmp_path_root/test_run_benchmark_max_ndvi_0/reference')

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions