aap-utils 0.2.8__py3-none-any.whl → 0.2.9__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/cli.py CHANGED
@@ -1,6 +1,7 @@
1
1
  import os
2
2
  import re
3
3
  import requests
4
+ import socket # To get the hostname
4
5
 
5
6
  API_URL = "http://commit-svc.aiplatform/publish"
6
7
 
@@ -36,10 +37,20 @@ def get_username():
36
37
  username = os.getenv("KERNEL_AP_USER", "unname")
37
38
  return format_name(username)
38
39
 
40
+ def get_namespace():
41
+ """Retrieve the namespace from the environment variable KERNEL_NAMESPACE or use 'default'."""
42
+ return os.getenv("KERNEL_NAMESPACE", "default")
43
+
44
+ def get_pod():
45
+ """Retrieve the pod name using the hostname."""
46
+ return socket.gethostname()
47
+
39
48
  def publish_env():
40
49
  """Handles the 'aap_utils publish env' command and sends a POST request."""
41
50
  username = get_username()
42
51
  default_image = extract_default_image()
52
+ namespace = get_namespace()
53
+ pod = get_pod()
43
54
 
44
55
  while True:
45
56
  image_name = input(f"Enter image name [{default_image}]: ").strip() or default_image
@@ -58,7 +69,9 @@ def publish_env():
58
69
  data = {
59
70
  "username": username,
60
71
  "imagename": image_name,
61
- "tags": formatted_tags
72
+ "tags": formatted_tags,
73
+ "namespace": namespace,
74
+ "pod": pod
62
75
  }
63
76
 
64
77
  print(f"Publishing environment: {username}/{image_name}:{';'.join(formatted_tags)}")
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: aap_utils
3
- Version: 0.2.8
3
+ Version: 0.2.9
4
4
  Summary: A Python library for registering an IP address for AAP
5
5
  Author: Minh Dang
6
6
  Author-email: danghoangminh86@gmail.com
@@ -0,0 +1,8 @@
1
+ aap_utils/__init__.py,sha256=g6G3i3a5ANDJWqFX2oPsLpP93aTaoTj0gkMQzeqQIJw,172
2
+ aap_utils/cli.py,sha256=lEnZeDeKe9a7VthrTWeRx0SBox6Hi_GzwN1k4b0MKQI,3657
3
+ aap_utils/register.py,sha256=J9tukByU1mcy4SoaJOoGY8jjzL9JMuNTZGtCBSwwon0,3823
4
+ aap_utils-0.2.9.dist-info/METADATA,sha256=ts-P_XFJj3IrM2QlE8jZCcOYMxoblnmCFL75ll7yL6Y,346
5
+ aap_utils-0.2.9.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
6
+ aap_utils-0.2.9.dist-info/entry_points.txt,sha256=K-h2toLoqFxAg4Bx2r7FWggKgYnAX9zp9s4Ms4r-d6s,49
7
+ aap_utils-0.2.9.dist-info/top_level.txt,sha256=Qt5xmL8_0_jhMl9uA3lg-xnvs4nCEyVj1tBE4vnp36M,10
8
+ aap_utils-0.2.9.dist-info/RECORD,,
@@ -1,8 +0,0 @@
1
- aap_utils/__init__.py,sha256=g6G3i3a5ANDJWqFX2oPsLpP93aTaoTj0gkMQzeqQIJw,172
2
- aap_utils/cli.py,sha256=zoEpbTO-trWh-lqJVYMoT7VBQSak1Q019Mwwrsmay10,3244
3
- aap_utils/register.py,sha256=J9tukByU1mcy4SoaJOoGY8jjzL9JMuNTZGtCBSwwon0,3823
4
- aap_utils-0.2.8.dist-info/METADATA,sha256=Ye5mZTmyURwfXnmO1n4kvxFzrp5m1pIDLQll_EiD8mU,346
5
- aap_utils-0.2.8.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
6
- aap_utils-0.2.8.dist-info/entry_points.txt,sha256=K-h2toLoqFxAg4Bx2r7FWggKgYnAX9zp9s4Ms4r-d6s,49
7
- aap_utils-0.2.8.dist-info/top_level.txt,sha256=Qt5xmL8_0_jhMl9uA3lg-xnvs4nCEyVj1tBE4vnp36M,10
8
- aap_utils-0.2.8.dist-info/RECORD,,