Skip to content

Commit cb699a8

Browse files
authored
Merge branch 'aws:master' into master-mc-post-launch-fixes
2 parents 9bb96bf + 4055fcf commit cb699a8

File tree

6 files changed

+92
-6
lines changed

6 files changed

+92
-6
lines changed
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
---
2+
name: Bug report
3+
about: File a report to help us reproduce and fix the problem
4+
title: ''
5+
labels: 'bug'
6+
assignees: ''
7+
8+
---
9+
10+
**PySDK Version**
11+
- [ ] PySDK V2 (2.x)
12+
- [ ] PySDK V3 (3.x)
13+
14+
**Describe the bug**
15+
A clear and concise description of what the bug is.
16+
17+
**To reproduce**
18+
A clear, step-by-step set of instructions to reproduce the bug.
19+
The provided code need to be **complete** and **runnable**, if additional data is needed, please include them in the issue.
20+
21+
**Expected behavior**
22+
A clear and concise description of what you expected to happen.
23+
24+
**Screenshots or logs**
25+
If applicable, add screenshots or logs to help explain your problem.
26+
27+
**System information**
28+
A description of your system. Please provide:
29+
- **SageMaker Python SDK version**:
30+
- **Framework name (eg. PyTorch) or algorithm (eg. KMeans)**:
31+
- **Framework version**:
32+
- **Python version**:
33+
- **CPU or GPU**:
34+
- **Custom Docker image (Y/N)**:
35+
36+
**Additional context**
37+
Add any other context about the problem here.

.github/ISSUE_TEMPLATE/config.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
blank_issues_enabled: false
2+
contact_links:
3+
- name: Ask a question
4+
url: https://github.com/aws/sagemaker-python-sdk/discussions
5+
about: Use GitHub Discussions to ask and answer questions
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
---
2+
name: Documentation request
3+
about: Request improved documentation
4+
title: ''
5+
labels: ''
6+
assignees: ''
7+
8+
---
9+
10+
**What did you find confusing? Please describe.**
11+
A clear and concise description of what you found confusing. Ex. I tried to [...] but I didn't understand how to [...]
12+
13+
**Describe how documentation can be improved**
14+
A clear and concise description of where documentation was lacking and how it can be improved.
15+
16+
**Additional context**
17+
Add any other context or screenshots about the documentation request here.
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
---
2+
name: Feature request
3+
about: Suggest new functionality for this library
4+
title: ''
5+
labels: 'feature request'
6+
assignees: ''
7+
8+
---
9+
10+
**Describe the feature you'd like**
11+
A clear and concise description of the functionality you want.
12+
13+
**How would this feature be used? Please describe.**
14+
A clear and concise description of the use case for this feature. Please provide an example, if possible.
15+
16+
**Describe alternatives you've considered**
17+
A clear and concise description of any alternative solutions or features you've considered.
18+
19+
**Additional context**
20+
Add any other context or screenshots about the feature request here.

sagemaker-core/src/sagemaker/core/local/utils.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,11 @@ def get_child_process_ids(pid):
137137
Returns:
138138
(List[int]): Child process ids
139139
"""
140-
cmd = f"pgrep -P {pid}".split()
140+
if not str(pid).isdigit():
141+
raise ValueError("Invalid PID")
142+
143+
cmd = ["pgrep", "-P", str(pid)]
144+
141145
process = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
142146
output, err = process.communicate()
143147
if err:

sagemaker-core/tests/unit/local/test_local_utils.py

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -103,21 +103,24 @@ def test_recursive_copy(copy_tree, m_os_path):
103103
@patch("sagemaker.core.local.utils.os")
104104
@patch("sagemaker.core.local.utils.get_child_process_ids")
105105
def test_kill_child_processes(m_get_child_process_ids, m_os):
106-
m_get_child_process_ids.return_value = ["child_pids"]
107-
kill_child_processes("pid")
108-
m_os.kill.assert_called_with("child_pids", 15)
106+
m_get_child_process_ids.return_value = ["345"]
107+
kill_child_processes("123")
108+
m_os.kill.assert_called_with("345", 15)
109109

110110

111111
@patch("sagemaker.core.local.utils.subprocess")
112112
def test_get_child_process_ids(m_subprocess):
113-
cmd = "pgrep -P pid".split()
113+
cmd = "pgrep -P 123".split()
114114
process_mock = Mock()
115115
attrs = {"communicate.return_value": (b"\n", False), "returncode": 0}
116116
process_mock.configure_mock(**attrs)
117117
m_subprocess.Popen.return_value = process_mock
118-
get_child_process_ids("pid")
118+
get_child_process_ids("123")
119119
m_subprocess.Popen.assert_called_with(cmd, stdout=m_subprocess.PIPE, stderr=m_subprocess.PIPE)
120120

121+
def test_get_child_process_ids_exception():
122+
with pytest.raises(ValueError, match="Invalid PID"):
123+
get_child_process_ids("abc")
121124

122125
@patch("sagemaker.core.local.utils.subprocess")
123126
def test_get_docker_host(m_subprocess):

0 commit comments

Comments
 (0)