Skip to content

Commit

Permalink
issue #76 switch isFull and report parameters
Browse files Browse the repository at this point in the history
  • Loading branch information
JeroenVerstraelen committed Oct 14, 2022
1 parent c1816a9 commit 22f93bc
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions src/openeo_aggregator/backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ def _get_all_metadata(self) -> Tuple[List[dict], _InternalCollectionMetadata]:
else:
_log.info(f"Merging {cid!r} collection metadata from backends {by_backend.keys()}")
try:
metadata = merge_collection_metadata(by_backend, LoggerReporter(_log).report, False)
metadata = merge_collection_metadata(by_backend, False, LoggerReporter(_log).report)
except Exception as e:
_log.error(f"Failed to merge collection metadata for {cid!r}", exc_info=True)
continue
Expand Down Expand Up @@ -204,7 +204,7 @@ def _get_collection_metadata(self, collection_id: str) -> dict:
metadata = by_backend.popitem()[1]
else:
_log.info(f"Merging metadata for collection {collection_id}.")
metadata = merge_collection_metadata(by_backend=by_backend, report=LoggerReporter(_log).report, isFull=True)
metadata = merge_collection_metadata(by_backend=by_backend, isFull=True, report=LoggerReporter(_log).report)
return normalize_collection_metadata(metadata, app=flask.current_app)

def load_collection(self, collection_id: str, load_params: LoadParameters, env: EvalEnv) -> DriverDataCube:
Expand Down
2 changes: 1 addition & 1 deletion src/openeo_aggregator/metadata/merging.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ def normalize_collection_metadata(metadata: dict, app: Optional[flask.Flask] = N
return metadata


def merge_collection_metadata(by_backend: Dict[str, dict], report, isFull) -> dict:
def merge_collection_metadata(by_backend: Dict[str, dict], isFull, report) -> dict:
"""
Merge collection metadata dicts from multiple backends
Expand Down
4 changes: 2 additions & 2 deletions src/openeo_aggregator/metadata/validator.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ def compare_get_collections(backend_urls):
by_backend = {}
for url, collection in backend_collection.items():
by_backend[url] = collection
merged_metadata[collection_id] = merge_collection_metadata(by_backend, reporter.report, False)
merged_metadata[collection_id] = merge_collection_metadata(by_backend, False, reporter.report)
reporter.print()


Expand All @@ -66,7 +66,7 @@ def compare_get_collection_by_id(backend_urls, collection_id):
if r.status_code == 200:
by_backend[url] = r.json()
reporter = ValidationReporter()
merged_metadata = merge_collection_metadata(by_backend, reporter.report, True)
merged_metadata = merge_collection_metadata(by_backend, True, reporter.report)
reporter.print()


Expand Down

0 comments on commit 22f93bc

Please sign in to comment.