@@ -36,8 +36,8 @@ type GetNotebookUrlFunc func(string) (string, error)
type GetNodeInfoFunc func(entity.ClusterNodeInfoOpts) ([]entity.AITaskNodeInfo, error)
type GetOutputFunc func(entity.ClusterOutputOpts) (*entity.ClusterAITaskOutput, error)
type GetAllOutputFunc func(entity.ClusterOutputOpts) (*entity.AllAITaskOutput, error)
type GetSingleOutputDownloadInfoFunc func(req entity.ClusterOutputDownloadInfoOpts) (*entity.FileDownloadInfo, error)
type GetAllOutputDownloadInfoFunc func(req entity.ClusterOutputDownloadInfoOpts) (*entity.FileDownloadInfo, error)
type GetSingleOutputDownloadInfoFunc func(req entity.ClusterSingle OutputDownloadInfoOpts) (*entity.FileDownloadInfo, error)
type DownloadAllOutputFunc func(req entity.DownloadOutputOpts) error
type GetOperationProfileFunc func(string) (*entity.OperationProfile, error)
type GetResourceUsageFunc func(entity.ClusterResourceUsageOpts) (*entity.ResourceUsage, error)
@@ -430,7 +430,7 @@ func GetLogDownloadInfo(opts entity.GetLogDownloadInfoReq, getLogDownloadInfo Ge
})
}
func GetSingleOutputDownloadInfo(opts entity.GetOutput DownloadInfoReq, f GetSingleOutputDownloadInfoFunc) (*entity.FileDownloadInfo, error) {
func GetSingleOutputDownloadInfo(opts entity.GetSingle DownloadInfoReq, f GetSingleOutputDownloadInfoFunc) (*entity.FileDownloadInfo, error) {
cloudbrain, err := models.GetCloudbrainByCloudbrainID(opts.CloudbrainId)
if err != nil {
return nil, err
@@ -440,27 +440,28 @@ func GetSingleOutputDownloadInfo(opts entity.GetOutputDownloadInfoReq, f GetSing
}
aiConfig := GetDetailConfigInfoByCloudbrain(cloudbrain)
fileRelativePath := path.Join(aiConfig.OutputObjectPrefix, opts.ParentDir, opts.FileName)
return f(entity.ClusterOutputDownloadInfoOpts{
return f(entity.ClusterSingle OutputDownloadInfoOpts{
JobId: cloudbrain.JobID,
Path: fileRelativePath,
StorageType: aiConfig.OutputStorageType,
})
}
func GetAllOutputDownloadInfo(opts entity.GetOutputDownloadInfoReq, f GetAllOutputDownloadInfoFunc) (*entity.FileDownloadInfo, error) {
func DownloadAllOutput(opts entity.DownloadAllFileReq, downloadFunc DownloadAllOutputFunc) error {
cloudbrain, err := models.GetCloudbrainByCloudbrainID(opts.CloudbrainId)
if err != nil {
return nil, err
return err
}
if cloudbrain.JobID == "" {
return nil, nil
return nil
}
aiConfig := GetDetailConfigInfoByCloudbrain(cloudbrain)
return f(entity.ClusterOutputDownloadInfo Opts{
return downloadFunc(entity.DownloadOutput Opts{
JobId: cloudbrain.JobID,
Path: aiConfig.OutputObjectPrefix,
StorageType: aiConfig.OutputStorageType,
JobName: cloudbrain.JobName,
ZIPWriter: opts.ZIPWriter,
})
}