Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions sdk/go/dstack/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -240,10 +240,12 @@ func (c *DstackClient) getEndpoint() string {
c.logger.Info("using simulator endpoint", "endpoint", simEndpoint)
return simEndpoint
}
// Try new path first, fall back to old path for backward compatibility
// Try paths in order: legacy paths first, then namespaced paths
socketPaths := []string{
"/var/run/dstack/dstack.sock",
"/var/run/dstack.sock",
"/run/dstack.sock",
"/var/run/dstack/dstack.sock",
"/run/dstack/dstack.sock",
}
for _, path := range socketPaths {
if _, err := os.Stat(path); err == nil {
Expand Down
6 changes: 4 additions & 2 deletions sdk/go/tappd/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -230,10 +230,12 @@ func (c *TappdClient) getEndpoint() string {
c.logger.Info("using simulator endpoint", "endpoint", simEndpoint)
return simEndpoint
}
// Try new path first, fall back to old path for backward compatibility
// Try paths in order: legacy paths first, then namespaced paths
socketPaths := []string{
"/var/run/dstack/tappd.sock",
"/var/run/tappd.sock",
"/run/tappd.sock",
"/var/run/dstack/tappd.sock",
"/run/dstack/tappd.sock",
}
for _, path := range socketPaths {
if _, err := os.Stat(path); err == nil {
Expand Down
12 changes: 8 additions & 4 deletions sdk/js/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -179,10 +179,12 @@ export class DstackClient<T extends TcbInfo = TcbInfoV05x> {
console.warn(`Using simulator endpoint: ${process.env.DSTACK_SIMULATOR_ENDPOINT}`)
endpoint = process.env.DSTACK_SIMULATOR_ENDPOINT
} else {
// Try new path first, fall back to old path for backward compatibility
// Try paths in order: legacy paths first, then namespaced paths
const socketPaths = [
'/var/run/dstack/dstack.sock',
'/var/run/dstack.sock',
'/run/dstack.sock',
'/var/run/dstack/dstack.sock',
'/run/dstack/dstack.sock',
]
endpoint = socketPaths.find(p => fs.existsSync(p)) ?? socketPaths[0]
}
Expand Down Expand Up @@ -407,10 +409,12 @@ export class TappdClient extends DstackClient<TcbInfoV03x> {
console.warn(`Using tappd endpoint: ${process.env.TAPPD_SIMULATOR_ENDPOINT}`)
endpoint = process.env.TAPPD_SIMULATOR_ENDPOINT
} else {
// Try new path first, fall back to old path for backward compatibility
// Try paths in order: legacy paths first, then namespaced paths
const socketPaths = [
'/var/run/dstack/tappd.sock',
'/var/run/tappd.sock',
'/run/tappd.sock',
'/var/run/dstack/tappd.sock',
'/run/dstack/tappd.sock',
]
endpoint = socketPaths.find(p => fs.existsSync(p)) ?? socketPaths[0]
}
Expand Down
12 changes: 8 additions & 4 deletions sdk/python/src/dstack_sdk/dstack_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,12 @@ def get_endpoint(endpoint: str | None = None) -> str:
f"Using simulator endpoint: {os.environ['DSTACK_SIMULATOR_ENDPOINT']}"
)
return os.environ["DSTACK_SIMULATOR_ENDPOINT"]
# Try new path first, fall back to old path for backward compatibility
# Try paths in order: legacy paths first, then namespaced paths
socket_paths = [
"/var/run/dstack/dstack.sock",
"/var/run/dstack.sock",
"/run/dstack.sock",
"/var/run/dstack/dstack.sock",
"/run/dstack/dstack.sock",
]
for path in socket_paths:
if os.path.exists(path):
Expand All @@ -69,10 +71,12 @@ def get_tappd_endpoint(endpoint: str | None = None) -> str:
if "TAPPD_SIMULATOR_ENDPOINT" in os.environ:
logger.info(f"Using tappd endpoint: {os.environ['TAPPD_SIMULATOR_ENDPOINT']}")
return os.environ["TAPPD_SIMULATOR_ENDPOINT"]
# Try new path first, fall back to old path for backward compatibility
# Try paths in order: legacy paths first, then namespaced paths
socket_paths = [
"/var/run/dstack/tappd.sock",
"/var/run/tappd.sock",
"/run/tappd.sock",
"/var/run/dstack/tappd.sock",
"/run/dstack/tappd.sock",
]
for path in socket_paths:
if os.path.exists(path):
Expand Down
9 changes: 7 additions & 2 deletions sdk/rust/src/dstack_client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,13 @@ fn get_endpoint(endpoint: Option<&str>) -> String {
if let Ok(sim_endpoint) = env::var("DSTACK_SIMULATOR_ENDPOINT") {
return sim_endpoint;
}
// Try new path first, fall back to old path for backward compatibility
const SOCKET_PATHS: &[&str] = &["/var/run/dstack/dstack.sock", "/var/run/dstack.sock"];
// Try paths in order: legacy paths first, then namespaced paths
const SOCKET_PATHS: &[&str] = &[
"/var/run/dstack.sock",
"/run/dstack.sock",
"/var/run/dstack/dstack.sock",
"/run/dstack/dstack.sock",
];
for path in SOCKET_PATHS {
if std::path::Path::new(path).exists() {
return path.to_string();
Expand Down
9 changes: 7 additions & 2 deletions sdk/rust/src/tappd_client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,13 @@ fn get_tappd_endpoint(endpoint: Option<&str>) -> String {
if let Ok(sim_endpoint) = env::var("TAPPD_SIMULATOR_ENDPOINT") {
return sim_endpoint;
}
// Try new path first, fall back to old path for backward compatibility
const SOCKET_PATHS: &[&str] = &["/var/run/dstack/tappd.sock", "/var/run/tappd.sock"];
// Try paths in order: legacy paths first, then namespaced paths
const SOCKET_PATHS: &[&str] = &[
"/var/run/tappd.sock",
"/run/tappd.sock",
"/var/run/dstack/tappd.sock",
"/run/dstack/tappd.sock",
];
for path in SOCKET_PATHS {
if std::path::Path::new(path).exists() {
return path.to_string();
Expand Down