Skip to content

Commit b20a123

Browse files
Daily Sync with Botocore v1.40.61 on 2025/10/29 (#345)
1 parent 6c174e7 commit b20a123

File tree

4 files changed

+188
-2
lines changed

4 files changed

+188
-2
lines changed

sample/sagemaker/2017-07-24/service-2.json

Lines changed: 48 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1542,6 +1542,19 @@
15421542
],
15431543
"documentation":"<p>Deletes a pipeline if there are no running instances of the pipeline. To delete a pipeline, you must stop all running instances of the pipeline using the <code>StopPipelineExecution</code> API. When you delete a pipeline, all instances of the pipeline are deleted.</p>"
15441544
},
1545+
"DeleteProcessingJob":{
1546+
"name":"DeleteProcessingJob",
1547+
"http":{
1548+
"method":"POST",
1549+
"requestUri":"/"
1550+
},
1551+
"input":{"shape":"DeleteProcessingJobRequest"},
1552+
"errors":[
1553+
{"shape":"ResourceNotFound"},
1554+
{"shape":"ResourceInUse"}
1555+
],
1556+
"documentation":"<p>Deletes a processing job. After Amazon SageMaker deletes a processing job, all of the metadata for the processing job is lost. You can delete only processing jobs that are in a terminal state (<code>Stopped</code>, <code>Failed</code>, or <code>Completed</code>). You cannot delete a job that is in the <code>InProgress</code> or <code>Stopping</code> state. After deleting the job, you can reuse its name to create another processing job.</p>"
1557+
},
15451558
"DeleteProject":{
15461559
"name":"DeleteProject",
15471560
"http":{
@@ -1590,6 +1603,19 @@
15901603
"output":{"shape":"DeleteTagsOutput"},
15911604
"documentation":"<p>Deletes the specified tags from an SageMaker resource.</p> <p>To list a resource's tags, use the <code>ListTags</code> API. </p> <note> <p>When you call this API to delete tags from a hyperparameter tuning job, the deleted tags are not removed from training jobs that the hyperparameter tuning job launched before you called this API.</p> </note> <note> <p>When you call this API to delete tags from a SageMaker Domain or User Profile, the deleted tags are not removed from Apps that the SageMaker Domain or User Profile launched before you called this API.</p> </note>"
15921605
},
1606+
"DeleteTrainingJob":{
1607+
"name":"DeleteTrainingJob",
1608+
"http":{
1609+
"method":"POST",
1610+
"requestUri":"/"
1611+
},
1612+
"input":{"shape":"DeleteTrainingJobRequest"},
1613+
"errors":[
1614+
{"shape":"ResourceNotFound"},
1615+
{"shape":"ResourceInUse"}
1616+
],
1617+
"documentation":"<p>Deletes a training job. After SageMaker deletes a training job, all of the metadata for the training job is lost. You can delete only training jobs that are in a terminal state (<code>Stopped</code>, <code>Failed</code>, or <code>Completed</code>) and don't retain an <code>Available</code> <a href=\"https://docs.aws.amazon.com/sagemaker/latest/dg/train-warm-pools.html\">managed warm pool</a>. You cannot delete a job that is in the <code>InProgress</code> or <code>Stopping</code> state. After deleting the job, you can reuse its name to create another training job.</p>"
1618+
},
15931619
"DeleteTrial":{
15941620
"name":"DeleteTrial",
15951621
"http":{
@@ -14682,6 +14708,16 @@
1468214708
}
1468314709
}
1468414710
},
14711+
"DeleteProcessingJobRequest":{
14712+
"type":"structure",
14713+
"required":["ProcessingJobName"],
14714+
"members":{
14715+
"ProcessingJobName":{
14716+
"shape":"ProcessingJobName",
14717+
"documentation":"<p>The name of the processing job to delete.</p>"
14718+
}
14719+
}
14720+
},
1468514721
"DeleteProjectInput":{
1468614722
"type":"structure",
1468714723
"required":["ProjectName"],
@@ -14740,6 +14776,16 @@
1474014776
"type":"structure",
1474114777
"members":{}
1474214778
},
14779+
"DeleteTrainingJobRequest":{
14780+
"type":"structure",
14781+
"required":["TrainingJobName"],
14782+
"members":{
14783+
"TrainingJobName":{
14784+
"shape":"TrainingJobName",
14785+
"documentation":"<p>The name of the training job to delete.</p>"
14786+
}
14787+
}
14788+
},
1474314789
"DeleteTrialComponentRequest":{
1474414790
"type":"structure",
1474514791
"required":["TrialComponentName"],
@@ -42006,7 +42052,8 @@
4200642052
"Completed",
4200742053
"Failed",
4200842054
"Stopping",
42009-
"Stopped"
42055+
"Stopped",
42056+
"Deleting"
4201042057
]
4201142058
},
4201242059
"TrainingJobStatusCounter":{

src/sagemaker_core/main/code_injection/shape_dag.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4213,6 +4213,10 @@
42134213
"members": [{"name": "PipelineArn", "shape": "PipelineArn", "type": "string"}],
42144214
"type": "structure",
42154215
},
4216+
"DeleteProcessingJobRequest": {
4217+
"members": [{"name": "ProcessingJobName", "shape": "ProcessingJobName", "type": "string"}],
4218+
"type": "structure",
4219+
},
42164220
"DeleteProjectInput": {
42174221
"members": [{"name": "ProjectName", "shape": "ProjectEntityName", "type": "string"}],
42184222
"type": "structure",
@@ -4252,6 +4256,10 @@
42524256
"type": "structure",
42534257
},
42544258
"DeleteTagsOutput": {"members": [], "type": "structure"},
4259+
"DeleteTrainingJobRequest": {
4260+
"members": [{"name": "TrainingJobName", "shape": "TrainingJobName", "type": "string"}],
4261+
"type": "structure",
4262+
},
42554263
"DeleteTrialComponentRequest": {
42564264
"members": [
42574265
{"name": "TrialComponentName", "shape": "ExperimentEntityName", "type": "string"}

src/sagemaker_core/main/resources.py

Lines changed: 131 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26308,6 +26308,40 @@ def refresh(
2630826308
transform(response, "DescribeProcessingJobResponse", self)
2630926309
return self
2631026310

26311+
@Base.add_validate_call
26312+
def delete(
26313+
self,
26314+
) -> None:
26315+
"""
26316+
Delete a ProcessingJob resource
26317+
26318+
Raises:
26319+
botocore.exceptions.ClientError: This exception is raised for AWS service related errors.
26320+
The error message and error code can be parsed from the exception as follows:
26321+
```
26322+
try:
26323+
# AWS service call here
26324+
except botocore.exceptions.ClientError as e:
26325+
error_message = e.response['Error']['Message']
26326+
error_code = e.response['Error']['Code']
26327+
```
26328+
ResourceInUse: Resource being accessed is in use.
26329+
ResourceNotFound: Resource being access is not found.
26330+
"""
26331+
26332+
client = Base.get_sagemaker_client()
26333+
26334+
operation_input_args = {
26335+
"ProcessingJobName": self.processing_job_name,
26336+
}
26337+
# serialize the input request
26338+
operation_input_args = serialize(operation_input_args)
26339+
logger.debug(f"Serialized input request: {operation_input_args}")
26340+
26341+
client.delete_processing_job(**operation_input_args)
26342+
26343+
logger.info(f"Deleting {self.__class__.__name__} - {self.get_name()}")
26344+
2631126345
@Base.add_validate_call
2631226346
def stop(self) -> None:
2631326347
"""
@@ -28708,6 +28742,40 @@ def update(
2870828742

2870928743
return self
2871028744

28745+
@Base.add_validate_call
28746+
def delete(
28747+
self,
28748+
) -> None:
28749+
"""
28750+
Delete a TrainingJob resource
28751+
28752+
Raises:
28753+
botocore.exceptions.ClientError: This exception is raised for AWS service related errors.
28754+
The error message and error code can be parsed from the exception as follows:
28755+
```
28756+
try:
28757+
# AWS service call here
28758+
except botocore.exceptions.ClientError as e:
28759+
error_message = e.response['Error']['Message']
28760+
error_code = e.response['Error']['Code']
28761+
```
28762+
ResourceInUse: Resource being accessed is in use.
28763+
ResourceNotFound: Resource being access is not found.
28764+
"""
28765+
28766+
client = Base.get_sagemaker_client()
28767+
28768+
operation_input_args = {
28769+
"TrainingJobName": self.training_job_name,
28770+
}
28771+
# serialize the input request
28772+
operation_input_args = serialize(operation_input_args)
28773+
logger.debug(f"Serialized input request: {operation_input_args}")
28774+
28775+
client.delete_training_job(**operation_input_args)
28776+
28777+
logger.info(f"Deleting {self.__class__.__name__} - {self.get_name()}")
28778+
2871128779
@Base.add_validate_call
2871228780
def stop(self) -> None:
2871328781
"""
@@ -28822,6 +28890,69 @@ def wait(
2882228890
raise TimeoutExceededError(resouce_type="TrainingJob", status=current_status)
2882328891
time.sleep(poll)
2882428892

28893+
@Base.add_validate_call
28894+
def wait_for_delete(
28895+
self,
28896+
poll: int = 5,
28897+
timeout: Optional[int] = None,
28898+
) -> None:
28899+
"""
28900+
Wait for a TrainingJob resource to be deleted.
28901+
28902+
Parameters:
28903+
poll: The number of seconds to wait between each poll.
28904+
timeout: The maximum number of seconds to wait before timing out.
28905+
28906+
Raises:
28907+
botocore.exceptions.ClientError: This exception is raised for AWS service related errors.
28908+
The error message and error code can be parsed from the exception as follows:
28909+
```
28910+
try:
28911+
# AWS service call here
28912+
except botocore.exceptions.ClientError as e:
28913+
error_message = e.response['Error']['Message']
28914+
error_code = e.response['Error']['Code']
28915+
```
28916+
TimeoutExceededError: If the resource does not reach a terminal state before the timeout.
28917+
DeleteFailedStatusError: If the resource reaches a failed state.
28918+
WaiterError: Raised when an error occurs while waiting.
28919+
"""
28920+
start_time = time.time()
28921+
28922+
progress = Progress(
28923+
SpinnerColumn("bouncingBar"),
28924+
TextColumn("{task.description}"),
28925+
TimeElapsedColumn(),
28926+
)
28927+
progress.add_task("Waiting for TrainingJob to be deleted...")
28928+
status = Status("Current status:")
28929+
28930+
with Live(
28931+
Panel(
28932+
Group(progress, status),
28933+
title="Wait Log Panel",
28934+
border_style=Style(color=Color.BLUE.value),
28935+
)
28936+
):
28937+
while True:
28938+
try:
28939+
self.refresh()
28940+
current_status = self.training_job_status
28941+
status.update(f"Current status: [bold]{current_status}")
28942+
28943+
if timeout is not None and time.time() - start_time >= timeout:
28944+
raise TimeoutExceededError(
28945+
resouce_type="TrainingJob", status=current_status
28946+
)
28947+
except botocore.exceptions.ClientError as e:
28948+
error_code = e.response["Error"]["Code"]
28949+
28950+
if "ResourceNotFound" in error_code or "ValidationException" in error_code:
28951+
logger.info("Resource was not found. It may have been deleted.")
28952+
return
28953+
raise e
28954+
time.sleep(poll)
28955+
2882528956
@classmethod
2882628957
@Base.add_validate_call
2882728958
def get_all(
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
{"SupportedAPIs": 363, "UnsupportedAPIs": 15}
1+
{"SupportedAPIs": 365, "UnsupportedAPIs": 15}

0 commit comments

Comments
 (0)