Skip to content

Commit

Permalink
fix: actually use threading!
Browse files Browse the repository at this point in the history
  • Loading branch information
lubojr committed Oct 26, 2023
1 parent e42f5e1 commit d415132
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions generators/generate_indicators.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
Indicator generator to harvest information from endpoints and generate catalog
"""
import threading
import time
import requests
import json
Expand All @@ -26,13 +27,11 @@
Asset,
Catalog,
Link,
# StacIO,
CatalogType,
Collection,
Extent,
SpatialExtent,
TemporalExtent,
# MediaType,
Summaries,
Provider
)
Expand Down Expand Up @@ -703,8 +702,12 @@ def add_collection_information(config, collection, data):
def process_catalogs(folder_path, options):
for file_name in os.listdir(folder_path):
file_path = os.path.join(folder_path, file_name)
tasks = []
if os.path.isfile(file_path):
process_catalog_file(file_path, options)
tasks.append(threading.Thread(target=process_catalog_file, args=(file_path, options)))
tasks[-1].start()
for task in tasks:
task.join()

options = argparser.parse_args()
folder_path = "../catalogs/"
Expand Down

0 comments on commit d415132

Please sign in to comment.