Skip to content

Commit 02b0bff

Browse files
authored
fix background_compile error handling (#64)
1 parent ef167f2 commit 02b0bff

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

centml/compiler/server.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ def background_compile(model_id: str, tfx_graph, example_inputs):
4242
except Exception as e:
4343
logging.getLogger(__name__).exception(f"Compilation: error compiling model. {e}")
4444
dir_cleanup(model_id)
45+
return
4546

4647
try:
4748
# torch.save's writing is not atomic; it creates an empty zip file then saves the data in multiple calls.
@@ -53,6 +54,7 @@ def background_compile(model_id: str, tfx_graph, example_inputs):
5354
os.rename(tmp_path, save_path)
5455
except Exception as e:
5556
logging.getLogger(__name__).exception(f"Saving graph module failed: {e}")
57+
dir_cleanup(model_id)
5658

5759

5860
def read_upload_files(model_id: str, model: UploadFile, inputs: UploadFile):

0 commit comments

Comments
 (0)