Skip to content

Commit eebd508

Browse files
authored
Merge pull request #474 from CodeForPhilly/345-db-update-freq
Updates exec_status every 100 rows
2 parents 59969d8 + 0a751b9 commit eebd508

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/server/pipeline/match_data.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,12 +50,15 @@ def start(connection, added_or_updated_rows, manual_matches_df, job_id):
5050

5151
rows = items_to_update.to_dict(orient="records")
5252
row_print_freq = 1000
53+
db_update_freq = 100 # update db after this many rows
5354

5455
for row_num, row in enumerate(rows):
55-
if row_num % row_print_freq == 0:
56+
if row_num % row_print_freq == 0: # Write to log
5657
current_app.logger.info("- Matching rows {}-{} of {}".format(
5758
row_num + 1, min(len(rows), row_num + row_print_freq), len(rows))
5859
)
60+
61+
if row_num % db_update_freq == 0: # Update execution_status table
5962
log_db.log_exec_status(job_id, 'matching', 'executing', str({'at_row': row_num + 1, 'of_rows': len(rows) }) )
6063

6164
# Exact matches based on specified columns

0 commit comments

Comments
 (0)