streamlit-octostar-utils 0.6.4__tar.gz → 0.6.5.dev2__tar.gz

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.
Files changed (46) hide show
  1. {streamlit_octostar_utils-0.6.4 → streamlit_octostar_utils-0.6.5.dev2}/PKG-INFO +1 -1
  2. {streamlit_octostar_utils-0.6.4 → streamlit_octostar_utils-0.6.5.dev2}/pyproject.toml +1 -1
  3. {streamlit_octostar_utils-0.6.4 → streamlit_octostar_utils-0.6.5.dev2}/streamlit_octostar_utils/api_crafter/nifi.py +34 -10
  4. {streamlit_octostar_utils-0.6.4 → streamlit_octostar_utils-0.6.5.dev2}/LICENSE +0 -0
  5. {streamlit_octostar_utils-0.6.4 → streamlit_octostar_utils-0.6.5.dev2}/README.md +0 -0
  6. {streamlit_octostar_utils-0.6.4 → streamlit_octostar_utils-0.6.5.dev2}/streamlit_octostar_utils/__init__.py +0 -0
  7. {streamlit_octostar_utils-0.6.4 → streamlit_octostar_utils-0.6.5.dev2}/streamlit_octostar_utils/api_crafter/__init__.py +0 -0
  8. {streamlit_octostar_utils-0.6.4 → streamlit_octostar_utils-0.6.5.dev2}/streamlit_octostar_utils/api_crafter/celery.py +0 -0
  9. {streamlit_octostar_utils-0.6.4 → streamlit_octostar_utils-0.6.5.dev2}/streamlit_octostar_utils/api_crafter/contents.py +0 -0
  10. {streamlit_octostar_utils-0.6.4 → streamlit_octostar_utils-0.6.5.dev2}/streamlit_octostar_utils/api_crafter/fastapi.py +0 -0
  11. {streamlit_octostar_utils-0.6.4 → streamlit_octostar_utils-0.6.5.dev2}/streamlit_octostar_utils/api_crafter/parallelism.py +0 -0
  12. {streamlit_octostar_utils-0.6.4 → streamlit_octostar_utils-0.6.5.dev2}/streamlit_octostar_utils/api_crafter/parser/__init__.py +0 -0
  13. {streamlit_octostar_utils-0.6.4 → streamlit_octostar_utils-0.6.5.dev2}/streamlit_octostar_utils/api_crafter/parser/combine_fields.py +0 -0
  14. {streamlit_octostar_utils-0.6.4 → streamlit_octostar_utils-0.6.5.dev2}/streamlit_octostar_utils/api_crafter/parser/entities_parser.py +0 -0
  15. {streamlit_octostar_utils-0.6.4 → streamlit_octostar_utils-0.6.5.dev2}/streamlit_octostar_utils/api_crafter/parser/generics.py +0 -0
  16. {streamlit_octostar_utils-0.6.4 → streamlit_octostar_utils-0.6.5.dev2}/streamlit_octostar_utils/api_crafter/parser/info.py +0 -0
  17. {streamlit_octostar_utils-0.6.4 → streamlit_octostar_utils-0.6.5.dev2}/streamlit_octostar_utils/api_crafter/parser/linkchart_functions.py +0 -0
  18. {streamlit_octostar_utils-0.6.4 → streamlit_octostar_utils-0.6.5.dev2}/streamlit_octostar_utils/api_crafter/parser/matches.py +0 -0
  19. {streamlit_octostar_utils-0.6.4 → streamlit_octostar_utils-0.6.5.dev2}/streamlit_octostar_utils/api_crafter/parser/parameters.py +0 -0
  20. {streamlit_octostar_utils-0.6.4 → streamlit_octostar_utils-0.6.5.dev2}/streamlit_octostar_utils/api_crafter/parser/rules.py +0 -0
  21. {streamlit_octostar_utils-0.6.4 → streamlit_octostar_utils-0.6.5.dev2}/streamlit_octostar_utils/api_crafter/parser/signals.py +0 -0
  22. {streamlit_octostar_utils-0.6.4 → streamlit_octostar_utils-0.6.5.dev2}/streamlit_octostar_utils/core/__init__.py +0 -0
  23. {streamlit_octostar_utils-0.6.4 → streamlit_octostar_utils-0.6.5.dev2}/streamlit_octostar_utils/core/dict.py +0 -0
  24. {streamlit_octostar_utils-0.6.4 → streamlit_octostar_utils-0.6.5.dev2}/streamlit_octostar_utils/core/filetypes.py +0 -0
  25. {streamlit_octostar_utils-0.6.4 → streamlit_octostar_utils-0.6.5.dev2}/streamlit_octostar_utils/core/opensearch_conversion.py +0 -0
  26. {streamlit_octostar_utils-0.6.4 → streamlit_octostar_utils-0.6.5.dev2}/streamlit_octostar_utils/core/threading/__init__.py +0 -0
  27. {streamlit_octostar_utils-0.6.4 → streamlit_octostar_utils-0.6.5.dev2}/streamlit_octostar_utils/core/threading/key_queue.py +0 -0
  28. {streamlit_octostar_utils-0.6.4 → streamlit_octostar_utils-0.6.5.dev2}/streamlit_octostar_utils/core/timestamp.py +0 -0
  29. {streamlit_octostar_utils-0.6.4 → streamlit_octostar_utils-0.6.5.dev2}/streamlit_octostar_utils/nlp/__init__.py +0 -0
  30. {streamlit_octostar_utils-0.6.4 → streamlit_octostar_utils-0.6.5.dev2}/streamlit_octostar_utils/nlp/custom_recognizers.py +0 -0
  31. {streamlit_octostar_utils-0.6.4 → streamlit_octostar_utils-0.6.5.dev2}/streamlit_octostar_utils/nlp/language.py +0 -0
  32. {streamlit_octostar_utils-0.6.4 → streamlit_octostar_utils-0.6.5.dev2}/streamlit_octostar_utils/nlp/ner.py +0 -0
  33. {streamlit_octostar_utils-0.6.4 → streamlit_octostar_utils-0.6.5.dev2}/streamlit_octostar_utils/octostar/__init__.py +0 -0
  34. {streamlit_octostar_utils-0.6.4 → streamlit_octostar_utils-0.6.5.dev2}/streamlit_octostar_utils/octostar/client.py +0 -0
  35. {streamlit_octostar_utils-0.6.4 → streamlit_octostar_utils-0.6.5.dev2}/streamlit_octostar_utils/octostar/context.py +0 -0
  36. {streamlit_octostar_utils-0.6.4 → streamlit_octostar_utils-0.6.5.dev2}/streamlit_octostar_utils/octostar/permissions.py +0 -0
  37. {streamlit_octostar_utils-0.6.4 → streamlit_octostar_utils-0.6.5.dev2}/streamlit_octostar_utils/ontology/__init__.py +0 -0
  38. {streamlit_octostar_utils-0.6.4 → streamlit_octostar_utils-0.6.5.dev2}/streamlit_octostar_utils/ontology/inheritance.py +0 -0
  39. {streamlit_octostar_utils-0.6.4 → streamlit_octostar_utils-0.6.5.dev2}/streamlit_octostar_utils/ontology/relationships.py +0 -0
  40. {streamlit_octostar_utils-0.6.4 → streamlit_octostar_utils-0.6.5.dev2}/streamlit_octostar_utils/ontology/validation.py +0 -0
  41. {streamlit_octostar_utils-0.6.4 → streamlit_octostar_utils-0.6.5.dev2}/streamlit_octostar_utils/style/__init__.py +0 -0
  42. {streamlit_octostar_utils-0.6.4 → streamlit_octostar_utils-0.6.5.dev2}/streamlit_octostar_utils/style/common.py +0 -0
  43. {streamlit_octostar_utils-0.6.4 → streamlit_octostar_utils-0.6.5.dev2}/streamlit_octostar_utils/threading/__init__.py +0 -0
  44. {streamlit_octostar_utils-0.6.4 → streamlit_octostar_utils-0.6.5.dev2}/streamlit_octostar_utils/threading/async_task_manager.py +0 -0
  45. {streamlit_octostar_utils-0.6.4 → streamlit_octostar_utils-0.6.5.dev2}/streamlit_octostar_utils/threading/session_callback_manager.py +0 -0
  46. {streamlit_octostar_utils-0.6.4 → streamlit_octostar_utils-0.6.5.dev2}/streamlit_octostar_utils/threading/session_state_hot_swapper.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: streamlit-octostar-utils
