howler-api 3.0.0.dev361__py3-none-any.whl → 3.0.0.dev365__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of howler-api might be problematic. Click here for more details.

@@ -418,8 +418,11 @@ class ESCollection(Generic[ModelType]):
418
418
  # - update_by_query
419
419
  # - delete_by_query
420
420
  # - reindex ...
421
+ attempt = 0
421
422
  res = None
422
423
  while res is None:
424
+ attempt = attempt + 1
425
+ logger.warning("Checking status of task %s (Attempt %s)", task["task"], attempt)
423
426
  try:
424
427
  res = self.with_retries(
425
428
  self.datastore.client.tasks.get,
@@ -435,9 +438,14 @@ class ESCollection(Generic[ModelType]):
435
438
  ]:
436
439
  pass
437
440
  else:
441
+ logger.exception("Unexpected error on task check")
438
442
  raise
439
443
 
440
- return res.get("response", res["task"]["status"])
444
+ result = res.get("response", res["task"]["status"])
445
+
446
+ logger.info("Task result:\n%s", str(result))
447
+
448
+ return result
441
449
 
442
450
  def _get_current_alias(self, index: str) -> typing.Optional[str]:
443
451
  if self.with_retries(self.datastore.client.indices.exists_alias, name=index):
@@ -679,6 +687,7 @@ class ESCollection(Generic[ModelType]):
679
687
 
680
688
  :return: Should return True of the commit was successful on all hosts
