How to retrieve InputLocation and CustomAttributes in the container when calling invoke_endpoint_async in Sagermaker Async

0

I am trying to implement sagemaker async with my own model based endpoint. To invoke the service in the container, I used invoke_endpoint_async function. Here is the code:

input_location = "S3://xxxxxx/xxx/xxx.vtk"
resp = sagemaker_runtime.invoke_endpoint_async(
    EndpointName=endpoint_name_async,
    InputLocation=input_location,
    CustomAttributes=json.dumps({"test_key": "test_value"})
    )

In the container, I am trying to retrieving those information. Here is the code:

@app.route("/invocations", methods=["POST"])
async def invocation_handler(req):
    if req.headers is not None:
        custom_attribute = json.loads(req.headers.get("x-amzn-sagemaker-custom-attributes"))
    # ... ...

This is the only way I can find to retrieve the CustomAttributes from the request and I don't know where is the InputLocation or where is the input file. req has an attribute called req.files. But it is empty.

Can someone help me figure this out? All I want to do is retrieve the input data stored in S3 and do further process in the container as the endpoint.

질문됨 일 년 전38회 조회
답변 없음

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인

관련 콘텐츠