Skip to content

Commit

Permalink
Improve log output when failing to load local/remote metadata
Browse files Browse the repository at this point in the history
  • Loading branch information
dostuffthatmatters committed Mar 25, 2024
1 parent a013681 commit a07a87a
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 12 deletions.
24 changes: 13 additions & 11 deletions src/retrieval/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,21 +78,23 @@ def _graceful_teardown(*args: Any) -> None:
try:
em27_metadata_interface = utils.metadata.load_local_em27_metadata_interface(
)
if em27_metadata_interface is not None:
print("Found local metadata")
else:
print(
"Did not find local metadata -> fetching metadata from GitHub"
)
assert config.general.metadata is not None, "Remote metadata not configured"
em27_metadata_interface = em27_metadata.load_from_github(
github_repository=config.general.metadata.github_repository,
access_token=config.general.metadata.access_token,
)
print("Successfully fetched metadata from GitHub")
except Exception as e:
main_logger.exception(e, "Error while loading local metadata")
main_logger.archive()
raise e

if em27_metadata_interface is not None:
print("Found local metadata")
else:
print("Did not find local metadata -> fetching metadata from GitHub")
assert config.general.metadata is not None, "Remote metadata not configured"
em27_metadata_interface = em27_metadata.load_from_github(
github_repository=config.general.metadata.github_repository,
access_token=config.general.metadata.access_token,
)
print("Successfully fetched metadata from GitHub")

# generate retrieval queue
retrieval.utils.retrieval_status.RetrievalStatusList.reset()
job_queue = retrieval.utils.job_queue.RetrievalJobQueue()
Expand Down
2 changes: 1 addition & 1 deletion src/utils/metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ def load_local_em27_metadata_interface(
if any(file_existence):
if not all(file_existence):
raise FileNotFoundError(
"Found some local metadata files but not all (loca)" +
"Found some local metadata files but not all (loca" +
"tions.json, sensors.json, campaigns.json). Please " +
"add or remove all local metadata files."
)
Expand Down

0 comments on commit a07a87a

Please sign in to comment.