aap-utils 0.2.20__tar.gz → 0.3.0__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.
- {aap_utils-0.2.20 → aap_utils-0.3.0}/PKG-INFO +1 -1
- {aap_utils-0.2.20 → aap_utils-0.3.0}/aap_utils/register.py +29 -3
- {aap_utils-0.2.20 → aap_utils-0.3.0}/aap_utils.egg-info/PKG-INFO +1 -1
- {aap_utils-0.2.20 → aap_utils-0.3.0}/setup.py +1 -1
- {aap_utils-0.2.20 → aap_utils-0.3.0}/README.md +0 -0
- {aap_utils-0.2.20 → aap_utils-0.3.0}/aap_utils/__init__.py +0 -0
- {aap_utils-0.2.20 → aap_utils-0.3.0}/aap_utils/cli.py +0 -0
- {aap_utils-0.2.20 → aap_utils-0.3.0}/aap_utils.egg-info/SOURCES.txt +0 -0
- {aap_utils-0.2.20 → aap_utils-0.3.0}/aap_utils.egg-info/dependency_links.txt +0 -0
- {aap_utils-0.2.20 → aap_utils-0.3.0}/aap_utils.egg-info/entry_points.txt +0 -0
- {aap_utils-0.2.20 → aap_utils-0.3.0}/aap_utils.egg-info/requires.txt +0 -0
- {aap_utils-0.2.20 → aap_utils-0.3.0}/aap_utils.egg-info/top_level.txt +0 -0
- {aap_utils-0.2.20 → aap_utils-0.3.0}/pyproject.toml +0 -0
- {aap_utils-0.2.20 → aap_utils-0.3.0}/setup.cfg +0 -0
|
@@ -2,10 +2,37 @@ import socket
|
|
|
2
2
|
import requests
|
|
3
3
|
import time
|
|
4
4
|
import os
|
|
5
|
+
import re
|
|
5
6
|
from hydra import initialize, compose, initialize_config_dir
|
|
6
7
|
from omegaconf import OmegaConf, DictConfig
|
|
7
8
|
|
|
8
9
|
def register_demo(debug=False):
|
|
10
|
+
# --- Research Container Check ---
|
|
11
|
+
# Check if any environment variable starts with RESEARCH_SVC
|
|
12
|
+
is_research = any(key.startswith("RESEARCH_SVC") for key in os.environ)
|
|
13
|
+
|
|
14
|
+
if is_research:
|
|
15
|
+
vscode_proxy_uri = os.getenv("VSCODE_PROXY_URI", "")
|
|
16
|
+
if vscode_proxy_uri:
|
|
17
|
+
# Example transformation:
|
|
18
|
+
# From: https://appresearch34.aiplatform.vcntt.tech/proxy/{{port}}/
|
|
19
|
+
# To: https://appresearchpublic34.aiplatform.vcntt.tech/
|
|
20
|
+
|
|
21
|
+
# Logic: Replace 'appresearch' with 'appresearchpublic'
|
|
22
|
+
# and strip everything after the domain
|
|
23
|
+
match = re.search(r"https://(appresearch\d+)\.", vscode_proxy_uri)
|
|
24
|
+
if match:
|
|
25
|
+
subdomain = match.group(1).replace("appresearch", "appresearchpublic")
|
|
26
|
+
domain = vscode_proxy_uri.split(match.group(1) + ".")[-1].split("/")[0]
|
|
27
|
+
demo_url = f"https://{subdomain}.{domain}/"
|
|
28
|
+
|
|
29
|
+
print(f"Research environment detected. Demo service is at {demo_url}")
|
|
30
|
+
return True
|
|
31
|
+
|
|
32
|
+
if debug:
|
|
33
|
+
print("Research environment detected but VSCODE_PROXY_URI is missing or invalid.")
|
|
34
|
+
|
|
35
|
+
# --- Standard Registration Logic ---
|
|
9
36
|
for attempt in range(10):
|
|
10
37
|
try:
|
|
11
38
|
local_ip = socket.gethostbyname(socket.gethostname())
|
|
@@ -20,7 +47,6 @@ def register_demo(debug=False):
|
|
|
20
47
|
domain_name = argo_host.split("argowf.")[-1]
|
|
21
48
|
url, namespace = create_url(domain_name=domain_name)
|
|
22
49
|
|
|
23
|
-
# print(f"The demo service is at {namespace}.your_custorm_domain/demo/. Eg: {url}")
|
|
24
50
|
print(f"The demo service is at {url}")
|
|
25
51
|
if debug:
|
|
26
52
|
print("IP registered successfully.")
|
|
@@ -29,10 +55,10 @@ def register_demo(debug=False):
|
|
|
29
55
|
if debug:
|
|
30
56
|
print(f"Attempt {attempt + 1}: Failed: {response.text}")
|
|
31
57
|
except (socket.error, requests.exceptions.RequestException) as e:
|
|
32
|
-
if debug:
|
|
58
|
+
if debug:
|
|
33
59
|
print(f"Attempt {attempt + 1}: Error: {e}")
|
|
34
60
|
|
|
35
|
-
time.sleep(2)
|
|
61
|
+
time.sleep(2)
|
|
36
62
|
|
|
37
63
|
if debug:
|
|
38
64
|
print("Failed to register IP after 10 attempts.")
|
|
@@ -2,7 +2,7 @@ from setuptools import setup, find_packages
|
|
|
2
2
|
|
|
3
3
|
setup(
|
|
4
4
|
name="aap_utils", # The name of your library
|
|
5
|
-
version="0.
|
|
5
|
+
version="0.3.0",
|
|
6
6
|
description="A Python library for registering an IP address for AAP",
|
|
7
7
|
author="Minh Dang",
|
|
8
8
|
author_email="danghoangminh86@gmail.com",
|
|
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
|