streamlit-octostar-utils 0.5.0.dev15__tar.gz → 0.5.0.dev17__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.
- {streamlit_octostar_utils-0.5.0.dev15 → streamlit_octostar_utils-0.5.0.dev17}/PKG-INFO +1 -1
- {streamlit_octostar_utils-0.5.0.dev15 → streamlit_octostar_utils-0.5.0.dev17}/pyproject.toml +1 -1
- {streamlit_octostar_utils-0.5.0.dev15 → streamlit_octostar_utils-0.5.0.dev17}/streamlit_octostar_utils/api_crafter/celery.py +20 -3
- {streamlit_octostar_utils-0.5.0.dev15 → streamlit_octostar_utils-0.5.0.dev17}/streamlit_octostar_utils/api_crafter/nifi.py +1 -0
- {streamlit_octostar_utils-0.5.0.dev15 → streamlit_octostar_utils-0.5.0.dev17}/LICENSE +0 -0
- {streamlit_octostar_utils-0.5.0.dev15 → streamlit_octostar_utils-0.5.0.dev17}/README.md +0 -0
- {streamlit_octostar_utils-0.5.0.dev15 → streamlit_octostar_utils-0.5.0.dev17}/streamlit_octostar_utils/__init__.py +0 -0
- {streamlit_octostar_utils-0.5.0.dev15 → streamlit_octostar_utils-0.5.0.dev17}/streamlit_octostar_utils/api_crafter/__init__.py +0 -0
- {streamlit_octostar_utils-0.5.0.dev15 → streamlit_octostar_utils-0.5.0.dev17}/streamlit_octostar_utils/api_crafter/contents.py +0 -0
- {streamlit_octostar_utils-0.5.0.dev15 → streamlit_octostar_utils-0.5.0.dev17}/streamlit_octostar_utils/api_crafter/fastapi.py +0 -0
- {streamlit_octostar_utils-0.5.0.dev15 → streamlit_octostar_utils-0.5.0.dev17}/streamlit_octostar_utils/api_crafter/parallelism.py +0 -0
- {streamlit_octostar_utils-0.5.0.dev15 → streamlit_octostar_utils-0.5.0.dev17}/streamlit_octostar_utils/api_crafter/parser/__init__.py +0 -0
- {streamlit_octostar_utils-0.5.0.dev15 → streamlit_octostar_utils-0.5.0.dev17}/streamlit_octostar_utils/api_crafter/parser/combine_fields.py +0 -0
- {streamlit_octostar_utils-0.5.0.dev15 → streamlit_octostar_utils-0.5.0.dev17}/streamlit_octostar_utils/api_crafter/parser/entities_parser.py +0 -0
- {streamlit_octostar_utils-0.5.0.dev15 → streamlit_octostar_utils-0.5.0.dev17}/streamlit_octostar_utils/api_crafter/parser/generics.py +0 -0
- {streamlit_octostar_utils-0.5.0.dev15 → streamlit_octostar_utils-0.5.0.dev17}/streamlit_octostar_utils/api_crafter/parser/info.py +0 -0
- {streamlit_octostar_utils-0.5.0.dev15 → streamlit_octostar_utils-0.5.0.dev17}/streamlit_octostar_utils/api_crafter/parser/linkchart_functions.py +0 -0
- {streamlit_octostar_utils-0.5.0.dev15 → streamlit_octostar_utils-0.5.0.dev17}/streamlit_octostar_utils/api_crafter/parser/matches.py +0 -0
- {streamlit_octostar_utils-0.5.0.dev15 → streamlit_octostar_utils-0.5.0.dev17}/streamlit_octostar_utils/api_crafter/parser/parameters.py +0 -0
- {streamlit_octostar_utils-0.5.0.dev15 → streamlit_octostar_utils-0.5.0.dev17}/streamlit_octostar_utils/api_crafter/parser/rules.py +0 -0
- {streamlit_octostar_utils-0.5.0.dev15 → streamlit_octostar_utils-0.5.0.dev17}/streamlit_octostar_utils/api_crafter/parser/signals.py +0 -0
- {streamlit_octostar_utils-0.5.0.dev15 → streamlit_octostar_utils-0.5.0.dev17}/streamlit_octostar_utils/core/__init__.py +0 -0
- {streamlit_octostar_utils-0.5.0.dev15 → streamlit_octostar_utils-0.5.0.dev17}/streamlit_octostar_utils/core/dict.py +0 -0
- {streamlit_octostar_utils-0.5.0.dev15 → streamlit_octostar_utils-0.5.0.dev17}/streamlit_octostar_utils/core/filetypes.py +0 -0
- {streamlit_octostar_utils-0.5.0.dev15 → streamlit_octostar_utils-0.5.0.dev17}/streamlit_octostar_utils/core/threading/__init__.py +0 -0
- {streamlit_octostar_utils-0.5.0.dev15 → streamlit_octostar_utils-0.5.0.dev17}/streamlit_octostar_utils/core/threading/key_queue.py +0 -0
- {streamlit_octostar_utils-0.5.0.dev15 → streamlit_octostar_utils-0.5.0.dev17}/streamlit_octostar_utils/core/timestamp.py +0 -0
- {streamlit_octostar_utils-0.5.0.dev15 → streamlit_octostar_utils-0.5.0.dev17}/streamlit_octostar_utils/nlp/__init__.py +0 -0
- {streamlit_octostar_utils-0.5.0.dev15 → streamlit_octostar_utils-0.5.0.dev17}/streamlit_octostar_utils/nlp/custom_recognizers.py +0 -0
- {streamlit_octostar_utils-0.5.0.dev15 → streamlit_octostar_utils-0.5.0.dev17}/streamlit_octostar_utils/nlp/language.py +0 -0
- {streamlit_octostar_utils-0.5.0.dev15 → streamlit_octostar_utils-0.5.0.dev17}/streamlit_octostar_utils/nlp/ner.py +0 -0
- {streamlit_octostar_utils-0.5.0.dev15 → streamlit_octostar_utils-0.5.0.dev17}/streamlit_octostar_utils/octostar/__init__.py +0 -0
- {streamlit_octostar_utils-0.5.0.dev15 → streamlit_octostar_utils-0.5.0.dev17}/streamlit_octostar_utils/octostar/client.py +0 -0
- {streamlit_octostar_utils-0.5.0.dev15 → streamlit_octostar_utils-0.5.0.dev17}/streamlit_octostar_utils/octostar/context.py +0 -0
- {streamlit_octostar_utils-0.5.0.dev15 → streamlit_octostar_utils-0.5.0.dev17}/streamlit_octostar_utils/octostar/permissions.py +0 -0
- {streamlit_octostar_utils-0.5.0.dev15 → streamlit_octostar_utils-0.5.0.dev17}/streamlit_octostar_utils/ontology/__init__.py +0 -0
- {streamlit_octostar_utils-0.5.0.dev15 → streamlit_octostar_utils-0.5.0.dev17}/streamlit_octostar_utils/ontology/inheritance.py +0 -0
- {streamlit_octostar_utils-0.5.0.dev15 → streamlit_octostar_utils-0.5.0.dev17}/streamlit_octostar_utils/ontology/relationships.py +0 -0
- {streamlit_octostar_utils-0.5.0.dev15 → streamlit_octostar_utils-0.5.0.dev17}/streamlit_octostar_utils/ontology/validation.py +0 -0
- {streamlit_octostar_utils-0.5.0.dev15 → streamlit_octostar_utils-0.5.0.dev17}/streamlit_octostar_utils/style/__init__.py +0 -0
- {streamlit_octostar_utils-0.5.0.dev15 → streamlit_octostar_utils-0.5.0.dev17}/streamlit_octostar_utils/style/common.py +0 -0
- {streamlit_octostar_utils-0.5.0.dev15 → streamlit_octostar_utils-0.5.0.dev17}/streamlit_octostar_utils/threading/__init__.py +0 -0
- {streamlit_octostar_utils-0.5.0.dev15 → streamlit_octostar_utils-0.5.0.dev17}/streamlit_octostar_utils/threading/async_task_manager.py +0 -0
- {streamlit_octostar_utils-0.5.0.dev15 → streamlit_octostar_utils-0.5.0.dev17}/streamlit_octostar_utils/threading/session_callback_manager.py +0 -0
- {streamlit_octostar_utils-0.5.0.dev15 → streamlit_octostar_utils-0.5.0.dev17}/streamlit_octostar_utils/threading/session_state_hot_swapper.py +0 -0
|
@@ -258,7 +258,7 @@ class CeleryExecutor(object):
|
|
|
258
258
|
self._last_stall_check = 0
|
|
259
259
|
self._stall_check_interval = 60
|
|
260
260
|
|
|
261
|
-
|
|
261
|
+
self._is_owner = False
|
|
262
262
|
self.set_cleanup_task()
|
|
263
263
|
self.register_state_signals()
|
|
264
264
|
|
|
@@ -323,6 +323,9 @@ class CeleryExecutor(object):
|
|
|
323
323
|
|
|
324
324
|
def cleanup_task_results(in_dir, out_dir, redis_host, redis_port, task_expires, result_expires):
|
|
325
325
|
logger.info("Starting cleanup of expired task results...")
|
|
326
|
+
if not os.path.isdir(in_dir) or not os.path.isdir(out_dir):
|
|
327
|
+
logger.warning(f"Data directories missing (in={os.path.isdir(in_dir)}, out={os.path.isdir(out_dir)}), skipping cleanup")
|
|
328
|
+
return
|
|
326
329
|
redis_client = redis.StrictRedis(host=redis_host, port=redis_port)
|
|
327
330
|
for file_name in os.listdir(in_dir):
|
|
328
331
|
file_path = os.path.join(in_dir, file_name)
|
|
@@ -392,6 +395,8 @@ class CeleryExecutor(object):
|
|
|
392
395
|
}
|
|
393
396
|
|
|
394
397
|
def start(self):
|
|
398
|
+
self._is_owner = True
|
|
399
|
+
atexit.register(self.close)
|
|
395
400
|
logger.info("Initializing data folders...")
|
|
396
401
|
shutil.rmtree(self.root_folder, ignore_errors=True)
|
|
397
402
|
for folder in [self.in_folder, self.out_folder]:
|
|
@@ -591,6 +596,9 @@ class CeleryExecutor(object):
|
|
|
591
596
|
logger.error(f"Error checking stall for queue '{queue_name}': {e}")
|
|
592
597
|
|
|
593
598
|
def close(self):
|
|
599
|
+
if not self._is_owner:
|
|
600
|
+
return
|
|
601
|
+
self._is_owner = False
|
|
594
602
|
self.stop_event.set()
|
|
595
603
|
if self.worker_health_check_thread and self.worker_health_check_thread.is_alive():
|
|
596
604
|
self.worker_health_check_thread.join(timeout=2)
|
|
@@ -883,6 +891,13 @@ class CeleryExecutor(object):
|
|
|
883
891
|
self.get_thread_pool, _poll_task_state, self.app, task_id
|
|
884
892
|
)
|
|
885
893
|
|
|
894
|
+
async def get_task_info(self, task_id):
|
|
895
|
+
def _get_info(celery_app, task_id):
|
|
896
|
+
return celery_app.AsyncResult(task_id).info
|
|
897
|
+
return await asyncio.get_running_loop().run_in_executor(
|
|
898
|
+
self.get_thread_pool, _get_info, self.app, task_id,
|
|
899
|
+
)
|
|
900
|
+
|
|
886
901
|
async def get_task_result(self, task_id, remove=False):
|
|
887
902
|
def _try_get_task_data(celery_app, task_id):
|
|
888
903
|
async_result = celery_app.AsyncResult(task_id)
|
|
@@ -1010,10 +1025,12 @@ class FastAPICeleryTaskRoute(Route):
|
|
|
1010
1025
|
data = {"task_state": "UNKNOWN", "task_id": task_id}
|
|
1011
1026
|
elif state in ["AWAITING", "STARTED"]:
|
|
1012
1027
|
data = {"task_state": state, "task_id": task_id}
|
|
1028
|
+
if state == "STARTED":
|
|
1029
|
+
info = await self.celery_executor.get_task_info(task_id)
|
|
1030
|
+
if info and isinstance(info, dict):
|
|
1031
|
+
data["progress"] = info
|
|
1013
1032
|
elif state == "SUCCESS":
|
|
1014
1033
|
data = {"task_state": state, "task_id": task_id, "data": result}
|
|
1015
|
-
elif state == "STARTED":
|
|
1016
|
-
data = {"task_status": state, "task_id": task_id}
|
|
1017
1034
|
else:
|
|
1018
1035
|
raise ValueError(f"Unknown task state {state}!")
|
|
1019
1036
|
return CommonModels.DataResponseModel(data=data)
|
|
@@ -1446,6 +1446,7 @@ class NifiEntity(object):
|
|
|
1446
1446
|
source_entity_relationship=SOURCE_FRAGMENT_ENTITY_RELATIONSHIP,
|
|
1447
1447
|
):
|
|
1448
1448
|
fields = {
|
|
1449
|
+
**{k: v for k, v in self.record if k.startswith("fragment") and v is not None},
|
|
1449
1450
|
**fields,
|
|
1450
1451
|
"os_parent_uid": self.record["os_entity_uid"],
|
|
1451
1452
|
"source_entity_uid": source_entity_uid,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|