3
- Version: 0.6.4
3
+ Version: 0.6.5.dev2
4
4
  Summary:
5
5
  License: MIT
6
6
  License-File: LICENSE
@@ -5,7 +5,7 @@ include = '\.pyi?$'
5
5
 
6
6
  [tool.poetry]
7
7
  name = "streamlit-octostar-utils"
8
- version = "0.6.4"
8
+ version = "0.6.5-dev.2"
9
9
  description = ""
10
10
  license = "MIT"
11
11
  authors = ["Octostar"]
@@ -668,6 +668,7 @@ class NifiContextManager(object):
668
668
  self.out_entities = None
669
669
  self.nonlazy_sync_ids = set()
670
670
  self.lazy_sync = lazy_sync
671
+ self.sync_allowed_flags = None
671
672
  self.client, self.ontology_name = self.get_client(json_data)
672
673
  self._ontology = None
673
674
  self._input_loader = input_loader
@@ -1068,17 +1069,34 @@ class NifiContextManager(object):
1068
1069
  if statuses:
1069
1070
  update_processing_status.sync(statuses, client=self.client)
1070
1071
 
1071
- def sync_entities(self):
1072
- if not self.lazy_sync:
1073
- entities = self.out_entities
1074
- else:
1075
- entities = [e for e in self.out_entities if e.record["entity_id"] in self.nonlazy_sync_ids]
1072
+ def sync_entities(self, allowed_flags=None, entities=None):
1073
+ """Run sync for ``entities`` (defaults to ``self.out_entities`` honoring
1074
+ ``lazy_sync``/``nonlazy_sync_ids``). Passing ``entities`` explicitly
1075
+ bypasses the ``out_entities`` filter — useful for routes that want to
1076
+ trigger a sync from inside their task body (i.e. before ``send_output``
1077
+ has populated ``out_entities``) and catch failures locally.
1078
+ """
1079
+ effective_flags = allowed_flags if allowed_flags is not None else self.sync_allowed_flags
1080
+ if entities is None:
1081
+ if not self.lazy_sync:
1082
+ entities = self.out_entities
1083
+ else:
1084
+ entities = [e for e in self.out_entities if e.record["entity_id"] in self.nonlazy_sync_ids]
1076
1085
  if not entities:
