Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def build_workflow_definition(self):
"""
Build the workflow definition for the inference pipeline with all the states involved.
Returns:
:class:`~stepfunctions.steps.states.Chain`: Workflow definition as a chain of states involved in the the inference pipeline.
"""
default_name = self.pipeline_name
train_instance_type = self.preprocessor.train_instance_type
train_instance_count = self.preprocessor.train_instance_count
# Preprocessor for feature transformation
preprocessor_train_step = TrainingStep(
StepId.TrainPreprocessor.value,
estimator=self.preprocessor,
job_name=default_name + '/preprocessor-source',
data=self.inputs,
)
preprocessor_model = self.preprocessor.create_model()
preprocessor_model_step = ModelStep(
StepId.CreatePreprocessorModel.value,
instance_type=train_instance_type,
model=preprocessor_model,
model_name=default_name
)
preprocessor_transform_step = TransformStep(
StepId.TransformInput.value,
transformer=self.preprocessor.transformer(instance_count=train_instance_count, instance_type=train_instance_type, max_payload=20),
job_name=default_name,
)
preprocessor_transform_step = TransformStep(
StepId.TransformInput.value,
transformer=self.preprocessor.transformer(instance_count=train_instance_count, instance_type=train_instance_type, max_payload=20),
job_name=default_name,
model_name=default_name,
data=self.inputs['train'],
compression_type=self.compression_type,
content_type=self.content_type
)
# Training
train_instance_type = self.estimator.train_instance_type
train_instance_count = self.estimator.train_instance_count
training_step = TrainingStep(
StepId.Train.value,
estimator=self.estimator,
job_name=default_name + '/estimator-source',
data=self.inputs,
)
pipeline_model = PipelineModel(
name='PipelineModel',
role=self.estimator.role,
models=[
self.preprocessor.create_model(),
self.estimator.create_model()
]
)
pipeline_model_step = ModelStep(
StepId.CreatePipelineModel.value,