dc-python-sdk 1.5.20__tar.gz → 1.5.21__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.
- {dc_python_sdk-1.5.20/src/dc_python_sdk.egg-info → dc_python_sdk-1.5.21}/PKG-INFO +1 -1
- {dc_python_sdk-1.5.20 → dc_python_sdk-1.5.21}/pyproject.toml +1 -1
- {dc_python_sdk-1.5.20 → dc_python_sdk-1.5.21}/setup.cfg +1 -1
- {dc_python_sdk-1.5.20 → dc_python_sdk-1.5.21/src/dc_python_sdk.egg-info}/PKG-INFO +1 -1
- {dc_python_sdk-1.5.20 → dc_python_sdk-1.5.21}/src/dc_sdk/cli.py +10 -1
- {dc_python_sdk-1.5.20 → dc_python_sdk-1.5.21}/src/dc_sdk/src/ai_http.py +19 -12
- {dc_python_sdk-1.5.20 → dc_python_sdk-1.5.21}/LICENSE +0 -0
- {dc_python_sdk-1.5.20 → dc_python_sdk-1.5.21}/README.md +0 -0
- {dc_python_sdk-1.5.20 → dc_python_sdk-1.5.21}/src/dc_python_sdk.egg-info/SOURCES.txt +0 -0
- {dc_python_sdk-1.5.20 → dc_python_sdk-1.5.21}/src/dc_python_sdk.egg-info/dependency_links.txt +0 -0
- {dc_python_sdk-1.5.20 → dc_python_sdk-1.5.21}/src/dc_python_sdk.egg-info/entry_points.txt +0 -0
- {dc_python_sdk-1.5.20 → dc_python_sdk-1.5.21}/src/dc_python_sdk.egg-info/requires.txt +0 -0
- {dc_python_sdk-1.5.20 → dc_python_sdk-1.5.21}/src/dc_python_sdk.egg-info/top_level.txt +0 -0
- {dc_python_sdk-1.5.20 → dc_python_sdk-1.5.21}/src/dc_sdk/__init__.py +0 -0
- {dc_python_sdk-1.5.20 → dc_python_sdk-1.5.21}/src/dc_sdk/app.py +0 -0
- {dc_python_sdk-1.5.20 → dc_python_sdk-1.5.21}/src/dc_sdk/errors.py +0 -0
- {dc_python_sdk-1.5.20 → dc_python_sdk-1.5.21}/src/dc_sdk/handler.py +0 -0
- {dc_python_sdk-1.5.20 → dc_python_sdk-1.5.21}/src/dc_sdk/src/__init__.py +0 -0
- {dc_python_sdk-1.5.20 → dc_python_sdk-1.5.21}/src/dc_sdk/src/ai.py +0 -0
- {dc_python_sdk-1.5.20 → dc_python_sdk-1.5.21}/src/dc_sdk/src/mapping.py +0 -0
- {dc_python_sdk-1.5.20 → dc_python_sdk-1.5.21}/src/dc_sdk/src/models/__init__.py +0 -0
- {dc_python_sdk-1.5.20 → dc_python_sdk-1.5.21}/src/dc_sdk/src/models/enums.py +0 -0
- {dc_python_sdk-1.5.20 → dc_python_sdk-1.5.21}/src/dc_sdk/src/models/errors.py +0 -0
- {dc_python_sdk-1.5.20 → dc_python_sdk-1.5.21}/src/dc_sdk/src/models/log_templates.py +0 -0
- {dc_python_sdk-1.5.20 → dc_python_sdk-1.5.21}/src/dc_sdk/src/models/pipeline_details.py +0 -0
- {dc_python_sdk-1.5.20 → dc_python_sdk-1.5.21}/src/dc_sdk/src/pipeline.py +0 -0
- {dc_python_sdk-1.5.20 → dc_python_sdk-1.5.21}/src/dc_sdk/src/server.py +0 -0
- {dc_python_sdk-1.5.20 → dc_python_sdk-1.5.21}/src/dc_sdk/src/services/__init__.py +0 -0
- {dc_python_sdk-1.5.20 → dc_python_sdk-1.5.21}/src/dc_sdk/src/services/api.py +0 -0
- {dc_python_sdk-1.5.20 → dc_python_sdk-1.5.21}/src/dc_sdk/src/services/aws.py +0 -0
- {dc_python_sdk-1.5.20 → dc_python_sdk-1.5.21}/src/dc_sdk/src/services/environment.py +0 -0
- {dc_python_sdk-1.5.20 → dc_python_sdk-1.5.21}/src/dc_sdk/src/services/loader.py +0 -0
- {dc_python_sdk-1.5.20 → dc_python_sdk-1.5.21}/src/dc_sdk/src/services/logger.py +0 -0
- {dc_python_sdk-1.5.20 → dc_python_sdk-1.5.21}/src/dc_sdk/src/services/session.py +0 -0
- {dc_python_sdk-1.5.20 → dc_python_sdk-1.5.21}/src/dc_sdk/types.py +0 -0
|
@@ -1,6 +1,13 @@
|
|
|
1
1
|
import sys
|
|
2
2
|
from importlib.metadata import version
|
|
3
3
|
|
|
4
|
+
def get_arg(name, default=None):
|
|
5
|
+
if name in sys.argv:
|
|
6
|
+
idx = sys.argv.index(name)
|
|
7
|
+
if idx + 1 < len(sys.argv):
|
|
8
|
+
return sys.argv[idx + 1]
|
|
9
|
+
return default
|
|
10
|
+
|
|
4
11
|
def main():
|
|
5
12
|
if len(sys.argv) < 2:
|
|
6
13
|
print("Usage: dc-sdk [http|ai|ai-http]")
|
|
@@ -8,13 +15,15 @@ def main():
|
|
|
8
15
|
|
|
9
16
|
command = sys.argv[1]
|
|
10
17
|
|
|
18
|
+
port = int(get_arg("--port", 5000))
|
|
19
|
+
|
|
11
20
|
print("version: ", version("dc-python-sdk"))
|
|
12
21
|
|
|
13
22
|
print(f"[DC SDK] Command: {command}")
|
|
14
23
|
|
|
15
24
|
if command == "http":
|
|
16
25
|
from dc_sdk.src.server import start_server
|
|
17
|
-
start_server()
|
|
26
|
+
start_server(port)
|
|
18
27
|
|
|
19
28
|
elif command == "ai":
|
|
20
29
|
from dc_sdk.src.ai import start_ai
|
|
@@ -19,6 +19,7 @@ app = FastAPI()
|
|
|
19
19
|
|
|
20
20
|
client = None
|
|
21
21
|
workspace = os.getenv("WORKSPACE", "/workspace")
|
|
22
|
+
port_for_connector = 5000
|
|
22
23
|
|
|
23
24
|
# -----------------------------
|
|
24
25
|
# MODELS
|
|
@@ -72,10 +73,9 @@ def get_free_port():
|
|
|
72
73
|
|
|
73
74
|
def start_connector():
|
|
74
75
|
global workspace
|
|
75
|
-
|
|
76
|
-
|
|
76
|
+
global port_for_connector
|
|
77
77
|
proc = subprocess.Popen(
|
|
78
|
-
["dc-sdk", "http"],
|
|
78
|
+
["dc-sdk", "http", "--port", str(port_for_connector)],
|
|
79
79
|
cwd=workspace,
|
|
80
80
|
stdout=subprocess.DEVNULL,
|
|
81
81
|
stderr=subprocess.DEVNULL
|
|
@@ -84,15 +84,15 @@ def start_connector():
|
|
|
84
84
|
# wait for health
|
|
85
85
|
for _ in range(50):
|
|
86
86
|
try:
|
|
87
|
-
res = requests.get(f"http://localhost:{
|
|
87
|
+
res = requests.get(f"http://localhost:{port_for_connector}/health")
|
|
88
88
|
if res.status_code == 200:
|
|
89
|
-
logger.info("Connector ready on port %s",
|
|
90
|
-
return {"process": proc, "port":
|
|
89
|
+
logger.info("Connector ready on port %s", port_for_connector)
|
|
90
|
+
return {"process": proc, "port": port_for_connector}
|
|
91
91
|
except Exception:
|
|
92
|
-
logger.debug("Health check not ready yet on port %s",
|
|
92
|
+
logger.debug("Health check not ready yet on port %s", port_for_connector)
|
|
93
93
|
time.sleep(0.1)
|
|
94
94
|
|
|
95
|
-
logger.error("Connector failed to become healthy on port %s within timeout",
|
|
95
|
+
logger.error("Connector failed to become healthy on port %s within timeout", port_for_connector)
|
|
96
96
|
proc.terminate()
|
|
97
97
|
raise Exception("Failed to start connector")
|
|
98
98
|
|
|
@@ -704,9 +704,12 @@ def clone_repo():
|
|
|
704
704
|
subprocess.run(["git", "-C", workspace, "checkout", branch], check=True)
|
|
705
705
|
subprocess.run(["git", "-C", workspace, "pull"], check=True)
|
|
706
706
|
|
|
707
|
-
def start_ai_http():
|
|
707
|
+
def start_ai_http(connector_port=5000):
|
|
708
708
|
global client
|
|
709
709
|
global workspace
|
|
710
|
+
global port_for_connector
|
|
711
|
+
|
|
712
|
+
port_for_connector = connector_port
|
|
710
713
|
|
|
711
714
|
api_key = os.getenv("OPENAI_API_KEY")
|
|
712
715
|
ai_port = int(os.getenv("AI_PORT", 5050))
|
|
@@ -721,9 +724,13 @@ def start_ai_http():
|
|
|
721
724
|
|
|
722
725
|
# ✅ Write code-server config
|
|
723
726
|
with open("/root/.config/code-server/config.yaml", "w") as f:
|
|
724
|
-
f.write(
|
|
725
|
-
|
|
726
|
-
""
|
|
727
|
+
f.write(
|
|
728
|
+
f"bind-addr: 0.0.0.0:{code_port}\n"
|
|
729
|
+
"auth: none\n"
|
|
730
|
+
)
|
|
731
|
+
|
|
732
|
+
with open("/root/.config/code-server/config.yaml", "r") as f:
|
|
733
|
+
logger.info("code-server config:\n%s", f.read())
|
|
727
734
|
|
|
728
735
|
# ✅ Ensure workspace + vscode dir exists
|
|
729
736
|
os.makedirs(workspace, exist_ok=True)
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{dc_python_sdk-1.5.20 → dc_python_sdk-1.5.21}/src/dc_python_sdk.egg-info/dependency_links.txt
RENAMED
|
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
|
|
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
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|