@@ -106,7 +106,8 @@ async def deploy_model(request: DeploymentRequest):
106106 except Exception as e :
107107 logger .error (f"YAML validation failed: { e } " )
108108 raise HTTPException (
109- status_code = status .HTTP_500_INTERNAL_SERVER_ERROR , detail = f"Generated YAML validation failed: { str (e )} "
109+ status_code = status .HTTP_500_INTERNAL_SERVER_ERROR ,
110+ detail = f"Generated YAML validation failed: { str (e )} " ,
110111 ) from e
111112
112113 return DeploymentResponse (
@@ -120,7 +121,8 @@ async def deploy_model(request: DeploymentRequest):
120121 except Exception as e :
121122 logger .error (f"Failed to generate deployment: { e } " , exc_info = True )
122123 raise HTTPException (
123- status_code = status .HTTP_500_INTERNAL_SERVER_ERROR , detail = f"Failed to generate deployment: { str (e )} "
124+ status_code = status .HTTP_500_INTERNAL_SERVER_ERROR ,
125+ detail = f"Failed to generate deployment: { str (e )} " ,
124126 ) from e
125127
126128
@@ -206,7 +208,9 @@ async def get_deployment_status(deployment_id: str):
206208
207209 except Exception as e :
208210 logger .error (f"Failed to get deployment status: { e } " )
209- raise HTTPException (status_code = status .HTTP_404_NOT_FOUND , detail = f"Deployment not found: { deployment_id } " ) from e
211+ raise HTTPException (
212+ status_code = status .HTTP_404_NOT_FOUND , detail = f"Deployment not found: { deployment_id } "
213+ ) from e
210214
211215
212216@router .post ("/deploy-to-cluster" )
@@ -247,7 +251,8 @@ async def deploy_to_cluster(request: DeploymentRequest):
247251 except Exception as e :
248252 logger .error (f"YAML validation failed: { e } " )
249253 raise HTTPException (
250- status_code = status .HTTP_500_INTERNAL_SERVER_ERROR , detail = f"Generated YAML validation failed: { str (e )} "
254+ status_code = status .HTTP_500_INTERNAL_SERVER_ERROR ,
255+ detail = f"Generated YAML validation failed: { str (e )} " ,
251256 ) from e
252257
253258 # Step 3: Deploy to cluster
@@ -258,7 +263,8 @@ async def deploy_to_cluster(request: DeploymentRequest):
258263 if not deployment_result ["success" ]:
259264 logger .error (f"Deployment failed: { deployment_result ['errors' ]} " )
260265 raise HTTPException (
261- status_code = status .HTTP_500_INTERNAL_SERVER_ERROR , detail = f"Deployment failed: { deployment_result ['errors' ]} "
266+ status_code = status .HTTP_500_INTERNAL_SERVER_ERROR ,
267+ detail = f"Deployment failed: { deployment_result ['errors' ]} " ,
262268 )
263269
264270 logger .info (f"Successfully deployed { deployment_id } to cluster" )
@@ -276,7 +282,10 @@ async def deploy_to_cluster(request: DeploymentRequest):
276282 raise
277283 except Exception as e :
278284 logger .error (f"Failed to deploy to cluster: { e } " , exc_info = True )
279- raise HTTPException (status_code = status .HTTP_500_INTERNAL_SERVER_ERROR , detail = f"Failed to deploy to cluster: { str (e )} " ) from e
285+ raise HTTPException (
286+ status_code = status .HTTP_500_INTERNAL_SERVER_ERROR ,
287+ detail = f"Failed to deploy to cluster: { str (e )} " ,
288+ ) from e
280289
281290
282291@router .get ("/cluster-status" )
@@ -333,7 +342,8 @@ async def get_k8s_deployment_status(deployment_id: str):
333342 except Exception as e :
334343 logger .error (f"Failed to get K8s deployment status: { e } " , exc_info = True )
335344 raise HTTPException (
336- status_code = status .HTTP_500_INTERNAL_SERVER_ERROR , detail = f"Failed to get deployment status: { str (e )} "
345+ status_code = status .HTTP_500_INTERNAL_SERVER_ERROR ,
346+ detail = f"Failed to get deployment status: { str (e )} " ,
337347 ) from e
338348
339349
@@ -362,7 +372,8 @@ async def get_deployment_yaml(deployment_id: str):
362372
363373 if not yaml_files :
364374 raise HTTPException (
365- status_code = status .HTTP_404_NOT_FOUND , detail = f"No YAML files found for deployment { deployment_id } "
375+ status_code = status .HTTP_404_NOT_FOUND ,
376+ detail = f"No YAML files found for deployment { deployment_id } " ,
366377 )
367378
368379 return {"deployment_id" : deployment_id , "files" : yaml_files , "count" : len (yaml_files )}
@@ -372,7 +383,8 @@ async def get_deployment_yaml(deployment_id: str):
372383 except Exception as e :
373384 logger .error (f"Failed to retrieve YAML files: { e } " , exc_info = True )
374385 raise HTTPException (
375- status_code = status .HTTP_500_INTERNAL_SERVER_ERROR , detail = f"Failed to retrieve YAML files: { str (e )} "
386+ status_code = status .HTTP_500_INTERNAL_SERVER_ERROR ,
387+ detail = f"Failed to retrieve YAML files: { str (e )} " ,
376388 ) from e
377389
378390
@@ -407,7 +419,10 @@ async def delete_deployment(deployment_id: str):
407419 raise
408420 except Exception as e :
409421 logger .error (f"Failed to delete deployment: { e } " , exc_info = True )
410- raise HTTPException (status_code = status .HTTP_500_INTERNAL_SERVER_ERROR , detail = f"Failed to delete deployment: { str (e )} " ) from e
422+ raise HTTPException (
423+ status_code = status .HTTP_500_INTERNAL_SERVER_ERROR ,
424+ detail = f"Failed to delete deployment: { str (e )} " ,
425+ ) from e
411426
412427
413428@router .get ("/deployments" )
@@ -442,4 +457,7 @@ async def list_all_deployments():
442457
443458 except Exception as e :
444459 logger .error (f"Failed to list deployments: { e } " , exc_info = True )
445- raise HTTPException (status_code = status .HTTP_500_INTERNAL_SERVER_ERROR , detail = f"Failed to list deployments: { str (e )} " ) from e
460+ raise HTTPException (
461+ status_code = status .HTTP_500_INTERNAL_SERVER_ERROR ,
462+ detail = f"Failed to list deployments: { str (e )} " ,
463+ ) from e
0 commit comments