Skip to content

Commit

Permalink
Merge pull request #1016 from pytorch/issue_1012
Browse files Browse the repository at this point in the history
removing the temp directory with model files after packaging
  • Loading branch information
lxning authored Jul 29, 2021
2 parents 092ecf0 + 0742fb4 commit cc9ed29
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
3 changes: 2 additions & 1 deletion model-archiver/model_archiver/model_packaging.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

import logging
import sys
import shutil
from .arg_parser import ArgParser
from .model_packaging_utils import ModelExportUtils
from .model_archiver_error import ModelArchiverError
Expand Down Expand Up @@ -36,7 +37,7 @@ def package_model(args, manifest):

# Step 2 : Zip 'em all up
ModelExportUtils.archive(export_file_path, model_name, model_path, manifest, args.archive_format)

shutil.rmtree(model_path)
logging.info("Successfully exported model %s to file %s", model_name, export_file_path)
except ModelArchiverError as e:
logging.error(e)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@
from collections import namedtuple

import pytest
import sys
from mock import MagicMock

sys.modules['shutil'] = MagicMock()
sys.modules['shutil.rmtree'] = MagicMock()

from model_archiver.manifest_components.manifest import RuntimeType
from model_archiver.model_packaging import generate_model_archive, package_model
Expand Down

0 comments on commit cc9ed29

Please sign in to comment.