Skip to content

Commit

Permalink
add contexts to harvest_erddap
Browse files Browse the repository at this point in the history
  • Loading branch information
JessyBarrette committed Apr 17, 2024
1 parent 1e44e16 commit 0b38b52
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
4 changes: 2 additions & 2 deletions harvester/cde_harvester/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
unescape_ascii,
unescape_ascii_list,
)
from cde_harvester.harvest_erddap import harvest_erddap
from cde_harvester.harvest_erddap import harvest_erddap_contextualized
from cde_harvester.utils import cf_standard_names, supported_standard_names
from dotenv import load_dotenv
from loguru import logger
Expand Down Expand Up @@ -109,7 +109,7 @@ def main(erddaps, cache_requests, folder: Path, max_workers: int):

def worker():
while True:
harvest_erddap(*q.get())
harvest_erddap_contextualized(*q.get())
time.sleep(1)
q.task_done()

Expand Down
5 changes: 5 additions & 0 deletions harvester/cde_harvester/harvest_erddap.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,11 @@ def get_datasets_to_skip():
return {}


def harvest_erddap_contextualized(erddap_conn, result, cache_requests=False):
with logger.contextualize( erddap_url=erddap_conn["url"]):
return harvest_erddap(erddap_conn, result, cache_requests)


def harvest_erddap(erddap_conn, result, cache_requests=False):
# """ """
skipped_datasets_reasons = []
Expand Down

0 comments on commit 0b38b52

Please sign in to comment.