Skip to content

Commit

Permalink
added progress status to import task
Browse files Browse the repository at this point in the history
  • Loading branch information
JJFlorian committed Mar 22, 2024
1 parent 1ccf357 commit ad5b1e4
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions api/bro_import/bulk_import.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,15 @@ def run(self) -> None:
url = self._create_bro_ids_import_url()
bro_ids = self._fetch_bro_ids(url)

total_bro_ids = len(bro_ids)
counter = 0

for bro_id in bro_ids:
counter += 1
progress = (counter/total_bro_ids) * 100
self.import_task_instance.log = f"Progress: {progress:.2f}%"
self.import_task_instance.save()

try:
data_importer = self.object_importer_class(
self.bro_domain, bro_id, self.data_owner
Expand Down

0 comments on commit ad5b1e4

Please sign in to comment.