1077
1086
  return
1078
1087
 
1079
- attachables_to_write = self._find_attachables_to_write(entities)
1080
- entities_to_upsert = self._find_entities_to_upsert(entities)
1081
- fetch_rel_entities, fetch_concept_rels = self._find_relationships_to_fetch(entities)
1088
+ run_writes = effective_flags is None or NifiContextManager.SyncFlag.WRITE_CONTENTS in effective_flags
1089
+ run_upserts = effective_flags is None or (
1090
+ NifiContextManager.SyncFlag.UPSERT_ENTITY_ALL in effective_flags
1091
+ or NifiContextManager.SyncFlag.UPSERT_ENTITY_SPECIFIC_FIELDS in effective_flags
1092
+ )
1093
+ run_fetch = effective_flags is None or NifiContextManager.SyncFlag.FETCH_RELATIONSHIPS in effective_flags
1094
+
1095
+ attachables_to_write = self._find_attachables_to_write(entities) if run_writes else []
1096
+ entities_to_upsert = self._find_entities_to_upsert(entities) if run_upserts else []
1097
+ fetch_rel_entities, fetch_concept_rels = (
1098
+ self._find_relationships_to_fetch(entities) if run_fetch else ({}, {})
1099
+ )
1082
1100
 
1083
1101
  all_entities_to_modify = attachables_to_write + [e[0] for e in entities_to_upsert]
1084
1102
  with self.reindex_lock(all_entities_to_modify) as locked:
@@ -1091,8 +1109,14 @@ class NifiContextManager(object):
1091
1109
  for entity in all_entities_to_modify:
1092
1110
  entity.request["is_temporary"] = False
1093
1111
 
1094
- for entity in entities:
1095
- entity.sync_params = {}
1112
+ if effective_flags is None:
1113
+ for entity in entities:
1114
+ entity.sync_params = {}
1115
+ else:
1116
+ for entity in entities:
1117
+ entity.sync_params = {
1118
+ k: v for k, v in entity.sync_params.items() if k not in effective_flags
1119
+ }
1096
1120
 
1097
1121
  def _find_attachables_to_write(self, entities) -> list:
1098
1122
  attachables_to_write = []