aap-utils 0.1.2__py3-none-any.whl → 0.1.4__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_kcn.py ADDED
@@ -0,0 +1,19 @@
1
+ import os
2
+ from hydra import initialize, compose
3
+ from omegaconf import OmegaConf, DictConfig
4
+ kcn_params = "config.yaml"
5
+ config_path="configs/"
6
+ overrides = []
7
+
8
+ if os.environ.get('KCN_PARAMS') and os.environ.get('KCN_PARAMS') != '':
9
+ full_path = os.getenv('KCN_PARAMS')
10
+ full_path = "../" + full_path
11
+ config_path = os.path.dirname(full_path)
12
+ kcn_params = os.path.basename(full_path) # Extract the filename
13
+
14
+ if os.environ.get('KCN_OVERRIDES') and os.environ.get('KCN_OVERRIDES') != '':
15
+ overrides_env = os.getenv("KCN_OVERRIDES")
16
+ overrides = overrides_env.split('|') if overrides_env else []
17
+
18
+ with initialize(version_base=None, config_path=config_path):
19
+ args = compose(config_name=kcn_params)
aap_utils/register.py CHANGED
@@ -2,6 +2,8 @@ import socket
2
2
  import requests
3
3
  import time
4
4
  import os
5
+ from hydra import initialize, compose
6
+ from omegaconf import OmegaConf, DictConfig
5
7
 
6
8
  def register_demo(debug=False):
7
9
  for attempt in range(10):
@@ -13,7 +15,11 @@ def register_demo(debug=False):
13
15
  headers={"Content-Type": "application/json"}
14
16
  )
15
17
  if response.ok:
16
- url, namespace = create_url()
18
+ response_json = response.json()
19
+ argo_host = response_json.get('ARGOWORKFLOW_HOST', 'http://argowf.aiplatform.vcntt.tech')
20
+ domain_name = argo_host.split("argowf.")[-1]
21
+ url, namespace = create_url(domain_name=domain_name)
22
+
17
23
  # print(f"The demo service is at {namespace}.your_custorm_domain/demo/. Eg: {url}")
18
24
  print(f"The demo service is at {url}")
19
25
  if debug:
@@ -51,5 +57,24 @@ def create_url(domain_name = "aiplatform.vcntt.tech"):
51
57
  raise ValueError(f"The KERNEL_NAMESPACE '{kernel_namespace}' does not follow the expected format.")
52
58
 
53
59
  # Create the final URL
54
- url = f"https://{transformed_namespace}.{domain_name}/demo/"
60
+ url = f"https://{transformed_namespace}.{domain_name}"
55
61
  return url, transformed_namespace
62
+
63
+
64
+ def get_args():
65
+ kcn_params = "config.yaml"
66
+ config_path="configs/config.yaml"
67
+ overrides = []
68
+
69
+ if os.environ.get('KCN_PARAMS') and os.environ.get('KCN_PARAMS') != '':
70
+ full_path = os.getenv('KCN_PARAMS')
71
+ config_path = os.path.join(config_path, kcn_params)
72
+ kcn_params = os.path.basename(full_path) # Extract the filename
73
+
74
+ if os.environ.get('KCN_OVERRIDES') and os.environ.get('KCN_OVERRIDES') != '':
75
+ overrides_env = os.getenv("KCN_OVERRIDES")
76
+ overrides = overrides_env.split('|') if overrides_env else []
77
+
78
+ with initialize(version_base=None, config_path=config_path):
79
+ args = compose(config_name=kcn_params)
80
+ return args
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: aap-utils
3
- Version: 0.1.2
3
+ Version: 0.1.4
4
4
  Summary: A Python library for registering an IP address for AAP
5
5
  Home-page: UNKNOWN
6
6
  Author: Minh Dang
@@ -0,0 +1,7 @@
1
+ aap_utils/__init__.py,sha256=OALCpHMgWzr-3Lu7eKwalsw5GNCwWWkETUPHOqfGXsg,36
2
+ aap_utils/init_kcn.py,sha256=FMX9w0WoaP6I3yc3xn8xqGYT2VbtG2uJbwpTKouZpew,718
3
+ aap_utils/register.py,sha256=YDUvUtoICYVMuuzYAueb34ZtGcYI8SJ6YxoNB3POyyQ,3069
4
+ aap_utils-0.1.4.dist-info/METADATA,sha256=zJjIBA1qS5GDppSjX3rtQF8zY455umerTc3pI-jiaJI,409
5
+ aap_utils-0.1.4.dist-info/WHEEL,sha256=ewwEueio1C2XeHTvT17n8dZUJgOvyCWCt0WVNLClP9o,92
6
+ aap_utils-0.1.4.dist-info/top_level.txt,sha256=Qt5xmL8_0_jhMl9uA3lg-xnvs4nCEyVj1tBE4vnp36M,10
7
+ aap_utils-0.1.4.dist-info/RECORD,,
@@ -1,6 +0,0 @@
1
- aap_utils/__init__.py,sha256=OALCpHMgWzr-3Lu7eKwalsw5GNCwWWkETUPHOqfGXsg,36
2
- aap_utils/register.py,sha256=aOVv1EhCqUfvIpmLgbWCCMcr-Sk-do3CkhZeVtjdEG0,2046
3
- aap_utils-0.1.2.dist-info/METADATA,sha256=SB1Dci5aG5JfEEbOnUKCD8EhYCKMfPIf9shIZH6VvKg,409
4
- aap_utils-0.1.2.dist-info/WHEEL,sha256=ewwEueio1C2XeHTvT17n8dZUJgOvyCWCt0WVNLClP9o,92
5
- aap_utils-0.1.2.dist-info/top_level.txt,sha256=Qt5xmL8_0_jhMl9uA3lg-xnvs4nCEyVj1tBE4vnp36M,10
6
- aap_utils-0.1.2.dist-info/RECORD,,