Skip to content

Commit

Permalink
Set archiving to false by default
Browse files Browse the repository at this point in the history
  • Loading branch information
alexobaseki committed Jun 6, 2024
1 parent b241660 commit 1d751fa
Showing 1 changed file with 21 additions and 20 deletions.
41 changes: 21 additions & 20 deletions app.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ def process_import_function(event, context):
key = message.get("file_path")
jurisdiction_id = message.get("jurisdiction_id")
jurisdiction_name = message.get("jurisdiction_name")
is_archive_files = message.get("is_archive_files", False)

# for some reason, the key is url encoded sometimes
key = urllib.parse.unquote(key, encoding="utf-8")
Expand Down Expand Up @@ -102,26 +103,26 @@ def process_import_function(event, context):
logger.error(f"Error downloading file: {e}")
all_files.remove(filedir)
continue

# Process imports for all files per jurisdiction in a batch
for abbreviation, juris in unique_jurisdictions.items():
logger.info(f"importing {juris['id']}...")

try:
do_import(juris["id"], f"{datadir}{abbreviation}")
stats.send_last_run(
"last_collection_run_time",
{
"jurisdiction": juris["name"],
"scrape_type": "import",
},
)
archive_files(bucket, juris["keys"])
except Exception as e:
logger.error(
f"Error importing jurisdiction {juris['id']}: {e}"
) # noqa: E501
continue
# Process imports for all files per jurisdiction in a batch
for abbreviation, juris in unique_jurisdictions.items():
logger.info(f"importing {juris['id']}...")

try:
do_import(juris["id"], f"{datadir}{abbreviation}")
stats.send_last_run(
"last_collection_run_time",
{
"jurisdiction": juris["name"],
"scrape_type": "import",
},
)
if is_archive_files:
archive_files(bucket, juris["keys"])
except Exception as e:
logger.error(
f"Error importing jurisdiction {juris['id']}: {e}"
) # noqa: E501
continue

logger.info(f"{len(all_files)} files processed")
stats.close()
Expand Down

0 comments on commit 1d751fa

Please sign in to comment.