Skip to content

Commit 2d873d5

Browse files
authored
[Fix] Switch to subprocess in ModelBuilder when capturing dependencies (aws#4556)
* [Fix] Switch to subprogress in ModelBuilder when capturing dependencies * Fix style issues and explicitly set check to true
1 parent d27836e commit 2d873d5

File tree

1 file changed

+4
-3
lines changed
  • src/sagemaker/serve/save_retrive/version_1_0_0/save

1 file changed

+4
-3
lines changed

src/sagemaker/serve/save_retrive/version_1_0_0/save/utils.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
import hashlib
66
import os
77
import logging
8+
import subprocess
89
import sys
910
import platform
1011
from collections import defaultdict
@@ -98,10 +99,10 @@ def capture_dependencies(requirements_path: str):
9899
f.write(sagemaker_dependency)
99100
return
100101

101-
command = f"pigar gen -f {Path(requirements_path)} {os.getcwd()}"
102-
logging.info("Running command %s", command)
102+
command = ["pigar", "gen", "-f", str(Path(requirements_path)), str(os.getcwd())]
103+
logging.info("Running command: %s", " ".join(command))
103104

104-
os.system(command)
105+
subprocess.run(command, check=True, capture_output=True)
105106
logger.info("Dependencies captured successfully")
106107

107108

0 commit comments

Comments
 (0)