Skip to content

Commit

Permalink
nit
Browse files Browse the repository at this point in the history
Signed-off-by: Kevin Su <[email protected]>
  • Loading branch information
pingsutw committed Sep 8, 2024
1 parent a4cca9d commit 4387f64
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 9 deletions.
4 changes: 0 additions & 4 deletions flyteplugins/go/tasks/pluginmachinery/k8s/plugin.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@ package k8s

import (
"context"
"github.com/flyteorg/flyte/flyteplugins/go/tasks/plugins/k8s/batchscheduler"

"sigs.k8s.io/controller-runtime/pkg/client"

pluginsCore "github.com/flyteorg/flyte/flyteplugins/go/tasks/pluginmachinery/core"
Expand All @@ -29,8 +27,6 @@ type PluginEntry struct {
IsDefault bool
// Returns a new KubeClient to be used instead of the internal controller-runtime client.
CustomKubeClient func(ctx context.Context) (pluginsCore.KubeClient, error)
// Return a new scheduler plugin to be used instead of the default k8s scheduler.
Scheduler func(ctx context.Context) batchscheduler.SchedulerManager
}

// System level properties that this Plugin supports
Expand Down
2 changes: 1 addition & 1 deletion flyteplugins/go/tasks/plugins/k8s/ray/ray.go
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,6 @@ func (rayJobResourceHandler) BuildResource(ctx context.Context, taskCtx pluginsC
}

func constructRayJob(taskCtx pluginsCore.TaskExecutionContext, rayJob plugins.RayJob, objectMeta *metav1.ObjectMeta, podSpec v1.PodSpec, headPodSpec *v1.PodSpec, headNodeRayStartParams map[string]string, primaryContainerIdx int, primaryContainer v1.Container) (*rayv1.RayJob, error) {
var err error
enableIngress := true
cfg := GetConfig()
rayClusterSpec := rayv1.RayClusterSpec{
Expand Down Expand Up @@ -210,6 +209,7 @@ func constructRayJob(taskCtx pluginsCore.TaskExecutionContext, rayJob plugins.Ra
// TODO: This is for backward compatibility. Remove this block once runtime_env is removed from ray proto.
var runtimeEnvYaml string
runtimeEnvYaml = rayJob.RuntimeEnvYaml
var err error
// If runtime_env exists but runtime_env_yaml does not, convert runtime_env to runtime_env_yaml
if rayJob.RuntimeEnv != "" && rayJob.RuntimeEnvYaml == "" {
runtimeEnvYaml, err = convertBase64RuntimeEnvToYaml(rayJob.RuntimeEnv)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ type PluginManager struct {
plugin k8s.Plugin
resourceToWatch runtime.Object
kubeClient pluginsCore.KubeClient
scheduler batchscheduler.SchedulerManager
schedulerMgr batchscheduler.SchedulerManager
metrics PluginMetrics
// Per namespace-resource
backOffController *backoff.Controller
Expand Down Expand Up @@ -205,7 +205,7 @@ func (e *PluginManager) launchResource(ctx context.Context, tCtx pluginsCore.Tas

key := backoff.ComposeResourceKey(o)

err = e.scheduler.Mutate(ctx, o)
err = e.schedulerMgr.Mutate(ctx, o)
if err != nil {
logger.Errorf(ctx, "Scheduler plugin failed to process object with error: %v", err)
return pluginsCore.Transition{}, err
Expand Down Expand Up @@ -544,7 +544,7 @@ func NewPluginManager(ctx context.Context, iCtx pluginsCore.SetupContext, entry
return nil, errors.Errorf(errors.PluginInitializationFailed, "Failed to initialize K8sResource Plugin, Kubeclient cannot be nil!")
}

scheduler := batchscheduler.NewSchedulerManager(&config.GetK8sPluginConfig().BatchScheduler)
schedulerMgr := batchscheduler.NewSchedulerManager(&config.GetK8sPluginConfig().BatchScheduler)

logger.Infof(ctx, "Initializing K8s plugin [%s]", entry.ID)
src := source.Kind(iCtx.KubeClient().GetCache(), entry.ResourceToWatch)
Expand Down Expand Up @@ -660,7 +660,7 @@ func NewPluginManager(ctx context.Context, iCtx pluginsCore.SetupContext, entry
resourceToWatch: entry.ResourceToWatch,
metrics: newPluginMetrics(metricsScope),
kubeClient: kubeClient,
scheduler: scheduler,
schedulerMgr: schedulerMgr,
resourceLevelMonitor: rm,
eventWatcher: eventWatcher,
}, nil
Expand Down

0 comments on commit 4387f64

Please sign in to comment.