sagemaker-ops-cli 0.1.0__tar.gz → 0.1.1__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.
@@ -0,0 +1,271 @@
1
+ Metadata-Version: 2.4
2
+ Name: sagemaker-ops-cli
3
+ Version: 0.1.1
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` is a command-line tool for operating Amazon SageMaker Processing Jobs and SageMaker Pipelines.
24
+
25
+ It can:
26
+
27
+ - Submit SageMaker Processing Jobs
28
+ - Start SageMaker Pipeline executions
29
+ - Show running Processing Jobs in an interactive TUI
30
+ - Show running and recently completed Pipeline executions in an interactive TUI
31
+ - Inspect Pipeline step status and failed step CloudWatch logs
32
+ - Work with one, many, or all configured AWS profiles
33
+
34
+ ## Installation
35
+
36
+ Install from PyPI:
37
+
38
+ ```bash
39
+ pip install sagemaker-ops-cli
40
+ ```
41
+
42
+ The installed command is:
43
+
44
+ ```bash
45
+ smops --help
46
+ ```
47
+
48
+ Install from GitHub:
49
+
50
+ ```bash
51
+ pip install git+https://github.com/southpolemonkey/smops.git
52
+ ```
53
+
54
+ Install from a local wheel:
55
+
56
+ ```bash
57
+ pip install dist/sagemaker_ops_cli-0.1.1-py3-none-any.whl
58
+ ```
59
+
60
+ Install with Homebrew:
61
+
62
+ ```bash
63
+ brew tap southpolemonkey/smops https://github.com/southpolemonkey/smops
64
+ brew install sagemaker-ops-cli
65
+ ```
66
+
67
+ If the formula is later moved into a dedicated `southpolemonkey/homebrew-smops` tap repository, users can use the shorter command:
68
+
69
+ ```bash
70
+ brew tap southpolemonkey/smops
71
+ brew install sagemaker-ops-cli
72
+ ```
73
+
74
+ For local development:
75
+
76
+ ```bash
77
+ python -m venv .venv
78
+ source .venv/bin/activate
79
+ pip install -e .
80
+ ```
81
+
82
+ To enable YAML config files:
83
+
84
+ ```bash
85
+ pip install -e '.[yaml]'
86
+ ```
87
+
88
+ ## Build The Python Package
89
+
90
+ ```bash
91
+ pip install -e '.[dev]'
92
+ python -m build
93
+ ```
94
+
95
+ Build artifacts are written to `dist/`:
96
+
97
+ - `sagemaker_ops_cli-0.1.1-py3-none-any.whl`
98
+ - `sagemaker_ops_cli-0.1.1.tar.gz`
99
+
100
+ ## Submit A Processing Job
101
+
102
+ The config file uses the same parameter structure as boto3 `create_processing_job`.
103
+
104
+ ```bash
105
+ smops processing submit \
106
+ --profile dev \
107
+ --region us-east-1 \
108
+ --config examples/processing-job.json
109
+ ```
110
+
111
+ Validate the request without submitting it:
112
+
113
+ ```bash
114
+ smops processing submit --config examples/processing-job.json --dry-run
115
+ ```
116
+
117
+ ## Start A Pipeline Execution
118
+
119
+ ```bash
120
+ smops pipeline start \
121
+ --profile dev \
122
+ --region us-east-1 \
123
+ --name my-pipeline \
124
+ --display-name manual-run-001 \
125
+ --parameter InputDate=2026-06-30 \
126
+ --parameter Mode=prod
127
+ ```
128
+
129
+ ## Processing Jobs TUI
130
+
131
+ ```bash
132
+ smops tui processing --profile dev --region us-east-1
133
+ ```
134
+
135
+ Multiple profiles:
136
+
137
+ ```bash
138
+ smops tui processing --profile dev --profile prod --region us-east-1
139
+ ```
140
+
141
+ All profiles:
142
+
143
+ ```bash
144
+ smops tui processing --all-profiles
145
+ ```
146
+
147
+ Keyboard shortcuts:
148
+
149
+ - `Up` / `Down` or `Left` / `Right`: switch jobs
150
+ - `r`: refresh
151
+ - `q`: quit
152
+
153
+ ## Pipelines TUI
154
+
155
+ ```bash
156
+ smops tui pipelines --profile dev --region us-east-1
157
+ ```
158
+
159
+ Filter to one pipeline:
160
+
161
+ ```bash
162
+ smops tui pipelines --profile dev --region us-east-1 --name my-pipeline
163
+ ```
164
+
165
+ By default, the TUI shows running executions plus executions completed within the last 3 hours, so you can inspect recent success and failure results. Use `--hours` to adjust the time window:
166
+
167
+ ```bash
168
+ smops tui pipelines --profile dev --region us-east-1 --name my-pipeline --hours 6
169
+ ```
170
+
171
+ Keyboard shortcuts:
172
+
173
+ - `Left` / `Right`: switch focus between the executions and steps panels
174
+ - `Up` / `Down`: move within the focused panel
175
+ - `l`: load the CloudWatch log tail for the selected failed step
176
+ - `r`: refresh
177
+ - `q`: quit
178
+
179
+ Log discovery is currently supported for these step job types:
180
+
181
+ - ProcessingJob: `/aws/sagemaker/ProcessingJobs`
182
+ - TrainingJob: `/aws/sagemaker/TrainingJobs`
183
+ - TransformJob: `/aws/sagemaker/TransformJobs`
184
+
185
+ ## Non-Interactive Commands
186
+
187
+ ```bash
188
+ smops processing list --profile dev --region us-east-1
189
+ smops pipeline list --profile dev --region us-east-1
190
+ smops pipeline list --profile dev --region us-east-1 --name my-pipeline --hours 6
191
+ smops pipeline steps --profile dev --region us-east-1 --execution-arn arn:aws:sagemaker:...
192
+ ```
193
+
194
+ `processing list` reads 20 running jobs per page by default. If the output includes `Next token`, pass it to fetch the next page:
195
+
196
+ ```bash
197
+ smops processing list --profile dev --region us-east-1 --max-results 20
198
+ smops processing list --profile dev --region us-east-1 --max-results 20 --next-token '<token>'
199
+ ```
200
+
201
+ When `pipeline list` is used without `--name`, it scans 10 pipelines per page by default. This avoids long hangs in AWS accounts with many pipelines. If the output includes `Next token`, pass it to continue scanning:
202
+
203
+ ```bash
204
+ smops pipeline list --profile dev --region us-east-1 --pipeline-page-size 10
205
+ smops pipeline list --profile dev --region us-east-1 --pipeline-page-size 10 --next-token '<token>'
206
+ ```
207
+
208
+ ## AWS Permissions
209
+
210
+ The AWS identity used by `smops` needs at least these permissions:
211
+
212
+ - `sagemaker:CreateProcessingJob`
213
+ - `sagemaker:StartPipelineExecution`
214
+ - `sagemaker:ListProcessingJobs`
215
+ - `sagemaker:DescribeProcessingJob`
216
+ - `sagemaker:ListPipelines`
217
+ - `sagemaker:ListPipelineExecutions`
218
+ - `sagemaker:DescribePipelineExecution`
219
+ - `sagemaker:ListPipelineExecutionSteps`
220
+ - `logs:DescribeLogStreams`
221
+ - `logs:GetLogEvents`
222
+
223
+ ## Mock AWS Profile
224
+
225
+ This repository includes mock AWS config files for local demos of profile switching and CLI argument parsing. They do not write to your real `~/.aws` files:
226
+
227
+ ```bash
228
+ export AWS_CONFIG_FILE=examples/aws/config
229
+ export AWS_SHARED_CREDENTIALS_FILE=examples/aws/credentials
230
+ export AWS_PROFILE=mock-dev
231
+ export AWS_DEFAULT_REGION=us-east-1
232
+ ```
233
+
234
+ You can also load the sample environment file directly:
235
+
236
+ ```bash
237
+ set -a
238
+ source examples/aws/mock.env
239
+ set +a
240
+ ```
241
+
242
+ Then run:
243
+
244
+ ```bash
245
+ smops processing submit --config examples/processing-job.json --dry-run
246
+ smops processing list --profile mock-dev
247
+ smops tui processing --profile mock-dev
248
+ ```
249
+
250
+ The bundled credentials are dummy values. They are only intended for dry runs, mock environments, local endpoints, or tests that use botocore Stubber/moto. They will not authenticate against real AWS.
251
+
252
+ ## E2E Tests
253
+
254
+ The tests use `moto` to simulate AWS SageMaker and CloudWatch Logs. They do not call real AWS services:
255
+
256
+ ```bash
257
+ pip install -e '.[dev]'
258
+ pytest
259
+ ```
260
+
261
+ Coverage includes:
262
+
263
+ - Processing Job submission and paginated running job lists
264
+ - Pipeline execution start and active/recent execution lists
265
+ - Pipeline step status display
266
+ - Failed step CloudWatch Logs tailing
267
+ - Processing Job TUI keyboard navigation with up, down, left, and right
268
+ - Pipeline TUI execution, step, and failed log loading
269
+ - Multiple AWS profile resolution
270
+
271
+ Moto does not currently implement `list_pipeline_execution_steps`, so that paginator is faked in memory in the tests. The other SageMaker and CloudWatch Logs calls run inside the moto environment.
@@ -0,0 +1,251 @@
1
+ # SageMaker Ops CLI
2
+
3
+ `smops` is a command-line tool for operating Amazon SageMaker Processing Jobs and SageMaker Pipelines.
4
+
5
+ It can:
6
+
7
+ - Submit SageMaker Processing Jobs
8
+ - Start SageMaker Pipeline executions
9
+ - Show running Processing Jobs in an interactive TUI
10
+ - Show running and recently completed Pipeline executions in an interactive TUI
11
+ - Inspect Pipeline step status and failed step CloudWatch logs
12
+ - Work with one, many, or all configured AWS profiles
13
+
14
+ ## Installation
15
+
16
+ Install from PyPI:
17
+
18
+ ```bash
19
+ pip install sagemaker-ops-cli
20
+ ```
21
+
22
+ The installed command is:
23
+
24
+ ```bash
25
+ smops --help
26
+ ```
27
+
28
+ Install from GitHub:
29
+
30
+ ```bash
31
+ pip install git+https://github.com/southpolemonkey/smops.git
32
+ ```
33
+
34
+ Install from a local wheel:
35
+
36
+ ```bash
37
+ pip install dist/sagemaker_ops_cli-0.1.1-py3-none-any.whl
38
+ ```
39
+
40
+ Install with Homebrew:
41
+
42
+ ```bash
43
+ brew tap southpolemonkey/smops https://github.com/southpolemonkey/smops
44
+ brew install sagemaker-ops-cli
45
+ ```
46
+
47
+ If the formula is later moved into a dedicated `southpolemonkey/homebrew-smops` tap repository, users can use the shorter command:
48
+
49
+ ```bash
50
+ brew tap southpolemonkey/smops
51
+ brew install sagemaker-ops-cli
52
+ ```
53
+
54
+ For local development:
55
+
56
+ ```bash
57
+ python -m venv .venv
58
+ source .venv/bin/activate
59
+ pip install -e .
60
+ ```
61
+
62
+ To enable YAML config files:
63
+
64
+ ```bash
65
+ pip install -e '.[yaml]'
66
+ ```
67
+
68
+ ## Build The Python Package
69
+
70
+ ```bash
71
+ pip install -e '.[dev]'
72
+ python -m build
73
+ ```
74
+
75
+ Build artifacts are written to `dist/`:
76
+
77
+ - `sagemaker_ops_cli-0.1.1-py3-none-any.whl`
78
+ - `sagemaker_ops_cli-0.1.1.tar.gz`
79
+
80
+ ## Submit A Processing Job
81
+
82
+ The config file uses the same parameter structure as boto3 `create_processing_job`.
83
+
84
+ ```bash
85
+ smops processing submit \
86
+ --profile dev \
87
+ --region us-east-1 \
88
+ --config examples/processing-job.json
89
+ ```
90
+
91
+ Validate the request without submitting it:
92
+
93
+ ```bash
94
+ smops processing submit --config examples/processing-job.json --dry-run
95
+ ```
96
+
97
+ ## Start A Pipeline Execution
98
+
99
+ ```bash
100
+ smops pipeline start \
101
+ --profile dev \
102
+ --region us-east-1 \
103
+ --name my-pipeline \
104
+ --display-name manual-run-001 \
105
+ --parameter InputDate=2026-06-30 \
106
+ --parameter Mode=prod
107
+ ```
108
+
109
+ ## Processing Jobs TUI
110
+
111
+ ```bash
112
+ smops tui processing --profile dev --region us-east-1
113
+ ```
114
+
115
+ Multiple profiles:
116
+
117
+ ```bash
118
+ smops tui processing --profile dev --profile prod --region us-east-1
119
+ ```
120
+
121
+ All profiles:
122
+
123
+ ```bash
124
+ smops tui processing --all-profiles
125
+ ```
126
+
127
+ Keyboard shortcuts:
128
+
129
+ - `Up` / `Down` or `Left` / `Right`: switch jobs
130
+ - `r`: refresh
131
+ - `q`: quit
132
+
133
+ ## Pipelines TUI
134
+
135
+ ```bash
136
+ smops tui pipelines --profile dev --region us-east-1
137
+ ```
138
+
139
+ Filter to one pipeline:
140
+
141
+ ```bash
142
+ smops tui pipelines --profile dev --region us-east-1 --name my-pipeline
143
+ ```
144
+
145
+ By default, the TUI shows running executions plus executions completed within the last 3 hours, so you can inspect recent success and failure results. Use `--hours` to adjust the time window:
146
+
147
+ ```bash
148
+ smops tui pipelines --profile dev --region us-east-1 --name my-pipeline --hours 6
149
+ ```
150
+
151
+ Keyboard shortcuts:
152
+
153
+ - `Left` / `Right`: switch focus between the executions and steps panels
154
+ - `Up` / `Down`: move within the focused panel
155
+ - `l`: load the CloudWatch log tail for the selected failed step
156
+ - `r`: refresh
157
+ - `q`: quit
158
+
159
+ Log discovery is currently supported for these step job types:
160
+
161
+ - ProcessingJob: `/aws/sagemaker/ProcessingJobs`
162
+ - TrainingJob: `/aws/sagemaker/TrainingJobs`
163
+ - TransformJob: `/aws/sagemaker/TransformJobs`
164
+
165
+ ## Non-Interactive Commands
166
+
167
+ ```bash
168
+ smops processing list --profile dev --region us-east-1
169
+ smops pipeline list --profile dev --region us-east-1
170
+ smops pipeline list --profile dev --region us-east-1 --name my-pipeline --hours 6
171
+ smops pipeline steps --profile dev --region us-east-1 --execution-arn arn:aws:sagemaker:...
172
+ ```
173
+
174
+ `processing list` reads 20 running jobs per page by default. If the output includes `Next token`, pass it to fetch the next page:
175
+
176
+ ```bash
177
+ smops processing list --profile dev --region us-east-1 --max-results 20
178
+ smops processing list --profile dev --region us-east-1 --max-results 20 --next-token '<token>'
179
+ ```
180
+
181
+ When `pipeline list` is used without `--name`, it scans 10 pipelines per page by default. This avoids long hangs in AWS accounts with many pipelines. If the output includes `Next token`, pass it to continue scanning:
182
+
183
+ ```bash
184
+ smops pipeline list --profile dev --region us-east-1 --pipeline-page-size 10
185
+ smops pipeline list --profile dev --region us-east-1 --pipeline-page-size 10 --next-token '<token>'
186
+ ```
187
+
188
+ ## AWS Permissions
189
+
190
+ The AWS identity used by `smops` needs at least these permissions:
191
+
192
+ - `sagemaker:CreateProcessingJob`
193
+ - `sagemaker:StartPipelineExecution`
194
+ - `sagemaker:ListProcessingJobs`
195
+ - `sagemaker:DescribeProcessingJob`
196
+ - `sagemaker:ListPipelines`
197
+ - `sagemaker:ListPipelineExecutions`
198
+ - `sagemaker:DescribePipelineExecution`
199
+ - `sagemaker:ListPipelineExecutionSteps`
200
+ - `logs:DescribeLogStreams`
201
+ - `logs:GetLogEvents`
202
+
203
+ ## Mock AWS Profile
204
+
205
+ This repository includes mock AWS config files for local demos of profile switching and CLI argument parsing. They do not write to your real `~/.aws` files:
206
+
207
+ ```bash
208
+ export AWS_CONFIG_FILE=examples/aws/config
209
+ export AWS_SHARED_CREDENTIALS_FILE=examples/aws/credentials
210
+ export AWS_PROFILE=mock-dev
211
+ export AWS_DEFAULT_REGION=us-east-1
212
+ ```
213
+
214
+ You can also load the sample environment file directly:
215
+
216
+ ```bash
217
+ set -a
218
+ source examples/aws/mock.env
219
+ set +a
220
+ ```
221
+
222
+ Then run:
223
+
224
+ ```bash
225
+ smops processing submit --config examples/processing-job.json --dry-run
226
+ smops processing list --profile mock-dev
227
+ smops tui processing --profile mock-dev
228
+ ```
229
+
230
+ The bundled credentials are dummy values. They are only intended for dry runs, mock environments, local endpoints, or tests that use botocore Stubber/moto. They will not authenticate against real AWS.
231
+
232
+ ## E2E Tests
233
+
234
+ The tests use `moto` to simulate AWS SageMaker and CloudWatch Logs. They do not call real AWS services:
235
+
236
+ ```bash
237
+ pip install -e '.[dev]'
238
+ pytest
239
+ ```
240
+
241
+ Coverage includes:
242
+
243
+ - Processing Job submission and paginated running job lists
244
+ - Pipeline execution start and active/recent execution lists
245
+ - Pipeline step status display
246
+ - Failed step CloudWatch Logs tailing
247
+ - Processing Job TUI keyboard navigation with up, down, left, and right
248
+ - Pipeline TUI execution, step, and failed log loading
249
+ - Multiple AWS profile resolution
250
+
251
+ Moto does not currently implement `list_pipeline_execution_steps`, so that paginator is faked in memory in the tests. The other SageMaker and CloudWatch Logs calls run inside the moto environment.
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "sagemaker-ops-cli"
7
- version = "0.1.0"
7
+ version = "0.1.1"
8
8
  description = "CLI and TUI for submitting and monitoring Amazon SageMaker Processing Jobs and Pipelines."
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.10"
@@ -1,4 +1,4 @@
1
1
  """SageMaker operations CLI."""
2
2
 
3
- __version__ = "0.1.0"
3
+ __version__ = "0.1.1"
4
4