intellif-aihub 0.1.1__py3-none-any.whl → 0.1.3__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 intellif-aihub might be problematic. Click here for more details.
- aihub/__init__.py +1 -4
- aihub/client.py +91 -0
- aihub/exceptions.py +18 -0
- aihub/models/__init__.py +0 -0
- aihub/models/artifact.py +137 -0
- aihub/models/common.py +13 -0
- aihub/models/dataset_management.py +99 -0
- aihub/models/document_center.py +28 -0
- aihub/models/labelfree.py +31 -0
- aihub/models/model_training_platform.py +230 -0
- aihub/models/quota_schedule_management.py +0 -0
- aihub/models/tag_resource_management.py +50 -0
- aihub/models/task_center.py +117 -0
- aihub/models/user_system.py +262 -0
- aihub/services/__init__.py +0 -0
- aihub/services/artifact.py +353 -0
- aihub/services/dataset_management.py +240 -0
- aihub/services/document_center.py +43 -0
- aihub/services/labelfree.py +44 -0
- aihub/services/model_training_platform.py +135 -0
- aihub/services/quota_schedule_management.py +18 -0
- aihub/services/reporter.py +20 -0
- aihub/services/tag_resource_management.py +55 -0
- aihub/services/task_center.py +190 -0
- aihub/services/user_system.py +339 -0
- aihub/utils/__init__.py +0 -0
- aihub/utils/download.py +69 -0
- aihub/utils/http.py +13 -0
- aihub/utils/s3.py +77 -0
- intellif_aihub-0.1.3.dist-info/METADATA +110 -0
- intellif_aihub-0.1.3.dist-info/RECORD +34 -0
- aihub/_version.py +0 -1
- aihub/stop.py +0 -50
- intellif_aihub-0.1.1.dist-info/METADATA +0 -24
- intellif_aihub-0.1.1.dist-info/RECORD +0 -8
- {intellif_aihub-0.1.1.dist-info → intellif_aihub-0.1.3.dist-info}/WHEEL +0 -0
- {intellif_aihub-0.1.1.dist-info → intellif_aihub-0.1.3.dist-info}/licenses/LICENSE +0 -0
- {intellif_aihub-0.1.1.dist-info → intellif_aihub-0.1.3.dist-info}/top_level.txt +0 -0
aihub/stop.py
DELETED
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
import logging
|
|
2
|
-
import os
|
|
3
|
-
import threading
|
|
4
|
-
import time
|
|
5
|
-
from pathlib import Path
|
|
6
|
-
from typing import Callable, List
|
|
7
|
-
|
|
8
|
-
_LOGGER = logging.getLogger("aihub.stop")
|
|
9
|
-
|
|
10
|
-
_ENV_KEY = "PRE_STOP_SENTINEL_FILE"
|
|
11
|
-
_DEFAULT_SENTINEL = "/tmp/pre_stop_sentinel_file"
|
|
12
|
-
|
|
13
|
-
_sentinel_path = Path(os.getenv(_ENV_KEY, _DEFAULT_SENTINEL))
|
|
14
|
-
_flag: bool = False # cached result
|
|
15
|
-
_callbacks: List[Callable[[], None]] = []
|
|
16
|
-
_watch_started: bool = False # ensure single watcher
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
def _check() -> bool:
|
|
20
|
-
global _flag
|
|
21
|
-
if not _flag and _sentinel_path.exists():
|
|
22
|
-
_flag = True
|
|
23
|
-
_trigger_callbacks()
|
|
24
|
-
return _flag
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
def _trigger_callbacks() -> None:
|
|
28
|
-
for cb in _callbacks:
|
|
29
|
-
try:
|
|
30
|
-
cb()
|
|
31
|
-
except Exception as exc:
|
|
32
|
-
_LOGGER.exception("aihub callback raised: %s", exc, exc_info=exc)
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
def is_pre_stopped() -> bool:
|
|
36
|
-
return _check()
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
def on_pre_stop(func: Callable[[], None], *, poll_interval: float = 1.0) -> None:
|
|
40
|
-
global _watch_started
|
|
41
|
-
_callbacks.append(func)
|
|
42
|
-
if _watch_started:
|
|
43
|
-
return
|
|
44
|
-
|
|
45
|
-
def _watch() -> None:
|
|
46
|
-
while not _check():
|
|
47
|
-
time.sleep(poll_interval)
|
|
48
|
-
|
|
49
|
-
threading.Thread(target=_watch, daemon=True, name="aihub-stop-watcher").start()
|
|
50
|
-
_watch_started = True
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
Metadata-Version: 2.4
|
|
2
|
-
Name: intellif-aihub
|
|
3
|
-
Version: 0.1.1
|
|
4
|
-
Summary: Intellif AI-hub Utils.
|
|
5
|
-
Author-email: Platform Team <aihub@example.com>
|
|
6
|
-
License-Expression: Apache-2.0
|
|
7
|
-
Keywords: kubernetes,graceful-shutdown,sentinel-file
|
|
8
|
-
Classifier: Programming Language :: Python :: 3
|
|
9
|
-
Classifier: Operating System :: OS Independent
|
|
10
|
-
Requires-Python: >=3.7
|
|
11
|
-
Description-Content-Type: text/markdown
|
|
12
|
-
License-File: LICENSE
|
|
13
|
-
Dynamic: license-file
|
|
14
|
-
|
|
15
|
-
# intellif-aihub
|
|
16
|
-
|
|
17
|
-
Detect Kubernetes pre-stop lifecycle events with a simple sentinel file.
|
|
18
|
-
|
|
19
|
-
```python
|
|
20
|
-
import aihub
|
|
21
|
-
|
|
22
|
-
while training:
|
|
23
|
-
if aihub.is_stopped():
|
|
24
|
-
save_checkpoint(); break
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
aihub/__init__.py,sha256=Wb0FF6TmLkqxgd_NwW2h8ysDGVkP8HlLqKqmWwla3zo,144
|
|
2
|
-
aihub/_version.py,sha256=5xvN_gb61nKeq5TER5dSfcArTP3DVasZGN_MQq5dNpA,23
|
|
3
|
-
aihub/stop.py,sha256=7VX4xJTg3M1eqv7gLp0qwvUmzFsRz38Urawx4rZtZ3E,1278
|
|
4
|
-
intellif_aihub-0.1.1.dist-info/licenses/LICENSE,sha256=WtjCEwlcVzkh1ziO35P2qfVEkLjr87Flro7xlHz3CEY,11556
|
|
5
|
-
intellif_aihub-0.1.1.dist-info/METADATA,sha256=owcU-_Q0kA_HfZfO2Q2HKMV2iwaatKbaR_l9dCRIa8U,617
|
|
6
|
-
intellif_aihub-0.1.1.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
7
|
-
intellif_aihub-0.1.1.dist-info/top_level.txt,sha256=vIvTtSIN73xv46BpYM-ctVGnyOiUQ9EWP_6ngvdIlvw,6
|
|
8
|
-
intellif_aihub-0.1.1.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|