in src/sagemaker/local/entities.py [0:0]
def start(self, input_data, output_data, transform_resources, **kwargs):
"""Start the Local Transform Job
Args:
input_data (dict): Describes the dataset to be transformed and the
location where it is stored.
output_data (dict): Identifies the location where to save the
results from the transform job
transform_resources (dict): compute instances for the transform job.
Currently only supports local or local_gpu
**kwargs: additional arguments coming from the boto request object
"""
self.transform_resources = transform_resources
self.input_data = input_data
self.output_data = output_data
image = self.primary_container["Image"]
instance_type = transform_resources["InstanceType"]
instance_count = 1
environment = self._get_container_environment(**kwargs)
# Start the container, pass the environment and wait for it to start up
self.container = _SageMakerContainer(
instance_type, instance_count, image, self.local_session
)
self.container.serve(self.primary_container["ModelDataUrl"], environment)
serving_port = get_config_value("local.serving_port", self.local_session.config) or 8080
_wait_for_serving_container(serving_port)
# Get capabilities from Container if needed
endpoint_url = "http://localhost:%s/execution-parameters" % serving_port
response, code = _perform_request(endpoint_url)
if code == 200:
execution_parameters = json.loads(response.read())
# MaxConcurrentTransforms is ignored because we currently only support 1
for setting in ("BatchStrategy", "MaxPayloadInMB"):
if setting not in kwargs and setting in execution_parameters:
kwargs[setting] = execution_parameters[setting]
# Apply Defaults if none was provided
kwargs.update(self._get_required_defaults(**kwargs))
self.start_time = datetime.datetime.now()
self.batch_strategy = kwargs["BatchStrategy"]
if "Environment" in kwargs:
self.environment = kwargs["Environment"]
# run the batch inference requests
self._perform_batch_inference(input_data, output_data, **kwargs)
self.end_time = datetime.datetime.now()
self.state = self._COMPLETED