streamlit-octostar-utils 0.5.4.dev4__tar.gz → 0.5.4.dev5__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.4.dev4 → streamlit_octostar_utils-0.5.4.dev5}/PKG-INFO +1 -1
- {streamlit_octostar_utils-0.5.4.dev4 → streamlit_octostar_utils-0.5.4.dev5}/pyproject.toml +1 -1
- {streamlit_octostar_utils-0.5.4.dev4 → streamlit_octostar_utils-0.5.4.dev5}/streamlit_octostar_utils/api_crafter/celery.py +25 -14
- {streamlit_octostar_utils-0.5.4.dev4 → streamlit_octostar_utils-0.5.4.dev5}/LICENSE +0 -0
- {streamlit_octostar_utils-0.5.4.dev4 → streamlit_octostar_utils-0.5.4.dev5}/README.md +0 -0
- {streamlit_octostar_utils-0.5.4.dev4 → streamlit_octostar_utils-0.5.4.dev5}/streamlit_octostar_utils/__init__.py +0 -0
- {streamlit_octostar_utils-0.5.4.dev4 → streamlit_octostar_utils-0.5.4.dev5}/streamlit_octostar_utils/api_crafter/__init__.py +0 -0
- {streamlit_octostar_utils-0.5.4.dev4 → streamlit_octostar_utils-0.5.4.dev5}/streamlit_octostar_utils/api_crafter/contents.py +0 -0
- {streamlit_octostar_utils-0.5.4.dev4 → streamlit_octostar_utils-0.5.4.dev5}/streamlit_octostar_utils/api_crafter/fastapi.py +0 -0
- {streamlit_octostar_utils-0.5.4.dev4 → streamlit_octostar_utils-0.5.4.dev5}/streamlit_octostar_utils/api_crafter/nifi.py +0 -0
- {streamlit_octostar_utils-0.5.4.dev4 → streamlit_octostar_utils-0.5.4.dev5}/streamlit_octostar_utils/api_crafter/parallelism.py +0 -0
- {streamlit_octostar_utils-0.5.4.dev4 → streamlit_octostar_utils-0.5.4.dev5}/streamlit_octostar_utils/api_crafter/parser/__init__.py +0 -0
- {streamlit_octostar_utils-0.5.4.dev4 → streamlit_octostar_utils-0.5.4.dev5}/streamlit_octostar_utils/api_crafter/parser/combine_fields.py +0 -0
- {streamlit_octostar_utils-0.5.4.dev4 → streamlit_octostar_utils-0.5.4.dev5}/streamlit_octostar_utils/api_crafter/parser/entities_parser.py +0 -0
- {streamlit_octostar_utils-0.5.4.dev4 → streamlit_octostar_utils-0.5.4.dev5}/streamlit_octostar_utils/api_crafter/parser/generics.py +0 -0
- {streamlit_octostar_utils-0.5.4.dev4 → streamlit_octostar_utils-0.5.4.dev5}/streamlit_octostar_utils/api_crafter/parser/info.py +0 -0
- {streamlit_octostar_utils-0.5.4.dev4 → streamlit_octostar_utils-0.5.4.dev5}/streamlit_octostar_utils/api_crafter/parser/linkchart_functions.py +0 -0
- {streamlit_octostar_utils-0.5.4.dev4 → streamlit_octostar_utils-0.5.4.dev5}/streamlit_octostar_utils/api_crafter/parser/matches.py +0 -0
- {streamlit_octostar_utils-0.5.4.dev4 → streamlit_octostar_utils-0.5.4.dev5}/streamlit_octostar_utils/api_crafter/parser/parameters.py +0 -0
- {streamlit_octostar_utils-0.5.4.dev4 → streamlit_octostar_utils-0.5.4.dev5}/streamlit_octostar_utils/api_crafter/parser/rules.py +0 -0
- {streamlit_octostar_utils-0.5.4.dev4 → streamlit_octostar_utils-0.5.4.dev5}/streamlit_octostar_utils/api_crafter/parser/signals.py +0 -0
- {streamlit_octostar_utils-0.5.4.dev4 → streamlit_octostar_utils-0.5.4.dev5}/streamlit_octostar_utils/core/__init__.py +0 -0
- {streamlit_octostar_utils-0.5.4.dev4 → streamlit_octostar_utils-0.5.4.dev5}/streamlit_octostar_utils/core/dict.py +0 -0
- {streamlit_octostar_utils-0.5.4.dev4 → streamlit_octostar_utils-0.5.4.dev5}/streamlit_octostar_utils/core/filetypes.py +0 -0
- {streamlit_octostar_utils-0.5.4.dev4 → streamlit_octostar_utils-0.5.4.dev5}/streamlit_octostar_utils/core/threading/__init__.py +0 -0
- {streamlit_octostar_utils-0.5.4.dev4 → streamlit_octostar_utils-0.5.4.dev5}/streamlit_octostar_utils/core/threading/key_queue.py +0 -0
- {streamlit_octostar_utils-0.5.4.dev4 → streamlit_octostar_utils-0.5.4.dev5}/streamlit_octostar_utils/core/timestamp.py +0 -0
- {streamlit_octostar_utils-0.5.4.dev4 → streamlit_octostar_utils-0.5.4.dev5}/streamlit_octostar_utils/nlp/__init__.py +0 -0
- {streamlit_octostar_utils-0.5.4.dev4 → streamlit_octostar_utils-0.5.4.dev5}/streamlit_octostar_utils/nlp/custom_recognizers.py +0 -0
- {streamlit_octostar_utils-0.5.4.dev4 → streamlit_octostar_utils-0.5.4.dev5}/streamlit_octostar_utils/nlp/language.py +0 -0
- {streamlit_octostar_utils-0.5.4.dev4 → streamlit_octostar_utils-0.5.4.dev5}/streamlit_octostar_utils/nlp/ner.py +0 -0
- {streamlit_octostar_utils-0.5.4.dev4 → streamlit_octostar_utils-0.5.4.dev5}/streamlit_octostar_utils/octostar/__init__.py +0 -0
- {streamlit_octostar_utils-0.5.4.dev4 → streamlit_octostar_utils-0.5.4.dev5}/streamlit_octostar_utils/octostar/client.py +0 -0
- {streamlit_octostar_utils-0.5.4.dev4 → streamlit_octostar_utils-0.5.4.dev5}/streamlit_octostar_utils/octostar/context.py +0 -0
- {streamlit_octostar_utils-0.5.4.dev4 → streamlit_octostar_utils-0.5.4.dev5}/streamlit_octostar_utils/octostar/permissions.py +0 -0
- {streamlit_octostar_utils-0.5.4.dev4 → streamlit_octostar_utils-0.5.4.dev5}/streamlit_octostar_utils/ontology/__init__.py +0 -0
- {streamlit_octostar_utils-0.5.4.dev4 → streamlit_octostar_utils-0.5.4.dev5}/streamlit_octostar_utils/ontology/inheritance.py +0 -0
- {streamlit_octostar_utils-0.5.4.dev4 → streamlit_octostar_utils-0.5.4.dev5}/streamlit_octostar_utils/ontology/relationships.py +0 -0
- {streamlit_octostar_utils-0.5.4.dev4 → streamlit_octostar_utils-0.5.4.dev5}/streamlit_octostar_utils/ontology/validation.py +0 -0
- {streamlit_octostar_utils-0.5.4.dev4 → streamlit_octostar_utils-0.5.4.dev5}/streamlit_octostar_utils/style/__init__.py +0 -0
- {streamlit_octostar_utils-0.5.4.dev4 → streamlit_octostar_utils-0.5.4.dev5}/streamlit_octostar_utils/style/common.py +0 -0
- {streamlit_octostar_utils-0.5.4.dev4 → streamlit_octostar_utils-0.5.4.dev5}/streamlit_octostar_utils/threading/__init__.py +0 -0
- {streamlit_octostar_utils-0.5.4.dev4 → streamlit_octostar_utils-0.5.4.dev5}/streamlit_octostar_utils/threading/async_task_manager.py +0 -0
- {streamlit_octostar_utils-0.5.4.dev4 → streamlit_octostar_utils-0.5.4.dev5}/streamlit_octostar_utils/threading/session_callback_manager.py +0 -0
- {streamlit_octostar_utils-0.5.4.dev4 → streamlit_octostar_utils-0.5.4.dev5}/streamlit_octostar_utils/threading/session_state_hot_swapper.py +0 -0
|
@@ -122,7 +122,7 @@ class MemoryMonitor:
|
|
|
122
122
|
|
|
123
123
|
_DEFAULTS = {
|
|
124
124
|
"sample_interval": 30,
|
|
125
|
-
"
|
|
125
|
+
"warn_memory_per_child": None,
|
|
126
126
|
"gc_collect_on_end": True,
|
|
127
127
|
"malloc_trim_on_end": True,
|
|
128
128
|
}
|
|
@@ -138,7 +138,7 @@ class MemoryMonitor:
|
|
|
138
138
|
if config and isinstance(config, dict):
|
|
139
139
|
cfg.update({k: v for k, v in config.items() if v is not None})
|
|
140
140
|
self._sample_interval = cfg["sample_interval"]
|
|
141
|
-
self.
|
|
141
|
+
self._warn_memory_per_child = cfg["warn_memory_per_child"]
|
|
142
142
|
self._gc_collect_on_end = cfg["gc_collect_on_end"]
|
|
143
143
|
self._malloc_trim_on_end = cfg["malloc_trim_on_end"]
|
|
144
144
|
|
|
@@ -173,15 +173,18 @@ class MemoryMonitor:
|
|
|
173
173
|
return "?"
|
|
174
174
|
|
|
175
175
|
def _resolve_threshold(self, queue):
|
|
176
|
-
"""Resolve ``
|
|
176
|
+
"""Resolve ``warn_memory_per_child`` (KiB) for *queue*.
|
|
177
177
|
|
|
178
|
-
|
|
179
|
-
|
|
178
|
+
Returns the threshold in MiB (converted from KiB config) for
|
|
179
|
+
comparison with RSS readings, or ``None`` when unconfigured.
|
|
180
180
|
"""
|
|
181
|
-
|
|
182
|
-
if not isinstance(
|
|
181
|
+
thresholds = self._warn_memory_per_child
|
|
182
|
+
if not isinstance(thresholds, dict):
|
|
183
183
|
return None
|
|
184
|
-
|
|
184
|
+
kib = thresholds.get(queue)
|
|
185
|
+
if kib is None:
|
|
186
|
+
return None
|
|
187
|
+
return kib / 1024
|
|
185
188
|
|
|
186
189
|
def _try_malloc_trim(self):
|
|
187
190
|
"""Ask glibc to return free pages to the OS. No-op on non-Linux."""
|
|
@@ -201,8 +204,8 @@ class MemoryMonitor:
|
|
|
201
204
|
|
|
202
205
|
logger.info(
|
|
203
206
|
"[MEM] Memory monitor enabled: sample_interval=%s, "
|
|
204
|
-
"
|
|
205
|
-
self._sample_interval,
|
|
207
|
+
"gc_collect=%s, malloc_trim=%s",
|
|
208
|
+
self._sample_interval,
|
|
206
209
|
self._gc_collect_on_end, self._malloc_trim_on_end,
|
|
207
210
|
)
|
|
208
211
|
|
|
@@ -348,12 +351,14 @@ class CeleryQueueConfig:
|
|
|
348
351
|
max_tasks_in_queue=None,
|
|
349
352
|
max_tasks_per_child=None,
|
|
350
353
|
max_memory_per_child=None,
|
|
354
|
+
warn_memory_per_child=None,
|
|
351
355
|
**options,
|
|
352
356
|
):
|
|
353
357
|
self.n_workers = n_workers
|
|
354
358
|
self.max_tasks_in_queue = max_tasks_in_queue
|
|
355
359
|
self.max_tasks_per_child = max_tasks_per_child
|
|
356
|
-
self.max_memory_per_child = max_memory_per_child # KiB
|
|
360
|
+
self.max_memory_per_child = max_memory_per_child # KiB — hard limit, worker restarted
|
|
361
|
+
self.warn_memory_per_child = warn_memory_per_child # KiB — soft limit, logs WARNING
|
|
357
362
|
self.options = options
|
|
358
363
|
|
|
359
364
|
|
|
@@ -555,9 +560,15 @@ class CeleryExecutor(object):
|
|
|
555
560
|
|
|
556
561
|
self._memory_monitor = None
|
|
557
562
|
if memory_monitor:
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
563
|
+
mm_cfg = dict(memory_monitor) if isinstance(memory_monitor, dict) else {}
|
|
564
|
+
thresholds = {
|
|
565
|
+
q: qc.warn_memory_per_child
|
|
566
|
+
for q, qc in self.queue_config.items()
|
|
567
|
+
if qc.warn_memory_per_child is not None
|
|
568
|
+
}
|
|
569
|
+
if thresholds:
|
|
570
|
+
mm_cfg["warn_memory_per_child"] = thresholds
|
|
571
|
+
self._memory_monitor = MemoryMonitor(mm_cfg)
|
|
561
572
|
|
|
562
573
|
self._is_owner = False
|
|
563
574
|
self.set_cleanup_task()
|
|
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
|
|
File without changes
|