diff --git a/augur/tasks/git/util/facade_worker/facade_worker/analyzecommit.py b/augur/tasks/git/util/facade_worker/facade_worker/analyzecommit.py index 885e093539..285ec6c780 100644 --- a/augur/tasks/git/util/facade_worker/facade_worker/analyzecommit.py +++ b/augur/tasks/git/util/facade_worker/facade_worker/analyzecommit.py @@ -118,6 +118,9 @@ def generate_commit_record(repos_id,commit,filename, author_email = strip_extra_amp(author_email) committer_email = strip_extra_amp(committer_email) + #replace incomprehensible dates with epoch. + #2021-10-11 11:57:46 -0500 + placeholder_date = "1970-01-01 00:00:15 -0500" #session.logger.info(f"Timestamp: {author_timestamp}") commit_record = { diff --git a/augur/tasks/git/util/facade_worker/facade_worker/utilitymethods.py b/augur/tasks/git/util/facade_worker/facade_worker/utilitymethods.py index 9835c32327..aef4e59989 100644 --- a/augur/tasks/git/util/facade_worker/facade_worker/utilitymethods.py +++ b/augur/tasks/git/util/facade_worker/facade_worker/utilitymethods.py @@ -235,7 +235,7 @@ def facade_bulk_insert_commits(session,records): facade_bulk_insert_commits(session,firsthalfRecords) facade_bulk_insert_commits(session,secondhalfRecords) - else if records == 1 and isinstance(e,DataError): + elif len(records) == 1 and isinstance(e,DataError) and "time zone displacement" in f"{e}": commit_record = records[0] #replace incomprehensible dates with epoch. #2021-10-11 11:57:46 -0500 @@ -244,18 +244,14 @@ def facade_bulk_insert_commits(session,records): #Check for improper utc timezone offset #UTC timezone offset should be betwen -14:00 and +14:00 - if "time zone displacement" in f"{e}": - commit_record['author_timestamp'] = placeholder_date - commit_record['committer_timestamp'] = placeholder_date - - session.execute( - s.insert(Commit), - [commit_record], - ) - session.commit() - else: - session.logger.error(f"Ran into issue when trying to insert commit: {commit_record} \n Error: {e}") - raise e + commit_record['author_timestamp'] = placeholder_date + commit_record['committer_timestamp'] = placeholder_date + + session.execute( + s.insert(Commit), + [commit_record], + ) + session.commit() else: raise e