Skip to content

Commit

Permalink
Remove deprecated distutils (#746)
Browse files Browse the repository at this point in the history
* Remove deprecated distutils

* Add param to override existing files

* Fixing unit tests

---------

Co-authored-by: braf <[email protected]>
  • Loading branch information
dyastremsky and nv-braf authored Aug 21, 2023
1 parent f1d9eb7 commit 64ea400
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions model_analyzer/triton/model/model_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
import json
import os
from copy import deepcopy
from distutils.dir_util import copy_tree
from shutil import copytree
from typing import Any, Dict, List, Optional

from google.protobuf import json_format, text_format
Expand Down Expand Up @@ -420,7 +420,7 @@ def write_config_to_file(
)
else:
# Create first variant model as copy of source model
copy_tree(src_model_path, model_path)
copytree(src_model_path, model_path, dirs_exist_ok=True)

with open(os.path.join(model_path, "config.pbtxt"), "wb") as f:
f.write(model_config_bytes)
Expand Down
4 changes: 2 additions & 2 deletions tests/test_model_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ def test_write_config_file(self):
"model_analyzer.triton.model.model_config.open", mock_open()
) as mocked_file:
with patch(
"model_analyzer.triton.model.model_config.copy_tree", MagicMock()
"model_analyzer.triton.model.model_config.copytree", MagicMock()
):
model_config.write_config_to_file(model_output_path, "/mock/path", None)
content = mocked_file().write.call_args.args[0]
Expand Down Expand Up @@ -232,7 +232,7 @@ def test_write_config_file(self):
"model_analyzer.triton.model.model_config.os.listdir",
MagicMock(return_value=["1", "config.pbtxt", "output0_labels.txt"]),
)
@patch("model_analyzer.triton.model.model_config.copy_tree")
@patch("model_analyzer.triton.model.model_config.copytree")
@patch("model_analyzer.triton.model.model_config.os.symlink")
def test_write_config_to_file_with_relative_path(self, mock_os_symlink, *args):
"""
Expand Down

0 comments on commit 64ea400

Please sign in to comment.