Skip to content

Commit

Permalink
Introduce default plugin for task type (flyteorg#121)
Browse files Browse the repository at this point in the history
  • Loading branch information
katrogan authored Oct 21, 2020
1 parent e5362df commit 45be92a
Show file tree
Hide file tree
Showing 10 changed files with 18 additions and 0 deletions.
4 changes: 4 additions & 0 deletions flyteplugins/go/tasks/pluginmachinery/core/plugin.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@ type PluginEntry struct {
// Boolean that indicates if this plugin can be used as the default for unknown task types. There can only be
// one default in the system
IsDefault bool
// A list of all task types for which this plugin should be default handler when multiple registered plugins
// support the same task type. This must be a subset of RegisteredTaskTypes and at most one default per task type
// is supported.
DefaultForTaskTypes []TaskType
}

// System level properties that this Plugin supports
Expand Down
4 changes: 4 additions & 0 deletions flyteplugins/go/tasks/pluginmachinery/k8s/plugin.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@ type PluginEntry struct {
// Boolean that indicates if this plugin can be used as the default for unknown task types. There can only be
// one default in the system
IsDefault bool
// A list of all task types for which this plugin should be default handler when multiple registered plugins
// support the same task type. This must be a subset of RegisteredTaskTypes and at most one default per task type
// is supported.
DefaultForTaskTypes []pluginsCore.TaskType
}

// A proxy object for k8s resource
Expand Down
1 change: 1 addition & 0 deletions flyteplugins/go/tasks/plugins/array/awsbatch/executor.go
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,7 @@ func init() {
RegisteredTaskTypes: []core.TaskType{arrayTaskType},
LoadPlugin: createNewExecutorPlugin,
IsDefault: false,
DefaultForTaskTypes: []core.TaskType{arrayTaskType},
})
}

Expand Down
1 change: 1 addition & 0 deletions flyteplugins/go/tasks/plugins/hive/executor.go
Original file line number Diff line number Diff line change
Expand Up @@ -163,5 +163,6 @@ func init() {
RegisteredTaskTypes: []core.TaskType{hiveTaskType},
LoadPlugin: QuboleHiveExecutorLoader,
IsDefault: false,
DefaultForTaskTypes: []core.TaskType{hiveTaskType},
})
}
1 change: 1 addition & 0 deletions flyteplugins/go/tasks/plugins/k8s/container/container.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,5 +80,6 @@ func init() {
ResourceToWatch: &v1.Pod{},
Plugin: Plugin{},
IsDefault: true,
DefaultForTaskTypes: []pluginsCore.TaskType{containerTaskType},
})
}
Original file line number Diff line number Diff line change
Expand Up @@ -220,5 +220,6 @@ func init() {
ResourceToWatch: &ptOp.PyTorchJob{},
Plugin: pytorchOperatorResourceHandler{},
IsDefault: false,
DefaultForTaskTypes: []pluginsCore.TaskType{pytorchTaskType},
})
}
3 changes: 3 additions & 0 deletions flyteplugins/go/tasks/plugins/k8s/sagemaker/plugin.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ func init() {
ResourceToWatch: &hpojobv1.HyperparameterTuningJob{},
Plugin: awsSagemakerPlugin{TaskType: hyperparameterTuningJobTaskType},
IsDefault: false,
DefaultForTaskTypes: []pluginsCore.TaskType{hyperparameterTuningJobTaskType},
})

// Registering the plugin for standalone TrainingJob
Expand All @@ -85,6 +86,7 @@ func init() {
ResourceToWatch: &trainingjobv1.TrainingJob{},
Plugin: awsSagemakerPlugin{TaskType: trainingJobTaskType},
IsDefault: false,
DefaultForTaskTypes: []pluginsCore.TaskType{trainingJobTaskType},
})

// Registering the plugin for custom TrainingJob
Expand All @@ -95,5 +97,6 @@ func init() {
ResourceToWatch: &trainingjobv1.TrainingJob{},
Plugin: awsSagemakerPlugin{TaskType: customTrainingJobTaskType},
IsDefault: false,
DefaultForTaskTypes: []pluginsCore.TaskType{customTrainingJobTaskType},
})
}
1 change: 1 addition & 0 deletions flyteplugins/go/tasks/plugins/k8s/sidecar/sidecar.go
Original file line number Diff line number Diff line change
Expand Up @@ -175,5 +175,6 @@ func init() {
ResourceToWatch: &k8sv1.Pod{},
Plugin: sidecarResourceHandler{},
IsDefault: false,
DefaultForTaskTypes: []pluginsCore.TaskType{sidecarTaskType},
})
}
1 change: 1 addition & 0 deletions flyteplugins/go/tasks/plugins/k8s/spark/spark.go
Original file line number Diff line number Diff line change
Expand Up @@ -389,5 +389,6 @@ func init() {
ResourceToWatch: &sparkOp.SparkApplication{},
Plugin: sparkResourceHandler{},
IsDefault: false,
DefaultForTaskTypes: []pluginsCore.TaskType{sparkTaskType},
})
}
1 change: 1 addition & 0 deletions flyteplugins/go/tasks/plugins/presto/executor.go
Original file line number Diff line number Diff line change
Expand Up @@ -153,5 +153,6 @@ func init() {
RegisteredTaskTypes: []core.TaskType{prestoTaskType},
LoadPlugin: ExecutorLoader,
IsDefault: false,
DefaultForTaskTypes: []core.TaskType{prestoTaskType},
})
}

0 comments on commit 45be92a

Please sign in to comment.