Skip to content

Commit

Permalink
Merge pull request #2759 from chaoss/fix-bad-reset-sql-block
Browse files Browse the repository at this point in the history
Add Check to SQL Update Statements to Avoid constraints on `date_last_collected`
  • Loading branch information
sgoggins authored Apr 10, 2024
2 parents ffbac7b + 487900b commit 2474c56
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions augur/tasks/start_tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -326,13 +326,22 @@ def retry_errored_repos(self):
#collection_status table once augur dev is less unstable.
with DatabaseSession(logger,engine) as session:
query = s.sql.text(f"""UPDATE collection_status SET secondary_status = '{CollectionState.PENDING.value}'"""
f""" WHERE secondary_status = '{CollectionState.ERROR.value}' ;"""
f""" WHERE secondary_status = '{CollectionState.ERROR.value}' and secondary_data_last_collected is NULL;"""
f"""UPDATE collection_status SET core_status = '{CollectionState.PENDING.value}'"""
f""" WHERE core_status = '{CollectionState.ERROR.value}' ;"""
f""" WHERE core_status = '{CollectionState.ERROR.value}' and core_data_last_collected is NULL;"""
f"""UPDATE collection_status SET facade_status = '{CollectionState.PENDING.value}'"""
f""" WHERE facade_status = '{CollectionState.ERROR.value}' ;"""
f""" WHERE facade_status = '{CollectionState.ERROR.value}' and facade_data_last_collected is NULL;"""
f"""UPDATE collection_status SET ml_status = '{CollectionState.PENDING.value}'"""
f""" WHERE ml_status = '{CollectionState.ERROR.value}' ;"""
f""" WHERE ml_status = '{CollectionState.ERROR.value}' and ml_data_last_collected is NULL;"""

f"""UPDATE collection_status SET secondary_status = '{CollectionState.SUCCESS.value}'"""
f""" WHERE secondary_status = '{CollectionState.ERROR.value}' and secondary_data_last_collected is not NULL;"""
f"""UPDATE collection_status SET core_status = '{CollectionState.SUCCESS.value}'"""
f""" WHERE core_status = '{CollectionState.ERROR.value}' and core_data_last_collected is not NULL;;"""
f"""UPDATE collection_status SET facade_status = '{CollectionState.SUCCESS.value}'"""
f""" WHERE facade_status = '{CollectionState.ERROR.value}' and facade_data_last_collected is not NULL;;"""
f"""UPDATE collection_status SET ml_status = '{CollectionState.SUCCESS.value}'"""
f""" WHERE ml_status = '{CollectionState.ERROR.value}' and ml_data_last_collected is not NULL;;"""
)

session.execute_sql(query)
Expand Down

0 comments on commit 2474c56

Please sign in to comment.