in smdebug_rulesconfig/actions/actions.py [0:0]
def __init__(self, training_job_prefix: Optional[str] = None):
"""
Action for stopping the training job when a rule is fired. Note that a policy must be created in the AWS
account to allow the sagemaker role to stop the training job:
```
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "VisualEditor0",
"Effect": "Allow",
"Action": "sagemaker:StopTrainingJob",
"Resource": "arn:aws:sagemaker:*:<account_id>:training-job/*"
}
]
}
```
:param training_job_prefix: The prefix of the training job to stop if the rule is fired. This must only refer
to one active training job, otherwise no training job will be stopped.
"""
self.use_default_training_job_prefix = True
if training_job_prefix is not None:
validate_training_job_prefix("training_job_prefix", training_job_prefix)
self.use_default_training_job_prefix = False
super(StopTraining, self).__init__(training_job_prefix=training_job_prefix)