681
689
  """
690
+ logger.warning("Beginning Reindex")
682
691
  for index in self.index_list:
683
692
  new_name = f"{index}__reindex"
684
693
  index_data = None
@@ -689,6 +698,7 @@ class ESCollection(Generic[ModelType]):
689
698
  index_data = self.with_retries(self.datastore.client.indices.get, index=index)[index]
690
699
 
691
700
  # Create reindex target
701
+ logger.warning("Creating new index with name %s", new_name)
692
702
  self.with_retries(
693
703
  self.datastore.client.indices.create,
694
704
  index=new_name,
@@ -719,36 +729,39 @@ class ESCollection(Generic[ModelType]):
719
729
  else:
720
730
  alias_actions = [{"add": {"index": new_name, "alias": alias}}]
721
731
 
732
+ logger.warning("Updating alias %s", alias)
722
733
  self.with_retries(self.datastore.client.indices.update_aliases, actions=alias_actions)
723
734
 
724
735
  # Reindex data into target
736
+ logger.warning("Beginning reindex from %s to %s", index, new_name)
725
737
  r_task = self.with_retries(
726
738
  self.datastore.client.reindex,
727
739
  source={"index": index},
728
740
  dest={"index": new_name},
729
741
  wait_for_completion=False,
730
742
  )
743
+ logger.warning("Reindex taskId: %s", r_task["task"])
731
744
  self._get_task_results(r_task)
732
745
 
733
746
  if self.with_retries(self.datastore.client.indices.exists, index=new_name):
734
747
  if index_data is None:
735
748
  index_data = self.with_retries(self.datastore.client.indices.get, index=index)[index]
736
749
 
737
- # Commit reindexed data
750
+ logger.warning("Committing reindexed data in index %s", new_name)
738
751
  self.with_retries(self.datastore.client.indices.refresh, index=new_name)
739
752
  self.with_retries(self.datastore.client.indices.clear_cache, index=new_name)
740
753
 
741
- # Delete old index
754
+ logger.warning("Deleting old index %s", index)
742
755
  if self.with_retries(self.datastore.client.indices.exists, index=index):
743
756
  self.with_retries(self.datastore.client.indices.delete, index=index)
744
757
 
745
- # Block write to the index
758
+ logger.warning("Block write to index")
746
759
  self.with_retries(
747
760
  self.datastore.client.indices.put_settings,
748
761
  settings=write_block_settings,
749
762
  )
750
763
 
751
- # Rename reindexed index
764
+ logger.warning("Renaming reindexed index from %s to %s", new_name, index)
752
765
  try:
753
766
  self._safe_index_copy(
754
767
  self.datastore.client.indices.clone,
@@ -776,11 +789,11 @@ class ESCollection(Generic[ModelType]):
776
789
  actions=alias_actions,
777
790
  )
778
791
 
779
- # Delete the reindex target if it still exists
780
792
  if self.with_retries(self.datastore.client.indices.exists, index=new_name):
793
+ logger.warning("Deleting reindex target %s", new_name)
781
794
  self.with_retries(self.datastore.client.indices.delete, index=new_name)
782
795
  finally:
783
- # Unblock write to the index
796
+ logger.warning("Unblock write to the index")
784
797
  self.with_retries(
785
798
  self.datastore.client.indices.put_settings,
786
799
  settings=write_unblock_settings,
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: howler-api
3
- Version: 3.0.0.dev361
3
+ Version: 3.0.0.dev365
4
4
  Summary: Howler - API server
5
5
  License: MIT
6
6
  Keywords: howler,alerting,gc,canada,cse-cst,cse,cst,cyber,cccs
@@ -53,7 +53,7 @@ howler/cronjobs/view_cleanup.py,sha256=ULWLR1uFcRemRgkEDrMqmBamHiE0dgDvu49VK0qDk
53
53
  howler/datastore/README.md,sha256=ekWl1YJSrHlZpU5PgBkPEzPWjdbTdav6Rd2P0ccIesw,4758
54
54
  howler/datastore/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
55
55
  howler/datastore/bulk.py,sha256=VfolZfiaBD4ZTK3j6IVVVq4GMjVXb5elrsGwwM_nONE,2829
56
- howler/datastore/collection.py,sha256=YNDZ_x3q3Upq1PRD_2akOxcBp52FK52VrtzTf4wGWEQ,90363
56
+ howler/datastore/collection.py,sha256=69VhtrFp24Alssm-yTuDHqPZ1XWhN5Ty-eeRJaPQEP4,91154
57
57
  howler/datastore/constants.py,sha256=x7ODomtOQmDjmXoAxly4onPAnUkq4BLZ1TBg-UgpU1g,2415
58
58
  howler/datastore/exceptions.py,sha256=yZvQXRI4mR50ltGFHbdZAD4TIbhdKJku6LLTPQ0JZRk,955
59
59
  howler/datastore/howler_store.py,sha256=kW7FKM-tILcfTmrjSB1yZm-ZnumPS_tiQEZUDaQoDkg,2915
@@ -192,7 +192,7 @@ howler/utils/path.py,sha256=DfOU4i4zSs4wchHoE8iE7aWVLkTxiC_JRGepF2hBYBk,690
192
192
  howler/utils/socket_utils.py,sha256=nz1SklC9xBHUSfHyTJjpq3mbozX1GDf01WzdGxfaUII,2212
193
193
  howler/utils/str_utils.py,sha256=HE8Hqh2HlOLaj16w0H9zKOyDJLp-f1LQ50y_WeGZaEk,8389
194
194
  howler/utils/uid.py,sha256=p9dsqyvZ-lpiAuzZWCPCeEM99kdk0Ly9czf04HNdSuw,1341
195
- howler_api-3.0.0.dev361.dist-info/METADATA,sha256=zsVoOU9_C2GMioaWIilcLuXlA2frF05eKdbJ_B-WZxY,2804
196
- howler_api-3.0.0.dev361.dist-info/WHEEL,sha256=zp0Cn7JsFoX2ATtOhtaFYIiE2rmFAD4OcMhtUki8W3U,88
197
- howler_api-3.0.0.dev361.dist-info/entry_points.txt,sha256=Lu9SBGvwe0wczJHmc-RudC24lmQk7tv3ZBXon9RIihg,259
198
- howler_api-3.0.0.dev361.dist-info/RECORD,,
195
+ howler_api-3.0.0.dev365.dist-info/METADATA,sha256=XsJAA4VR6oNnUAdD7R6sPLoog-6Eub-fooNZah4Iwx0,2804
196
+ howler_api-3.0.0.dev365.dist-info/WHEEL,sha256=zp0Cn7JsFoX2ATtOhtaFYIiE2rmFAD4OcMhtUki8W3U,88
197
+ howler_api-3.0.0.dev365.dist-info/entry_points.txt,sha256=Lu9SBGvwe0wczJHmc-RudC24lmQk7tv3ZBXon9RIihg,259
198
+ howler_api-3.0.0.dev365.dist-info/RECORD,,