Skip to content

AsyncPredictor fails if name is None, despite it being the default #4774

Open
@david-waterworth

Description

@david-waterworth

Describe the bug

The name argument of the AsyncPredictor.__init__.py is optional with default=None

But calling async_predictor.predict(data=...) requires name to be non-null, i.e._upload_data_to_s3 calls name_from_base on self.name which fails if name is None (i.e. the default)

To reproduce

from sagemaker.predictor import Predictor
from sagemaker.predictor_async import AsyncPredictor

predictor = Predictor(endpoint_name=endpoint_name, sagemaker_session=sagemaker_session)
async_predictor = AsyncPredictor(predictor)

result = async_predictor.predict(data=request_body)

TypeError: 'NoneType' object is not subscriptable

Expected behavior
The name field of AsyncPredictor should have a "non-None" default (a guid, or the endpoint name?)

System information
A description of your system. Please provide:

  • SageMaker Python SDK version: '2.224.2'
  • Framework name (eg. PyTorch) or algorithm (eg. KMeans): PyTorch / Triton (custom inference container)
  • Framework version:
  • Python version:
  • CPU or GPU:
  • Custom Docker image (Y/N): Y

Additional context
Add any other context about the problem here.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions