fix(savepoint): wrong savepoint path in download savepoint route
This commit is contained in:
parent
e32addcea5
commit
9629e70ed7
@ -89,3 +89,7 @@ func (job ManagedJob) TriggerSavepoint() error {
|
|||||||
err = job.trackSavepoint()
|
err = job.trackSavepoint()
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (job ManagedJob) GetLastSavepointPath() *string {
|
||||||
|
return job.def.Status.LastSavepointPath
|
||||||
|
}
|
||||||
|
|||||||
@ -14,6 +14,7 @@ import (
|
|||||||
"io"
|
"io"
|
||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
|
"strings"
|
||||||
|
|
||||||
"github.com/danielgtaylor/huma/v2"
|
"github.com/danielgtaylor/huma/v2"
|
||||||
"go.uber.org/zap"
|
"go.uber.org/zap"
|
||||||
@ -128,7 +129,14 @@ func TriggerSavepoint(ctx context.Context, req *JobTriggerSavepointReq) (*JobTri
|
|||||||
}
|
}
|
||||||
|
|
||||||
func DownloadSavepoint(ctx context.Context, req *types.SavepointDownloadReq) (*huma.StreamResponse, error) {
|
func DownloadSavepoint(ctx context.Context, req *types.SavepointDownloadReq) (*huma.StreamResponse, error) {
|
||||||
folderPath := req.SavepointPath // Change this to your folder path
|
mgr := managed_job.GetManager()
|
||||||
|
job := mgr.GetJob(k8sTypes.UID(req.JobUID))
|
||||||
|
lastSavepointPath := job.GetLastSavepointPath()
|
||||||
|
|
||||||
|
if lastSavepointPath == nil {
|
||||||
|
return nil, huma.Error404NotFound("there is no savepoint path is registered for the job")
|
||||||
|
}
|
||||||
|
folderPath := strings.TrimLeft(*lastSavepointPath, "file:") // Change this to your folder path
|
||||||
|
|
||||||
// Create a temporary zip file
|
// Create a temporary zip file
|
||||||
zipFilePath, err := filepath.Abs("./savepoint.zip")
|
zipFilePath, err := filepath.Abs("./savepoint.zip")
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
package types
|
package types
|
||||||
|
|
||||||
type SavepointDownloadReq struct {
|
type SavepointDownloadReq struct {
|
||||||
SavepointPath string `query:"savepoint-path"`
|
JobUID string `query:"jobUID"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type SavepointDownloadResp struct {
|
type SavepointDownloadResp struct {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user