Skip to content

Commit

Permalink
Apply flyteadmin changes from Yi Cheng
Browse files Browse the repository at this point in the history
Signed-off-by: Future-Outlier <[email protected]>
Co-authored-by: Yi Cheng <[email protected]>
  • Loading branch information
Future-Outlier and Yicheng-Lu-llll committed Nov 25, 2024
1 parent 0b06c3d commit c4b85c6
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions flyteadmin/dataproxy/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,18 @@ func (s Service) CreateDownloadLink(ctx context.Context, req *service.CreateDown
return nil, errors.NewFlyteAdminErrorf(codes.Internal, "no deckUrl found for request [%+v]", req)
}

// Check if the native url exists
metadata, err := s.dataStore.Head(ctx, storage.DataReference(nativeURL))
if err != nil {
return nil, errors.NewFlyteAdminErrorf(codes.Internal, "Failed to check the existence of the URL [%s]. Error: %v", nativeURL, err)
}
if !metadata.Exists() {
return nil, errors.NewFlyteAdminErrorf(
codes.NotFound,
"URL [%s] does not exist yet. Please try again later. If you are using the real-time deck, this could be because the 'persist' function has not been called yet.",
nativeURL)
}

signedURLResp, err := s.dataStore.CreateSignedURL(ctx, storage.DataReference(nativeURL), storage.SignedURLProperties{
Scope: stow.ClientMethodGet,
ExpiresIn: req.GetExpiresIn().AsDuration(),
Expand Down

0 comments on commit c4b85c6

Please sign in to comment.