Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion data/STAC/re_root_stac.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,9 @@ def main(
source_root,
*str(child_link_dict["href"]).replace(old_link_prefix, "").split("/"),
)

if not path.exists(collection_in_path):
print(f"collection at {collection_in_path} does not exist")
continue
with open(collection_in_path, "r") as f:
try:
collection = load(f)
Expand All @@ -47,6 +49,9 @@ def main(
"*.json",
)
):
if not path.exists(item_in_path):
print(f"item at {item_in_path} does not exist")
continue
item_paths.append(item_in_path)
with open(item_in_path, "r") as f:
try:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -167,14 +167,13 @@ async def process_items(
_logger.info("reading items for collections")
all_errors: List[IndexingError] = []
item_uris: List[str] = []
concurrency_limit = Semaphore(get_settings().max_concurrency)
if _settings.test_collection_limit is not None:
collections = collections[: _settings.test_collection_limit]
_logger.info("collecting item URIs for collections")
results = await gather(
*[
self._get_collection_item_uris(
collection, Semaphore(get_settings().max_concurrency)
)
self._get_collection_item_uris(collection, semaphore=concurrency_limit)
for collection in collections
]
)
Expand All @@ -195,7 +194,6 @@ async def fetch_and_ingest(
uri: str, semaphore: Semaphore
) -> List[IndexingError]:
async with semaphore:
_logger.debug(f"fetch_and_ingest {uri}")
item_errors: List[IndexingError] = []
try:
dict_item = await self._get_json_content_from_uri(uri)
Expand Down Expand Up @@ -225,7 +223,7 @@ async def fetch_and_ingest(
item_errors
for sublist in await gather(
*[
fetch_and_ingest(uri, Semaphore(get_settings().max_concurrency))
fetch_and_ingest(uri=uri, semaphore=concurrency_limit)
for uri in item_uris
]
)
Expand Down