update
Browse files- backend_deploy.py +16 -7
backend_deploy.py
CHANGED
|
@@ -1167,13 +1167,18 @@ def duplicate_space_to_user(
|
|
| 1167 |
|
| 1168 |
# Get original space info to detect hardware
|
| 1169 |
print(f"[Duplicate] Fetching info for {from_space_id}")
|
|
|
|
|
|
|
| 1170 |
try:
|
| 1171 |
original_space_info = api.space_info(from_space_id)
|
| 1172 |
-
|
| 1173 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1174 |
except Exception as e:
|
| 1175 |
print(f"[Duplicate] Could not fetch space info: {e}")
|
| 1176 |
-
original_hardware = None
|
| 1177 |
|
| 1178 |
# If no destination name provided, use original name
|
| 1179 |
if not to_space_name:
|
|
@@ -1199,13 +1204,17 @@ def duplicate_space_to_user(
|
|
| 1199 |
"exist_ok": True
|
| 1200 |
}
|
| 1201 |
|
| 1202 |
-
#
|
| 1203 |
-
if original_hardware
|
| 1204 |
-
# Use the same hardware as original, or fallback to cpu-basic
|
| 1205 |
duplicate_params["hardware"] = original_hardware
|
| 1206 |
-
print(f"[Duplicate] Using hardware: {original_hardware}")
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1207 |
|
| 1208 |
# Duplicate the space
|
|
|
|
| 1209 |
duplicated_repo = duplicate_space(**duplicate_params)
|
| 1210 |
|
| 1211 |
# Extract space URL
|
|
|
|
| 1167 |
|
| 1168 |
# Get original space info to detect hardware
|
| 1169 |
print(f"[Duplicate] Fetching info for {from_space_id}")
|
| 1170 |
+
original_hardware = None
|
| 1171 |
+
original_storage = None
|
| 1172 |
try:
|
| 1173 |
original_space_info = api.space_info(from_space_id)
|
| 1174 |
+
# Get runtime info
|
| 1175 |
+
runtime = getattr(original_space_info, 'runtime', None)
|
| 1176 |
+
if runtime:
|
| 1177 |
+
original_hardware = getattr(runtime, 'hardware', None)
|
| 1178 |
+
original_storage = getattr(runtime, 'storage', None)
|
| 1179 |
+
print(f"[Duplicate] Original space hardware: {original_hardware}, storage: {original_storage}")
|
| 1180 |
except Exception as e:
|
| 1181 |
print(f"[Duplicate] Could not fetch space info: {e}")
|
|
|
|
| 1182 |
|
| 1183 |
# If no destination name provided, use original name
|
| 1184 |
if not to_space_name:
|
|
|
|
| 1204 |
"exist_ok": True
|
| 1205 |
}
|
| 1206 |
|
| 1207 |
+
# Always use the same hardware as the original space if it has one
|
| 1208 |
+
if original_hardware:
|
|
|
|
| 1209 |
duplicate_params["hardware"] = original_hardware
|
| 1210 |
+
print(f"[Duplicate] Using same hardware as original: {original_hardware}")
|
| 1211 |
+
|
| 1212 |
+
if original_storage:
|
| 1213 |
+
duplicate_params["storage"] = original_storage
|
| 1214 |
+
print(f"[Duplicate] Using same storage as original: {original_storage}")
|
| 1215 |
|
| 1216 |
# Duplicate the space
|
| 1217 |
+
print(f"[Duplicate] Duplicating with params: {list(duplicate_params.keys())}")
|
| 1218 |
duplicated_repo = duplicate_space(**duplicate_params)
|
| 1219 |
|
| 1220 |
# Extract space URL
|