Skip to content

Commit

Permalink
Add check for missing records in DB (by some reason?)
Browse files Browse the repository at this point in the history
  • Loading branch information
KateSakharova committed Jun 6, 2024
1 parent 0201c09 commit ec096dd
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions emgapi/management/commands/populate_metagenomics_exchange.py
Original file line number Diff line number Diff line change
Expand Up @@ -174,9 +174,19 @@ def process_to_index_and_update_records(self, analyses_to_index_and_update):
else:
logging.error(f"Analysis {annotation_job} update failed")
else:
logging.debug(
f"No edit for {annotation_job}, metadata is correct"
)
if annotation_job.mgx_accession and annotation_job.last_mgx_indexed:
logging.info(
f"No edit for {annotation_job}, metadata is correct"
)
else:
logging.info(
f"Metadata is correct but {annotation_job} is missing in DB. Adding."
)
annotation_job.mgx_accession = registry_id
annotation_job.last_mgx_indexed = (
timezone.now() + timedelta(minutes=1)
)
jobs_to_update.append(annotation_job)

AnalysisJob.objects.bulk_update(
jobs_to_update,
Expand Down

0 comments on commit ec096dd

Please sign in to comment.