aap-utils 0.1.22__py3-none-any.whl → 0.2.0__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.
- aap_utils/__init__.py +4 -3
- aap_utils/cli.py +40 -0
- aap_utils/register.py +1 -1
- {aap_utils-0.1.22.dist-info → aap_utils-0.2.0.dist-info}/METADATA +1 -1
- aap_utils-0.2.0.dist-info/RECORD +8 -0
- aap_utils-0.2.0.dist-info/entry_points.txt +2 -0
- aap_utils-0.1.22.dist-info/RECORD +0 -6
- {aap_utils-0.1.22.dist-info → aap_utils-0.2.0.dist-info}/WHEEL +0 -0
- {aap_utils-0.1.22.dist-info → aap_utils-0.2.0.dist-info}/top_level.txt +0 -0
aap_utils/__init__.py
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
-
from .register import register_demo
|
2
|
-
|
3
|
-
|
1
|
+
from .register import register_demo, get_config, get_mlflow_url
|
2
|
+
|
3
|
+
# CLI should not interfere with normal imports
|
4
|
+
__all__ = ["register_demo", "get_config", "get_mlflow_url"]
|
aap_utils/cli.py
ADDED
@@ -0,0 +1,40 @@
|
|
1
|
+
import os
|
2
|
+
|
3
|
+
def extract_default_image():
|
4
|
+
"""Extracts the image name from KERNEL_IMAGE if available."""
|
5
|
+
kernel_image = os.getenv("KERNEL_IMAGE", "admin/base_kernel_gpu@sha256:3024")
|
6
|
+
return kernel_image.split("/")[1].split("@")[0] # Extract "base_kernel_gpu"
|
7
|
+
|
8
|
+
def validate_image_name(image_name):
|
9
|
+
"""Validate image name format."""
|
10
|
+
return bool(image_name and image_name.strip())
|
11
|
+
|
12
|
+
def validate_tags(tags):
|
13
|
+
"""Ensure tags are non-empty and separated by semicolon."""
|
14
|
+
tag_list = [tag.strip() for tag in tags.split(";") if tag.strip()]
|
15
|
+
return len(tag_list) > 0
|
16
|
+
|
17
|
+
def publish_env():
|
18
|
+
"""Handles the 'aap_utils publish env' command."""
|
19
|
+
default_image = extract_default_image()
|
20
|
+
|
21
|
+
while True:
|
22
|
+
image_name = input(f"Enter image name [{default_image}]: ").strip() or default_image
|
23
|
+
if validate_image_name(image_name):
|
24
|
+
break
|
25
|
+
print("Invalid image name. Please try again.")
|
26
|
+
|
27
|
+
while True:
|
28
|
+
tags = input("Enter tags (separated by ';'): ").strip()
|
29
|
+
if validate_tags(tags):
|
30
|
+
break
|
31
|
+
print("Invalid tags. Please enter at least one tag, separated by ';'.")
|
32
|
+
|
33
|
+
print(f"Publishing environment with Image: {image_name}, Tags: {tags}")
|
34
|
+
|
35
|
+
def main():
|
36
|
+
import sys
|
37
|
+
if len(sys.argv) > 2 and sys.argv[1] == "publish" and sys.argv[2] == "env":
|
38
|
+
publish_env()
|
39
|
+
else:
|
40
|
+
print("Usage: aap_utils publish env")
|
aap_utils/register.py
CHANGED
@@ -92,4 +92,4 @@ def get_mlflow_url(domain_name = "aiplatform.vcntt.tech"):
|
|
92
92
|
kernel_namespace = os.getenv("KERNEL_NAMESPACE", "default_namespace") # Default if not set
|
93
93
|
mlflow_url = f"https://{kernel_namespace.replace('machinelearning', 'appmachine')}.{domain_name}/private/mlflow"
|
94
94
|
|
95
|
-
return os.environ.get('MLFLOW_URI') mlflow_url
|
95
|
+
return os.environ.get('MLFLOW_URI'), mlflow_url
|
@@ -0,0 +1,8 @@
|
|
1
|
+
aap_utils/__init__.py,sha256=g6G3i3a5ANDJWqFX2oPsLpP93aTaoTj0gkMQzeqQIJw,172
|
2
|
+
aap_utils/cli.py,sha256=TSh2o6CpkiVodF4t88RA3LrAj_aymmb8szl5t7CWMT4,1410
|
3
|
+
aap_utils/register.py,sha256=J9tukByU1mcy4SoaJOoGY8jjzL9JMuNTZGtCBSwwon0,3823
|
4
|
+
aap_utils-0.2.0.dist-info/METADATA,sha256=SOAQ8YL8coe3-28zEDp7izDbgB5UcLd7GeLSEBnoLFo,346
|
5
|
+
aap_utils-0.2.0.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
|
6
|
+
aap_utils-0.2.0.dist-info/entry_points.txt,sha256=K-h2toLoqFxAg4Bx2r7FWggKgYnAX9zp9s4Ms4r-d6s,49
|
7
|
+
aap_utils-0.2.0.dist-info/top_level.txt,sha256=Qt5xmL8_0_jhMl9uA3lg-xnvs4nCEyVj1tBE4vnp36M,10
|
8
|
+
aap_utils-0.2.0.dist-info/RECORD,,
|
@@ -1,6 +0,0 @@
|
|
1
|
-
aap_utils/__init__.py,sha256=Px9phm-1DU2yq-wUjKg9zEmRWbcLpWAYG-9AlnNVmCc,105
|
2
|
-
aap_utils/register.py,sha256=-vftTcE0Ii8TQnaev5cH3vpxPvlDQjnin-OBtgl7be4,3822
|
3
|
-
aap_utils-0.1.22.dist-info/METADATA,sha256=ISZYkmaRoSAvlJ0aj1T90OD0pD6SQYWU8O2xa7eaXEY,347
|
4
|
-
aap_utils-0.1.22.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
|
5
|
-
aap_utils-0.1.22.dist-info/top_level.txt,sha256=Qt5xmL8_0_jhMl9uA3lg-xnvs4nCEyVj1tBE4vnp36M,10
|
6
|
-
aap_utils-0.1.22.dist-info/RECORD,,
|
File without changes
|
File without changes
|