Skip to content

Commit

Permalink
bugfix: Support data process operation type for JindoCache engine (#4254
Browse files Browse the repository at this point in the history
)

Signed-off-by: trafalgarzzz <[email protected]>
  • Loading branch information
TrafalgarZZZ authored Aug 6, 2024
1 parent 3239c08 commit ccee324
Show file tree
Hide file tree
Showing 2 changed files with 54 additions and 7 deletions.
18 changes: 11 additions & 7 deletions pkg/ddc/jindocache/operate.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,18 @@ func (e *JindoCacheEngine) GetDataOperationValueFile(ctx cruntime.ReconcileReque
operationType := operation.GetOperationType()
object := operation.GetOperationObject()

if operationType == dataoperation.DataLoadType {
switch operationType {
case dataoperation.DataLoadType:
valueFileName, err = e.generateDataLoadValueFile(ctx, object)
return valueFileName, err
case dataoperation.DataProcessType:
valueFileName, err = e.generateDataProcessValueFile(ctx, object)
return valueFileName, err
default:
return "", errors.NewNotSupported(
schema.GroupResource{
Group: object.GetObjectKind().GroupVersionKind().Group,
Resource: object.GetObjectKind().GroupVersionKind().Kind,
}, "JindoRuntime")
}

return "", errors.NewNotSupported(
schema.GroupResource{
Group: object.GetObjectKind().GroupVersionKind().Group,
Resource: object.GetObjectKind().GroupVersionKind().Kind,
}, "JindoRuntime")
}
43 changes: 43 additions & 0 deletions pkg/ddc/jindocache/process_data.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
/*
Copyright 2023 The Fluid Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

package jindocache

import (
"fmt"

datav1alpha1 "github.com/fluid-cloudnative/fluid/api/v1alpha1"
"github.com/fluid-cloudnative/fluid/pkg/dataprocess"
cruntime "github.com/fluid-cloudnative/fluid/pkg/runtime"
"github.com/fluid-cloudnative/fluid/pkg/utils"
"github.com/pkg/errors"
"sigs.k8s.io/controller-runtime/pkg/client"
)

func (e *JindoCacheEngine) generateDataProcessValueFile(ctx cruntime.ReconcileRequestContext, object client.Object) (valueFileName string, err error) {
dataProcess, ok := object.(*datav1alpha1.DataProcess)
if !ok {
err = fmt.Errorf("object %v is not of type DataProcess", object)
return "", err
}

targetDataset, err := utils.GetDataset(e.Client, dataProcess.Spec.Dataset.Name, dataProcess.Spec.Dataset.Namespace)
if err != nil {
return "", errors.Wrap(err, "failed to get dataset")
}

return dataprocess.GenDataProcessValueFile(e.Client, targetDataset, dataProcess)
}

0 comments on commit ccee324

Please sign in to comment.