from fpsweeper.logic import util from fpsweeper.model.query import fp_sweeper_log def insert_fp_sweeper_log(db_session_fingerprint_capture, datetime_start, datetime_end, daterange_start, daterange_end, num_tracks_checked, num_tracks_queued, status, created_by): """Save a record to fingerprint_capture.fp_sweeper_log. This is a logging table used to monitor the sweeper process db_session_fingerprint_capture: (sqlalchemy.orm.session.Session): db session object pointed to fingerprint_capture db datetime_start (string): ISO8601 UTC datetime string of when sweeper process started datetime_end (string): ISO8601 UTC datetime string of when sweeper process ended daterange_start (string): ISO8601 UTC datetime string of the starting time range of tuids in art_relation.track.last_updated daterange_end (string): ISO8601 UTC datetime string of the ending time range of tuids in art_relation.track.last_updated num_tracks_checked (int): number of tracks that were checked for missing fingerprints num_tracks_queued (int): number of tracks that were added to the fp_capture_backfill queue status (string): 'running', 'complete', or 'error' created_by (string): process that created the log """ params = {'datetime_start': datetime_start, 'datetime_end': datetime_end, 'daterange_start': daterange_start, 'daterange_end': daterange_end, 'num_tracks_checked': num_tracks_checked, 'num_tracks_queued': num_tracks_queued, 'status': status, 'created_by': created_by} util.try_execute_query(db_session=db_session_fingerprint_capture, clause=fp_sweeper_log.INSERT_FP_SWEEPER_LOG, params=params) db_session_fingerprint_capture.commit()