Commit f3550054 authored by nanahira's avatar nanahira

allow os kill

parent e9954cd2
Pipeline #17213 passed with stages
in 20 minutes and 42 seconds
......@@ -216,7 +216,7 @@ def generate(request: GenerationRequest, authorized: bool = Depends(verify_token
if "CUDA out of memory" in e_s or \
"an illegal memory access" in e_s or "CUDA" in e_s:
logger.error("GPU error, committing seppuku.")
# os.kill(mainpid, signal.SIGTERM)
os.kill(mainpid, signal.SIGTERM)
return {"error": str(e)}
@app.post('/generate', response_model=Union[GenerationOutput, ErrorOutput])
......@@ -267,7 +267,7 @@ def generate(request: GenerationRequest, authorized: bool = Depends(verify_token
if "CUDA out of memory" in e_s or \
"an illegal memory access" in e_s or "CUDA" in e_s:
logger.error("GPU error, committing seppuku.")
# os.kill(mainpid, signal.SIGTERM)
os.kill(mainpid, signal.SIGTERM)
return {"error": str(e)}
@app.post('/generate-text', response_model=Union[TextOutput, ErrorOutput])
......@@ -294,7 +294,7 @@ def generate_text(request: TextRequest, authorized: bool = Depends(verify_token)
if "CUDA out of memory" in e_s or \
"an illegal memory access" in e_s or "CUDA" in e_s:
logger.error("GPU error, committing seppuku.")
# os.kill(mainpid, signal.SIGTERM)
os.kill(mainpid, signal.SIGTERM)
return ErrorOutput(error=str(e))
@app.get('/predict-tags', response_model=Union[TagOutput, ErrorOutput])
......@@ -321,7 +321,7 @@ async def predict_tags(prompt="", authorized: bool = Depends(verify_token)):
if "CUDA out of memory" in e_s or \
"an illegal memory access" in e_s or "CUDA" in e_s:
logger.error("GPU error, committing seppuku.")
# os.kill(mainpid, signal.SIGTERM)
os.kill(mainpid, signal.SIGTERM)
return ErrorOutput(error=str(e))
#@app.get('/')
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment