@@ -60,13 +60,12 @@ class Step(Entity):
6060 Attributes:
6161 name (str): The name of the step.
6262 step_type (StepTypeEnum): The type of the step.
63- depends_on (List[str] or List[Step]): The list of step names or step
64- instances the current step depends on
63+ depends_on (List[str]): The list of step names the current step depends on
6564 """
6665
6766 name : str = attr .ib (factory = str )
6867 step_type : StepTypeEnum = attr .ib (factory = StepTypeEnum .factory )
69- depends_on : Union [ List [str ], List [ "Step" ] ] = attr .ib (default = None )
68+ depends_on : List [str ] = attr .ib (default = None )
7069
7170 @property
7271 @abc .abstractmethod
@@ -86,13 +85,11 @@ def to_request(self) -> RequestType:
8685 "Arguments" : self .arguments ,
8786 }
8887 if self .depends_on :
89- request_dict ["DependsOn" ] = self ._resolve_depends_on (self .depends_on )
90-
88+ request_dict ["DependsOn" ] = self .depends_on
9189 return request_dict
9290
93- def add_depends_on (self , step_names : Union [List [str ], List ["Step" ]]):
94- """Add step names or step instances to the current step depends on list"""
95-
91+ def add_depends_on (self , step_names : List [str ]):
92+ """Add step names to the current step depends on list"""
9693 if not step_names :
9794 return
9895 if not self .depends_on :
@@ -104,19 +101,6 @@ def ref(self) -> Dict[str, str]:
104101 """Gets a reference dict for steps"""
105102 return {"Name" : self .name }
106103
107- @staticmethod
108- def _resolve_depends_on (depends_on_list : Union [List [str ], List ["Step" ]]):
109- """Resolver the step depends on list"""
110- depends_on = []
111- for step in depends_on_list :
112- if isinstance (step , Step ):
113- depends_on .append (step .name )
114- elif isinstance (step , str ):
115- depends_on .append (step )
116- else :
117- raise ValueError (f"Invalid input step name: { step } " )
118- return depends_on
119-
120104
121105@attr .s
122106class CacheConfig :
@@ -159,7 +143,7 @@ def __init__(
159143 estimator : EstimatorBase ,
160144 inputs : Union [TrainingInput , dict , str , FileSystemInput ] = None ,
161145 cache_config : CacheConfig = None ,
162- depends_on : Union [ List [str ], List [ Step ] ] = None ,
146+ depends_on : List [str ] = None ,
163147 ):
164148 """Construct a TrainingStep, given an `EstimatorBase` instance.
165149
@@ -187,8 +171,8 @@ def __init__(
187171 the path to the training dataset.
188172
189173 cache_config (CacheConfig): A `sagemaker.workflow.steps.CacheConfig` instance.
190- depends_on (List[str] or List[Step] ): A list of step names or step instances
191- this `sagemaker.workflow.steps.TrainingStep` depends on
174+ depends_on (List[str]): A list of step names this `sagemaker.workflow.steps.TrainingStep`
175+ depends on
192176 """
193177 super (TrainingStep , self ).__init__ (name , StepTypeEnum .TRAINING , depends_on )
194178 self .estimator = estimator
@@ -233,11 +217,7 @@ class CreateModelStep(Step):
233217 """CreateModel step for workflow."""
234218
235219 def __init__ (
236- self ,
237- name : str ,
238- model : Model ,
239- inputs : CreateModelInput ,
240- depends_on : Union [List [str ], List [Step ]] = None ,
220+ self , name : str , model : Model , inputs : CreateModelInput , depends_on : List [str ] = None
241221 ):
242222 """Construct a CreateModelStep, given an `sagemaker.model.Model` instance.
243223
@@ -249,8 +229,8 @@ def __init__(
249229 model (Model): A `sagemaker.model.Model` instance.
250230 inputs (CreateModelInput): A `sagemaker.inputs.CreateModelInput` instance.
251231 Defaults to `None`.
252- depends_on (List[str] or List[Step] ): A list of step names or step instances
253- this `sagemaker.workflow.steps.CreateModelStep` depends on
232+ depends_on (List[str]): A list of step names this `sagemaker.workflow.steps.CreateModelStep`
233+ depends on
254234 """
255235 super (CreateModelStep , self ).__init__ (name , StepTypeEnum .CREATE_MODEL , depends_on )
256236 self .model = model
@@ -295,7 +275,7 @@ def __init__(
295275 transformer : Transformer ,
296276 inputs : TransformInput ,
297277 cache_config : CacheConfig = None ,
298- depends_on : Union [ List [str ], List [ Step ] ] = None ,
278+ depends_on : List [str ] = None ,
299279 ):
300280 """Constructs a TransformStep, given an `Transformer` instance.
301281
@@ -307,8 +287,8 @@ def __init__(
307287 transformer (Transformer): A `sagemaker.transformer.Transformer` instance.
308288 inputs (TransformInput): A `sagemaker.inputs.TransformInput` instance.
309289 cache_config (CacheConfig): A `sagemaker.workflow.steps.CacheConfig` instance.
310- depends_on (List[str] or List[Step] ): A list of step names or step instances
311- this `sagemaker.workflow.steps.TransformStep` depends on
290+ depends_on (List[str]): A list of step names this `sagemaker.workflow.steps.TransformStep`
291+ depends on
312292 """
313293 super (TransformStep , self ).__init__ (name , StepTypeEnum .TRANSFORM , depends_on )
314294 self .transformer = transformer
@@ -371,7 +351,7 @@ def __init__(
371351 code : str = None ,
372352 property_files : List [PropertyFile ] = None ,
373353 cache_config : CacheConfig = None ,
374- depends_on : Union [ List [str ], List [ Step ] ] = None ,
354+ depends_on : List [str ] = None ,
375355 ):
376356 """Construct a ProcessingStep, given a `Processor` instance.
377357
@@ -392,8 +372,8 @@ def __init__(
392372 property_files (List[PropertyFile]): A list of property files that workflow looks
393373 for and resolves from the configured processing output list.
394374 cache_config (CacheConfig): A `sagemaker.workflow.steps.CacheConfig` instance.
395- depends_on (List[str] or List[Step] ): A list of step names or step instance
396- this `sagemaker.workflow.steps.ProcessingStep` depends on
375+ depends_on (List[str]): A list of step names this `sagemaker.workflow.steps.ProcessingStep`
376+ depends on
397377 """
398378 super (ProcessingStep , self ).__init__ (name , StepTypeEnum .PROCESSING , depends_on )
399379 self .processor = processor
0 commit comments