Skip to content

Commit a48627e

Browse files
author
Dewen Qi
committed
fix: fix format issues
1 parent b73dc1d commit a48627e

File tree

3 files changed

+30
-22
lines changed

3 files changed

+30
-22
lines changed

src/sagemaker/workflow/fail_step.py

+14-8
Original file line numberDiff line numberDiff line change
@@ -36,13 +36,17 @@ def __init__(
3636
"""Constructs a `FailStep`.
3737
3838
Args:
39-
name (str): The name of the `FailStep`. A name is required and must be unique within a pipeline.
40-
error_message (str or PipelineNonPrimitiveInputTypes): An error message defined by the user.
39+
name (str): The name of the `FailStep`. A name is required and must be
40+
unique within a pipeline.
41+
error_message (str or PipelineNonPrimitiveInputTypes):
42+
An error message defined by the user.
4143
Once the `FailStep` is reached, the execution fails and the
4244
error message is set as the failure reason (default: None).
43-
display_name (str): The display name of the `FailStep`. The display name provides better UI readability. (default: None).
45+
display_name (str): The display name of the `FailStep`.
46+
The display name provides better UI readability. (default: None).
4447
description (str): The description of the `FailStep` (default: None).
45-
depends_on (List[str] or List[Step]): A list of `Step` names or `Step` instances that this `FailStep` depends on.
48+
depends_on (List[str] or List[Step]): A list of `Step` names or `Step` instances
49+
that this `FailStep` depends on.
4650
If a listed `Step` name does not exist, an error is returned (default: None).
4751
"""
4852
super(FailStep, self).__init__(
@@ -57,9 +61,11 @@ def arguments(self) -> RequestType:
5761

5862
@property
5963
def properties(self):
60-
"""A `Properties` object is not available for the `FailStep`. Executing a `FailStep` will terminate the pipeline.
61-
`FailStep` properties should not be referenced and no other `Step` should depend on the `FailStep`."""
64+
"""A `Properties` object is not available for the `FailStep`.
65+
66+
Executing a `FailStep` will terminate the pipeline.
67+
`FailStep` properties should not be referenced.
68+
"""
6269
raise RuntimeError(
63-
"The Properties object is not available for the FailStep "
64-
+ "as it cannot be referenced by other steps."
70+
"FailStep is a terminal step and the Properties object is not available for it."
6571
)

src/sagemaker/workflow/steps.py

+14-12
Original file line numberDiff line numberDiff line change
@@ -147,8 +147,9 @@ class CacheConfig:
147147
If caching is enabled, the pipeline attempts to find a previous execution of a `Step`
148148
that was called with the same arguments. `Step` caching only considers successful execution.
149149
If a successful previous execution is found, the pipeline propagates the values
150-
from the previous execution rather than recomputing the `Step`. When multiple successful executions
151-
exist within the timeout period, it uses the result for the most recent successful execution.
150+
from the previous execution rather than recomputing the `Step`.
151+
When multiple successful executions exist within the timeout period,
152+
it uses the result for the most recent successful execution.
152153
153154
154155
Attributes:
@@ -237,8 +238,8 @@ def __init__(
237238
):
238239
"""Construct a `TrainingStep`, given an `EstimatorBase` instance.
239240
240-
In addition to the `EstimatorBase` instance, the other arguments are those that are supplied to
241-
the `fit` method of the `sagemaker.estimator.Estimator`.
241+
In addition to the `EstimatorBase` instance, the other arguments are those
242+
that are supplied to the `fit` method of the `sagemaker.estimator.Estimator`.
242243
243244
Args:
244245
name (str): The name of the `TrainingStep`.
@@ -408,8 +409,8 @@ def __init__(
408409
):
409410
"""Constructs a `TransformStep`, given a `Transformer` instance.
410411
411-
In addition to the `Transformer` instance, the other arguments are those that are supplied to
412-
the `transform` method of the `sagemaker.transformer.Transformer`.
412+
In addition to the `Transformer` instance, the other arguments are those
413+
that are supplied to the `transform` method of the `sagemaker.transformer.Transformer`.
413414
414415
Args:
415416
name (str): The name of the `TransformStep`.
@@ -614,8 +615,8 @@ def __init__(
614615
):
615616
"""Construct a `TuningStep`, given a `HyperparameterTuner` instance.
616617
617-
In addition to the `HyperparameterTuner` instance, the other arguments are those that are supplied to
618-
the `fit` method of the `sagemaker.tuner.HyperparameterTuner`.
618+
In addition to the `HyperparameterTuner` instance, the other arguments are those
619+
that are supplied to the `fit` method of the `sagemaker.tuner.HyperparameterTuner`.
619620
620621
Args:
621622
name (str): The name of the `TuningStep`.
@@ -652,7 +653,7 @@ def __init__(
652653
job_arguments (List[str]): A list of strings to be passed into the processing job.
653654
Defaults to `None`.
654655
cache_config (CacheConfig): A `sagemaker.workflow.steps.CacheConfig` instance.
655-
depends_on (List[str] or List[Step]): A list of `Step` names or `Step` instances that
656+
depends_on (List[str] or List[Step]): A list of `Step` names or `Step` instances that
656657
this `sagemaker.workflow.steps.ProcessingStep` depends on.
657658
retry_policies (List[RetryPolicy]): A list of retry policies.
658659
"""
@@ -694,8 +695,9 @@ def arguments(self) -> RequestType:
694695

695696
@property
696697
def properties(self):
697-
"""A `Properties` object representing
698-
`DescribeHyperParameterTuningJobResponse` and
698+
"""A `Properties` object
699+
700+
A `Properties` object representing `DescribeHyperParameterTuningJobResponse` and
699701
`ListTrainingJobsForHyperParameterTuningJobResponse` data model.
700702
"""
701703
return self._properties
@@ -713,7 +715,7 @@ def get_top_model_s3_uri(self, top_k: int, s3_bucket: str, prefix: str = "") ->
713715
714716
Args:
715717
top_k (int): The index of the top performing training job
716-
tuning step stores up to 50 top performing training jobs.
718+
tuning step stores up to 50 top performing training jobs.
717719
A valid top_k value is from 0 to 49. The best training job
718720
model is at index 0.
719721
s3_bucket (str): The S3 bucket to store the training job output artifact.

tests/unit/sagemaker/workflow/test_fail_step.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,6 @@ def test_fail_step_with_properties_ref():
116116
fail_step.properties()
117117

118118
assert (
119-
str(error.value) == "The Properties object is not available for the Fail step "
120-
"as it cannot be referenced by other steps."
119+
str(error.value)
120+
== "FailStep is a terminal step and the Properties object is not available for it."
121121
)

0 commit comments

Comments
 (0)