Skip to content

Commit

Permalink
Merge pull request #40 from jbusecke/only-warn-when-iids-were-not-parsed
Browse files Browse the repository at this point in the history
Only warn if iids were not parsed
  • Loading branch information
jbusecke authored Apr 30, 2024
2 parents ed4bd7e + 9ab26c0 commit 524d6f7
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions pangeo_forge_esgf/parsing.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,6 @@ def parse_instance_ids(
no_result_iids: List[str] = []
for iid in split_iids:
for node in search_nodes:
print(f"{node=}")
facets = facets_from_iid(iid)
facets_filtered = {
k: v for k, v in facets.items() if v != "*"
Expand All @@ -100,5 +99,12 @@ def parse_instance_ids(
parsed_iids.extend(iids_from_request)
except Exception as e:
print(f"Request for {iid=} to {node=} failed with {e}")
warnings.warn(f"No parsed results for {no_result_iids=}", UserWarning)
return list(set(parsed_iids))
# there is the possibility that an iid is parsed by one node, but not another.
# TODO: Print some more helpful info per node if needed?
# For now lets just make sure that no_result_iids only shows cases that fail on *every* node
parsed_iids = list(set(parsed_iids))
no_result_iids = list(set(no_result_iids) - set(parsed_iids))

if len(no_result_iids) > 0:
warnings.warn(f"No parsed results for {no_result_iids=}", UserWarning)
return parsed_iids

0 comments on commit 524d6f7

Please sign in to comment.