Skip to content

SageMaker Async Endpoint: Job accepted, but container is never called (no invocation logs, no error file)

0

Hi everyone,

I am stuck with a problem with a SageMaker Asynchronous Endpoint and am hoping for new ideas.

My setup: I have a service that processes images. Since the amount of data per request is large, I am using an asynchronous SageMaker endpoint.

  • Client: A FastAPI server that sends the inference request to the endpoint via boto3 and invoke_endpoint_async.

  • Endpoint: A SageMaker endpoint hosting a PyTorch model in a custom container.

The problem: My client code is working fine:

  1. the input file (.jsonl) is successfully uploaded to S3.
  2. the invoke_endpoint_async call is successful and returns the status 202 Accepted.
  3. i receive a valid OutputLocation and a FailureLocation in response.

The endpoint itself is in "InService" status. In the CloudWatch logs of the endpoint container, I consistently see successful /ping requests from the SageMaker service.

However, my actual inference code is never executed:

  • Not a single log entry appears for a call to /invocations. Even the very first line of my transform_fn is not logged.
  • No output file is created in the OutputLocation.
  • No error file is created in the FailureLocation.
  • The job just seems to disappear into nothingness after it has been accepted.

What I have already ruled out:

  • Client code: The code is correct as the job is started successfully.
  • IAM role policy: The SageMakerExecutionRole of the endpoint has a policy that explicitly allows s3:GetObject for the input bucket and s3:PutObject for the output bucket and the SageMaker default bucket (for the FailureLocation).
  • IAM Policy Simulator: I tested the role in the simulator. The result for s3:GetObject on the input file and s3:PutObject on the failure location is allowed for both.
  • S3 Bucket Policy: There is no bucket policy defined on the S3 bucket that could block access.

My question: What can prevent the SageMaker service from sending the /invocations call to a healthy container AND prevent the writing of an error file at the same time, even though the IAM Policy Simulator shows all permissions as "allowed"?

asked a year ago311 views

1 Answer
0
Accepted Answer

When your SageMaker asynchronous endpoint accepts a job but never processes it (no invocation logs, no output or error files), there are several potential issues to investigate:

  1. CloudWatch Logs Location: Make sure you're checking the correct CloudWatch log location. For asynchronous endpoints, review logs under /aws/sagemaker/Endpoints/your-endpoint-name and specifically the log stream named your-production-variant-name/your-instance-id/data-log.

  2. Container Structure Issues: Your custom container might have structural problems that prevent proper invocation:

  • Check if your inference code (typically 'inference.py') is correctly located in a 'code/' subfolder within your model tarball
  • Ensure the /usr/bin/serve file exists in your container
  • Verify your model artifacts are properly copied to /opt/ml/model (a missing trailing slash in paths can cause issues)
  1. Log Buffering: Python might be buffering logs, which prevents them from appearing before the process crashes. Try setting the environment variable PYTHONUNBUFFERED to "1" when creating your model to disable Python log buffering.

  2. Request TTL and Invocation Timeout: Check if your RequestTTLSeconds and InvocationTimeoutSeconds parameters in your invoke_endpoint_async call are appropriate. The default TTL is 6 hours, and the default invocation timeout is 15 minutes.

  3. Container Health Check vs. Invocation: Your container is responding to health checks (/ping) but might be failing when processing actual invocations. This could indicate a problem with how your container handles the invocation request specifically.

  4. Model Artifact Conflicts: The container might be encountering conflicts when trying to load your model. Ensure your model tarball extracts correctly and doesn't create unexpected subfolders.

  5. Local Testing: Consider testing your inference code locally using SageMaker Local Mode with 'instance_type=local' to identify issues before cloud deployment.

Since your container is healthy enough to respond to ping requests but not processing invocations, focus on how your container handles the specific invocation path and whether it can access the input data from S3 during the actual inference process.
Sources
Sagemaker endpoint creation failing | AWS re:Post
Failed to create endpoint in sagemaker without any reason and logs | AWS re:Post
Troubleshoot invoke issues with Sagemaker AI asynchronous endpoints | AWS re:Post

answered a year ago

EXPERT

reviewed a year ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.