sagemaker-ops-cli 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- sagemaker_ops_cli-0.1.0/PKG-INFO +241 -0
- sagemaker_ops_cli-0.1.0/README.md +221 -0
- sagemaker_ops_cli-0.1.0/pyproject.toml +38 -0
- sagemaker_ops_cli-0.1.0/sagemaker_ops/__init__.py +4 -0
- sagemaker_ops_cli-0.1.0/sagemaker_ops/aws.py +502 -0
- sagemaker_ops_cli-0.1.0/sagemaker_ops/cli.py +262 -0
- sagemaker_ops_cli-0.1.0/sagemaker_ops/tui.py +458 -0
- sagemaker_ops_cli-0.1.0/sagemaker_ops_cli.egg-info/PKG-INFO +241 -0
- sagemaker_ops_cli-0.1.0/sagemaker_ops_cli.egg-info/SOURCES.txt +13 -0
- sagemaker_ops_cli-0.1.0/sagemaker_ops_cli.egg-info/dependency_links.txt +1 -0
- sagemaker_ops_cli-0.1.0/sagemaker_ops_cli.egg-info/entry_points.txt +2 -0
- sagemaker_ops_cli-0.1.0/sagemaker_ops_cli.egg-info/requires.txt +15 -0
- sagemaker_ops_cli-0.1.0/sagemaker_ops_cli.egg-info/top_level.txt +1 -0
- sagemaker_ops_cli-0.1.0/setup.cfg +4 -0
- sagemaker_ops_cli-0.1.0/tests/test_e2e_moto.py +298 -0
|
@@ -0,0 +1,241 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: sagemaker-ops-cli
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: CLI and TUI for submitting and monitoring Amazon SageMaker Processing Jobs and Pipelines.
|
|
5
|
+
Requires-Python: >=3.10
|
|
6
|
+
Description-Content-Type: text/markdown
|
|
7
|
+
Requires-Dist: boto3>=1.34.0
|
|
8
|
+
Requires-Dist: botocore>=1.34.0
|
|
9
|
+
Requires-Dist: rich>=13.7.0
|
|
10
|
+
Requires-Dist: typer>=0.12.0
|
|
11
|
+
Requires-Dist: textual>=0.58.0
|
|
12
|
+
Provides-Extra: yaml
|
|
13
|
+
Requires-Dist: PyYAML>=6.0.0; extra == "yaml"
|
|
14
|
+
Provides-Extra: dev
|
|
15
|
+
Requires-Dist: build>=1.2.0; extra == "dev"
|
|
16
|
+
Requires-Dist: moto[logs,sagemaker]>=5.0.0; extra == "dev"
|
|
17
|
+
Requires-Dist: pytest>=8.0.0; extra == "dev"
|
|
18
|
+
Requires-Dist: ruff>=0.5.0; extra == "dev"
|
|
19
|
+
Requires-Dist: twine>=5.0.0; extra == "dev"
|
|
20
|
+
|
|
21
|
+
# SageMaker Ops CLI
|
|
22
|
+
|
|
23
|
+
`smops` 是一个面向 SageMaker Processing Job 和 SageMaker Pipeline 的命令行工具:
|
|
24
|
+
|
|
25
|
+
- 提交 SageMaker Processing Job
|
|
26
|
+
- 启动 SageMaker Pipeline execution
|
|
27
|
+
- 用 TUI 查看正在运行的 Processing Jobs
|
|
28
|
+
- 用 TUI 查看正在运行和最近结束的 Pipeline executions、steps 状态和失败 step 的 CloudWatch 日志尾部
|
|
29
|
+
- 支持单个、多个或所有 AWS profiles
|
|
30
|
+
|
|
31
|
+
## 安装
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
python -m venv .venv
|
|
35
|
+
source .venv/bin/activate
|
|
36
|
+
pip install -e .
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
从 GitHub 直接安装:
|
|
40
|
+
|
|
41
|
+
```bash
|
|
42
|
+
pip install git+https://github.com/southpolemonkey/smops.git
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
从本地 wheel 安装:
|
|
46
|
+
|
|
47
|
+
```bash
|
|
48
|
+
pip install dist/sagemaker_ops_cli-0.1.0-py3-none-any.whl
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
如果要读取 YAML 配置:
|
|
52
|
+
|
|
53
|
+
```bash
|
|
54
|
+
pip install -e '.[yaml]'
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
## 构建 Python 包
|
|
58
|
+
|
|
59
|
+
```bash
|
|
60
|
+
pip install -e '.[dev]'
|
|
61
|
+
python -m build
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
构建产物会输出到 `dist/`:
|
|
65
|
+
|
|
66
|
+
- `sagemaker_ops_cli-0.1.0-py3-none-any.whl`
|
|
67
|
+
- `sagemaker_ops_cli-0.1.0.tar.gz`
|
|
68
|
+
|
|
69
|
+
## 提交 Processing Job
|
|
70
|
+
|
|
71
|
+
配置文件直接使用 boto3 `create_processing_job` 的参数结构。
|
|
72
|
+
|
|
73
|
+
```bash
|
|
74
|
+
smops processing submit \
|
|
75
|
+
--profile dev \
|
|
76
|
+
--region us-east-1 \
|
|
77
|
+
--config examples/processing-job.json
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
只检查请求内容,不提交:
|
|
81
|
+
|
|
82
|
+
```bash
|
|
83
|
+
smops processing submit --config examples/processing-job.json --dry-run
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
## 启动 Pipeline
|
|
87
|
+
|
|
88
|
+
```bash
|
|
89
|
+
smops pipeline start \
|
|
90
|
+
--profile dev \
|
|
91
|
+
--region us-east-1 \
|
|
92
|
+
--name my-pipeline \
|
|
93
|
+
--display-name manual-run-001 \
|
|
94
|
+
--parameter InputDate=2026-06-30 \
|
|
95
|
+
--parameter Mode=prod
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
## TUI 查看 Processing Jobs
|
|
99
|
+
|
|
100
|
+
```bash
|
|
101
|
+
smops tui processing --profile dev --region us-east-1
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
多个 profile:
|
|
105
|
+
|
|
106
|
+
```bash
|
|
107
|
+
smops tui processing --profile dev --profile prod --region us-east-1
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
所有 profile:
|
|
111
|
+
|
|
112
|
+
```bash
|
|
113
|
+
smops tui processing --all-profiles
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
快捷键:
|
|
117
|
+
|
|
118
|
+
- `↑/↓` 或 `←/→` 切换 job
|
|
119
|
+
- `r` 刷新
|
|
120
|
+
- `q` 退出
|
|
121
|
+
|
|
122
|
+
## TUI 查看 Pipelines
|
|
123
|
+
|
|
124
|
+
```bash
|
|
125
|
+
smops tui pipelines --profile dev --region us-east-1
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
只看某个 pipeline:
|
|
129
|
+
|
|
130
|
+
```bash
|
|
131
|
+
smops tui pipelines --profile dev --region us-east-1 --name my-pipeline
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
默认会显示正在运行的 executions,以及最近 3 小时内结束的 executions,方便查看成功/失败结果。可以用 `--hours` 调整窗口:
|
|
135
|
+
|
|
136
|
+
```bash
|
|
137
|
+
smops tui pipelines --profile dev --region us-east-1 --name my-pipeline --hours 6
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
快捷键:
|
|
141
|
+
|
|
142
|
+
- `←/→` 在 executions 和 steps 面板之间切换
|
|
143
|
+
- `↑/↓` 移动当前面板选中行
|
|
144
|
+
- `l` 加载选中失败 step 的 CloudWatch 日志尾部
|
|
145
|
+
- `r` 刷新
|
|
146
|
+
- `q` 退出
|
|
147
|
+
|
|
148
|
+
目前自动支持这些 step 的日志定位:
|
|
149
|
+
|
|
150
|
+
- ProcessingJob: `/aws/sagemaker/ProcessingJobs`
|
|
151
|
+
- TrainingJob: `/aws/sagemaker/TrainingJobs`
|
|
152
|
+
- TransformJob: `/aws/sagemaker/TransformJobs`
|
|
153
|
+
|
|
154
|
+
## 非交互式查看
|
|
155
|
+
|
|
156
|
+
```bash
|
|
157
|
+
smops processing list --profile dev --region us-east-1
|
|
158
|
+
smops pipeline list --profile dev --region us-east-1
|
|
159
|
+
smops pipeline list --profile dev --region us-east-1 --name my-pipeline --hours 6
|
|
160
|
+
smops pipeline steps --profile dev --region us-east-1 --execution-arn arn:aws:sagemaker:...
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
`processing list` 默认每页读取 20 个 running jobs。输出 `Next token` 时,用它继续翻页:
|
|
164
|
+
|
|
165
|
+
```bash
|
|
166
|
+
smops processing list --profile dev --region us-east-1 --max-results 20
|
|
167
|
+
smops processing list --profile dev --region us-east-1 --max-results 20 --next-token '<token>'
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
`pipeline list` 不传 `--name` 时默认每页只扫描 10 个 pipelines,避免真实账号里 pipelines 很多时卡住。输出 `Next token` 时,用它继续翻页:
|
|
171
|
+
|
|
172
|
+
```bash
|
|
173
|
+
smops pipeline list --profile dev --region us-east-1 --pipeline-page-size 10
|
|
174
|
+
smops pipeline list --profile dev --region us-east-1 --pipeline-page-size 10 --next-token '<token>'
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
## AWS 权限
|
|
178
|
+
|
|
179
|
+
运行账号需要至少具备这些权限:
|
|
180
|
+
|
|
181
|
+
- `sagemaker:CreateProcessingJob`
|
|
182
|
+
- `sagemaker:StartPipelineExecution`
|
|
183
|
+
- `sagemaker:ListProcessingJobs`
|
|
184
|
+
- `sagemaker:DescribeProcessingJob`
|
|
185
|
+
- `sagemaker:ListPipelines`
|
|
186
|
+
- `sagemaker:ListPipelineExecutions`
|
|
187
|
+
- `sagemaker:DescribePipelineExecution`
|
|
188
|
+
- `sagemaker:ListPipelineExecutionSteps`
|
|
189
|
+
- `logs:DescribeLogStreams`
|
|
190
|
+
- `logs:GetLogEvents`
|
|
191
|
+
|
|
192
|
+
|
|
193
|
+
## Mock AWS Profile
|
|
194
|
+
|
|
195
|
+
仓库里提供了一套 mock AWS 配置,方便本地演示 profile 切换和 CLI 参数解析,不会写入真实 `~/.aws`:
|
|
196
|
+
|
|
197
|
+
```bash
|
|
198
|
+
export AWS_CONFIG_FILE=examples/aws/config
|
|
199
|
+
export AWS_SHARED_CREDENTIALS_FILE=examples/aws/credentials
|
|
200
|
+
export AWS_PROFILE=mock-dev
|
|
201
|
+
export AWS_DEFAULT_REGION=us-east-1
|
|
202
|
+
```
|
|
203
|
+
|
|
204
|
+
也可以直接加载样例环境变量:
|
|
205
|
+
|
|
206
|
+
```bash
|
|
207
|
+
set -a
|
|
208
|
+
source examples/aws/mock.env
|
|
209
|
+
set +a
|
|
210
|
+
```
|
|
211
|
+
|
|
212
|
+
然后运行:
|
|
213
|
+
|
|
214
|
+
```bash
|
|
215
|
+
smops processing submit --config examples/processing-job.json --dry-run
|
|
216
|
+
smops processing list --profile mock-dev
|
|
217
|
+
smops tui processing --profile mock-dev
|
|
218
|
+
```
|
|
219
|
+
|
|
220
|
+
注意:这套 credentials 是 dummy 值,只适合 dry-run、mock、本地端点或配合 botocore Stubber/moto 使用;直接访问真实 AWS 会认证失败。
|
|
221
|
+
|
|
222
|
+
## E2E 测试
|
|
223
|
+
|
|
224
|
+
测试使用 `moto` 模拟 AWS SageMaker 和 CloudWatch Logs,不会访问真实 AWS:
|
|
225
|
+
|
|
226
|
+
```bash
|
|
227
|
+
pip install -e '.[dev]'
|
|
228
|
+
pytest
|
|
229
|
+
```
|
|
230
|
+
|
|
231
|
+
覆盖范围包括:
|
|
232
|
+
|
|
233
|
+
- Processing Job 提交和 running job 分页列表
|
|
234
|
+
- Pipeline execution 启动和 active/recent execution 列表
|
|
235
|
+
- Pipeline steps 状态展示
|
|
236
|
+
- 失败 step 的 CloudWatch Logs tail
|
|
237
|
+
- Processing Job TUI 的上下左右键导航
|
|
238
|
+
- Pipeline TUI 的 executions、steps 和失败日志加载
|
|
239
|
+
- 多 AWS profile 解析
|
|
240
|
+
|
|
241
|
+
Moto 目前还没有实现 `list_pipeline_execution_steps`,测试里对这一个 paginator 做了内存 fake,其余 SageMaker/Logs 调用都在 moto 环境中执行。
|
|
@@ -0,0 +1,221 @@
|
|
|
1
|
+
# SageMaker Ops CLI
|
|
2
|
+
|
|
3
|
+
`smops` 是一个面向 SageMaker Processing Job 和 SageMaker Pipeline 的命令行工具:
|
|
4
|
+
|
|
5
|
+
- 提交 SageMaker Processing Job
|
|
6
|
+
- 启动 SageMaker Pipeline execution
|
|
7
|
+
- 用 TUI 查看正在运行的 Processing Jobs
|
|
8
|
+
- 用 TUI 查看正在运行和最近结束的 Pipeline executions、steps 状态和失败 step 的 CloudWatch 日志尾部
|
|
9
|
+
- 支持单个、多个或所有 AWS profiles
|
|
10
|
+
|
|
11
|
+
## 安装
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
python -m venv .venv
|
|
15
|
+
source .venv/bin/activate
|
|
16
|
+
pip install -e .
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
从 GitHub 直接安装:
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
pip install git+https://github.com/southpolemonkey/smops.git
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
从本地 wheel 安装:
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
pip install dist/sagemaker_ops_cli-0.1.0-py3-none-any.whl
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
如果要读取 YAML 配置:
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
pip install -e '.[yaml]'
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
## 构建 Python 包
|
|
38
|
+
|
|
39
|
+
```bash
|
|
40
|
+
pip install -e '.[dev]'
|
|
41
|
+
python -m build
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
构建产物会输出到 `dist/`:
|
|
45
|
+
|
|
46
|
+
- `sagemaker_ops_cli-0.1.0-py3-none-any.whl`
|
|
47
|
+
- `sagemaker_ops_cli-0.1.0.tar.gz`
|
|
48
|
+
|
|
49
|
+
## 提交 Processing Job
|
|
50
|
+
|
|
51
|
+
配置文件直接使用 boto3 `create_processing_job` 的参数结构。
|
|
52
|
+
|
|
53
|
+
```bash
|
|
54
|
+
smops processing submit \
|
|
55
|
+
--profile dev \
|
|
56
|
+
--region us-east-1 \
|
|
57
|
+
--config examples/processing-job.json
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
只检查请求内容,不提交:
|
|
61
|
+
|
|
62
|
+
```bash
|
|
63
|
+
smops processing submit --config examples/processing-job.json --dry-run
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
## 启动 Pipeline
|
|
67
|
+
|
|
68
|
+
```bash
|
|
69
|
+
smops pipeline start \
|
|
70
|
+
--profile dev \
|
|
71
|
+
--region us-east-1 \
|
|
72
|
+
--name my-pipeline \
|
|
73
|
+
--display-name manual-run-001 \
|
|
74
|
+
--parameter InputDate=2026-06-30 \
|
|
75
|
+
--parameter Mode=prod
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
## TUI 查看 Processing Jobs
|
|
79
|
+
|
|
80
|
+
```bash
|
|
81
|
+
smops tui processing --profile dev --region us-east-1
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
多个 profile:
|
|
85
|
+
|
|
86
|
+
```bash
|
|
87
|
+
smops tui processing --profile dev --profile prod --region us-east-1
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
所有 profile:
|
|
91
|
+
|
|
92
|
+
```bash
|
|
93
|
+
smops tui processing --all-profiles
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
快捷键:
|
|
97
|
+
|
|
98
|
+
- `↑/↓` 或 `←/→` 切换 job
|
|
99
|
+
- `r` 刷新
|
|
100
|
+
- `q` 退出
|
|
101
|
+
|
|
102
|
+
## TUI 查看 Pipelines
|
|
103
|
+
|
|
104
|
+
```bash
|
|
105
|
+
smops tui pipelines --profile dev --region us-east-1
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
只看某个 pipeline:
|
|
109
|
+
|
|
110
|
+
```bash
|
|
111
|
+
smops tui pipelines --profile dev --region us-east-1 --name my-pipeline
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
默认会显示正在运行的 executions,以及最近 3 小时内结束的 executions,方便查看成功/失败结果。可以用 `--hours` 调整窗口:
|
|
115
|
+
|
|
116
|
+
```bash
|
|
117
|
+
smops tui pipelines --profile dev --region us-east-1 --name my-pipeline --hours 6
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
快捷键:
|
|
121
|
+
|
|
122
|
+
- `←/→` 在 executions 和 steps 面板之间切换
|
|
123
|
+
- `↑/↓` 移动当前面板选中行
|
|
124
|
+
- `l` 加载选中失败 step 的 CloudWatch 日志尾部
|
|
125
|
+
- `r` 刷新
|
|
126
|
+
- `q` 退出
|
|
127
|
+
|
|
128
|
+
目前自动支持这些 step 的日志定位:
|
|
129
|
+
|
|
130
|
+
- ProcessingJob: `/aws/sagemaker/ProcessingJobs`
|
|
131
|
+
- TrainingJob: `/aws/sagemaker/TrainingJobs`
|
|
132
|
+
- TransformJob: `/aws/sagemaker/TransformJobs`
|
|
133
|
+
|
|
134
|
+
## 非交互式查看
|
|
135
|
+
|
|
136
|
+
```bash
|
|
137
|
+
smops processing list --profile dev --region us-east-1
|
|
138
|
+
smops pipeline list --profile dev --region us-east-1
|
|
139
|
+
smops pipeline list --profile dev --region us-east-1 --name my-pipeline --hours 6
|
|
140
|
+
smops pipeline steps --profile dev --region us-east-1 --execution-arn arn:aws:sagemaker:...
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
`processing list` 默认每页读取 20 个 running jobs。输出 `Next token` 时,用它继续翻页:
|
|
144
|
+
|
|
145
|
+
```bash
|
|
146
|
+
smops processing list --profile dev --region us-east-1 --max-results 20
|
|
147
|
+
smops processing list --profile dev --region us-east-1 --max-results 20 --next-token '<token>'
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
`pipeline list` 不传 `--name` 时默认每页只扫描 10 个 pipelines,避免真实账号里 pipelines 很多时卡住。输出 `Next token` 时,用它继续翻页:
|
|
151
|
+
|
|
152
|
+
```bash
|
|
153
|
+
smops pipeline list --profile dev --region us-east-1 --pipeline-page-size 10
|
|
154
|
+
smops pipeline list --profile dev --region us-east-1 --pipeline-page-size 10 --next-token '<token>'
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
## AWS 权限
|
|
158
|
+
|
|
159
|
+
运行账号需要至少具备这些权限:
|
|
160
|
+
|
|
161
|
+
- `sagemaker:CreateProcessingJob`
|
|
162
|
+
- `sagemaker:StartPipelineExecution`
|
|
163
|
+
- `sagemaker:ListProcessingJobs`
|
|
164
|
+
- `sagemaker:DescribeProcessingJob`
|
|
165
|
+
- `sagemaker:ListPipelines`
|
|
166
|
+
- `sagemaker:ListPipelineExecutions`
|
|
167
|
+
- `sagemaker:DescribePipelineExecution`
|
|
168
|
+
- `sagemaker:ListPipelineExecutionSteps`
|
|
169
|
+
- `logs:DescribeLogStreams`
|
|
170
|
+
- `logs:GetLogEvents`
|
|
171
|
+
|
|
172
|
+
|
|
173
|
+
## Mock AWS Profile
|
|
174
|
+
|
|
175
|
+
仓库里提供了一套 mock AWS 配置,方便本地演示 profile 切换和 CLI 参数解析,不会写入真实 `~/.aws`:
|
|
176
|
+
|
|
177
|
+
```bash
|
|
178
|
+
export AWS_CONFIG_FILE=examples/aws/config
|
|
179
|
+
export AWS_SHARED_CREDENTIALS_FILE=examples/aws/credentials
|
|
180
|
+
export AWS_PROFILE=mock-dev
|
|
181
|
+
export AWS_DEFAULT_REGION=us-east-1
|
|
182
|
+
```
|
|
183
|
+
|
|
184
|
+
也可以直接加载样例环境变量:
|
|
185
|
+
|
|
186
|
+
```bash
|
|
187
|
+
set -a
|
|
188
|
+
source examples/aws/mock.env
|
|
189
|
+
set +a
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
然后运行:
|
|
193
|
+
|
|
194
|
+
```bash
|
|
195
|
+
smops processing submit --config examples/processing-job.json --dry-run
|
|
196
|
+
smops processing list --profile mock-dev
|
|
197
|
+
smops tui processing --profile mock-dev
|
|
198
|
+
```
|
|
199
|
+
|
|
200
|
+
注意:这套 credentials 是 dummy 值,只适合 dry-run、mock、本地端点或配合 botocore Stubber/moto 使用;直接访问真实 AWS 会认证失败。
|
|
201
|
+
|
|
202
|
+
## E2E 测试
|
|
203
|
+
|
|
204
|
+
测试使用 `moto` 模拟 AWS SageMaker 和 CloudWatch Logs,不会访问真实 AWS:
|
|
205
|
+
|
|
206
|
+
```bash
|
|
207
|
+
pip install -e '.[dev]'
|
|
208
|
+
pytest
|
|
209
|
+
```
|
|
210
|
+
|
|
211
|
+
覆盖范围包括:
|
|
212
|
+
|
|
213
|
+
- Processing Job 提交和 running job 分页列表
|
|
214
|
+
- Pipeline execution 启动和 active/recent execution 列表
|
|
215
|
+
- Pipeline steps 状态展示
|
|
216
|
+
- 失败 step 的 CloudWatch Logs tail
|
|
217
|
+
- Processing Job TUI 的上下左右键导航
|
|
218
|
+
- Pipeline TUI 的 executions、steps 和失败日志加载
|
|
219
|
+
- 多 AWS profile 解析
|
|
220
|
+
|
|
221
|
+
Moto 目前还没有实现 `list_pipeline_execution_steps`,测试里对这一个 paginator 做了内存 fake,其余 SageMaker/Logs 调用都在 moto 环境中执行。
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=68", "wheel"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "sagemaker-ops-cli"
|
|
7
|
+
version = "0.1.0"
|
|
8
|
+
description = "CLI and TUI for submitting and monitoring Amazon SageMaker Processing Jobs and Pipelines."
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
requires-python = ">=3.10"
|
|
11
|
+
dependencies = [
|
|
12
|
+
"boto3>=1.34.0",
|
|
13
|
+
"botocore>=1.34.0",
|
|
14
|
+
"rich>=13.7.0",
|
|
15
|
+
"typer>=0.12.0",
|
|
16
|
+
"textual>=0.58.0",
|
|
17
|
+
]
|
|
18
|
+
|
|
19
|
+
[project.optional-dependencies]
|
|
20
|
+
yaml = ["PyYAML>=6.0.0"]
|
|
21
|
+
dev = [
|
|
22
|
+
"build>=1.2.0",
|
|
23
|
+
"moto[logs,sagemaker]>=5.0.0",
|
|
24
|
+
"pytest>=8.0.0",
|
|
25
|
+
"ruff>=0.5.0",
|
|
26
|
+
"twine>=5.0.0",
|
|
27
|
+
]
|
|
28
|
+
|
|
29
|
+
[project.scripts]
|
|
30
|
+
smops = "sagemaker_ops.cli:app"
|
|
31
|
+
|
|
32
|
+
[tool.setuptools.packages.find]
|
|
33
|
+
where = ["."]
|
|
34
|
+
include = ["sagemaker_ops*"]
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
[tool.pytest.ini_options]
|
|
38
|
+
testpaths = ["tests"]
|