aws / aws/sagemaker-python-sdk

TensorBoard get_url feature not creating proper redirect link to SageMaker Studio

Đang mở
#5,252 0 bình luận 0 reaction 0 người được giao Xem trên GitHub
component: pysdk-team type: bug
Ngôn ngữ chính
Python
Star
2.3k
Fork
1.3k
Merge trung bình
1 ngày 22 giờ
Pull request đã merge (30 ngày)
35

Mô tả

# TensorBoard get_url feature not creating proper redirect link to SageMaker Studio

## Describe the bug
The `get_app_url` method in the TensorBoard application class (`sagemaker.interactive_apps.tensorboard.TensorBoardApp`) does not create proper redirect links when used with `create_presigned_domain_url=True`. Currently, the generated URL redirects to a SageMaker Studio blank page instead of opening the TensorBoard application directly. This makes it difficult to access TensorBoard visualizations from outside the Studio environment.

## To reproduce

The issue can be reproduced with the following code (extract from the [documentation](https://docs.aws.amazon.com/sagemaker/latest/dg/debugger-htb-access-tb-url.html#debugger-htb-access-tb-url-presigned)):

```python
from sagemaker.interactive_apps import tensorboard
region = "us-east-1"
app = tensorboard.TensorBoardApp(region)

print(
app.get_app_url(
create_presigned_domain_url=True, # Required to be set to True for creating a presigned URL
domain_id="your-domain-id", # Replace with your actual domain ID
user_profile_name="your-user-profile", # Replace with your actual user profile name
open_in_default_web_browser=False, # Set to False to print the URL to terminal
)
)
```

When executing this code, the generated URL opens a blank SageMaker Studio page instead of directly opening the TensorBoard application.

## Expected behavior

The generated URL should directly open the TensorBoard application in SageMaker Studio. The `LandingUri` parameter in `optional_create_presigned_url_kwargs` should correctly route the user to the TensorBoard application with the proper URI format.

The correct behavior would be for the URL to open directly to the TensorBoard interface, bypassing the need for manual navigation within Studio.

### How to make it work

After investigating this issue, I found that the correct format for the `LandingUri` parameter needs to be specified differently to properly redirect to TensorBoard. Here's the working solution:

```python
from sagemaker.interactive_apps import tensorboard
region = "us-east-1"
app = tensorboard.TensorBoardApp(region)

print(
app.get_app_url(
create_presigned_domain_url=True, # Required to be set to True for creating a presigned URL
domain_id="your-domain-id", # Replace with your actual domain ID
user_profile_name="your-user-profile", # Replace with your actual user profile name
open_in_default_web_browser=False, # Set to False to print the URL to terminal
optional_create_presigned_url_kwargs={
"LandingUri": "app:TensorBoard:default/"
}
)
)
```

## Screenshots or logs

When accessing the generated URL, you're taken to a blank SageMaker Studio page instead of the TensorBoard application.

Image

## System information
- **SageMaker Python SDK version**: 2.249.0 - latest
- **Framework name**: TensorFlow
- **Framework version**: N/A
- **Python version**: 3.13
- **CPU or GPU**: N/A
- **Custom Docker image**: N/A

## Additional context

The issue appears to be in how the TensorBoard application integration handles the `LandingUri` parameter from the underlying `create_presigned_domain_url` API.

A potential fix would be to update the SDK to properly handle the TensorBoard-specific URI format in the `get_app_url` method of the TensorBoardApp class.

The AWS documentation needs to be update or the SDK fixed

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Hướng nghiên cứu

Bắt đầu với sagemaker.interactive_apps.tensorboard.TensorBoardApp.get_app_url và theo dõi cách optional_create_presigned_url_kwargs cung cấp LandingUri khi create_presigned_domain_url=True. Tái hiện ví dụ được cung cấp và xác minh rằng URL được tạo sẽ mở trực tiếp ứng dụng TensorBoard trong SageMaker Studio thay vì hiển thị một trang trống.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Đánh giá

Công nghệ
aws, python
Lĩnh vực
cloud, machine-learning
Loại issue
Lỗi
Độ khó
2/5
Thời gian dự kiến
1-3 giờ
Mức độ hoạt động
Đình trệ
Độ rõ ràng
Đặc tả rõ ràng
Mức phù hợp với người mới
45/100

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.