Skip to content

Commit

Permalink
feat(proto): Define CommonReplicaSpec in common.proto
Browse files Browse the repository at this point in the history
Resolves: flyteorg#4408
Signed-off-by: Chi-Sheng Liu <[email protected]>
  • Loading branch information
MortalHappiness committed May 21, 2024
1 parent 16d2b14 commit 928270b
Show file tree
Hide file tree
Showing 5 changed files with 62 additions and 28 deletions.
27 changes: 27 additions & 0 deletions flyteidl/protos/flyteidl/plugins/common.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
syntax = "proto3";

package flyteidl.plugins;

option go_package = "github.com/flyteorg/flyte/flyteidl/gen/pb-go/flyteidl/plugins";

import "flyteidl/core/tasks.proto";

enum RestartPolicy {
RESTART_POLICY_NEVER = 0;
RESTART_POLICY_ON_FAILURE = 1;
RESTART_POLICY_ALWAYS = 2;
}

message CommonReplicaSpec {
// Number of replicas
int32 replicas = 1;

// Image used for the replica group
string image = 2;

// Resources required for the replica group
core.Resources resources = 3;

// RestartPolicy determines whether pods will be restarted when they exit
RestartPolicy restart_policy = 4;
}
11 changes: 3 additions & 8 deletions flyteidl/protos/flyteidl/plugins/kubeflow/common.proto
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,9 @@ syntax = "proto3";

package flyteidl.plugins.kubeflow;

option go_package = "github.com/flyteorg/flyte/flyteidl/gen/pb-go/flyteidl/plugins";
option go_package = "github.com/flyteorg/flyte/flyteidl/gen/pb-go/flyteidl/plugins/kubeflow";


enum RestartPolicy {
RESTART_POLICY_NEVER = 0;
RESTART_POLICY_ON_FAILURE = 1;
RESTART_POLICY_ALWAYS = 2;
}
import public "flyteidl/plugins/common.proto";

enum CleanPodPolicy {
CLEANPOD_POLICY_NONE = 0;
Expand All @@ -30,4 +25,4 @@ message RunPolicy {

// Number of retries before marking this job failed.
int32 backoff_limit = 4;
}
}
18 changes: 11 additions & 7 deletions flyteidl/protos/flyteidl/plugins/kubeflow/mpi.proto
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ syntax = "proto3";

package flyteidl.plugins.kubeflow;

option go_package = "github.com/flyteorg/flyte/flyteidl/gen/pb-go/flyteidl/plugins";
option go_package = "github.com/flyteorg/flyte/flyteidl/gen/pb-go/flyteidl/plugins/kubeflow";

import "flyteidl/core/tasks.proto";
import "flyteidl/plugins/kubeflow/common.proto";
Expand All @@ -26,18 +26,22 @@ message DistributedMPITrainingTask {

// Replica specification for distributed MPI training
message DistributedMPITrainingReplicaSpec {
// 1~4 deprecated. Use common instead.
// Number of replicas
int32 replicas = 1;
int32 replicas = 1 [deprecated = true];

// Image used for the replica group
string image = 2;
string image = 2 [deprecated = true];

// Resources required for the replica group
core.Resources resources = 3;
core.Resources resources = 3 [deprecated = true];

// Restart policy determines whether pods will be restarted when they exit
RestartPolicy restart_policy = 4;
RestartPolicy restart_policy = 4 [deprecated = true];

// MPI sometimes requires different command set for different replica groups
repeated string command = 5;
}

// The common replica spec
CommonReplicaSpec common = 6;
}
18 changes: 11 additions & 7 deletions flyteidl/protos/flyteidl/plugins/kubeflow/pytorch.proto
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ syntax = "proto3";

package flyteidl.plugins.kubeflow;

option go_package = "github.com/flyteorg/flyte/flyteidl/gen/pb-go/flyteidl/plugins";
option go_package = "github.com/flyteorg/flyte/flyteidl/gen/pb-go/flyteidl/plugins/kubeflow";

import "flyteidl/core/tasks.proto";
import "flyteidl/plugins/kubeflow/common.proto";
Expand Down Expand Up @@ -35,15 +35,19 @@ message DistributedPyTorchTrainingTask {
}

message DistributedPyTorchTrainingReplicaSpec {
// 1~4 deprecated. Use common instead.
// Number of replicas
int32 replicas = 1;
int32 replicas = 1 [deprecated = true];

// Image used for the replica group
string image = 2;
string image = 2 [deprecated = true];

// Resources required for the replica group
core.Resources resources = 3;

// RestartPolicy determines whether pods will be restarted when they exit
RestartPolicy restart_policy = 4;
core.Resources resources = 3 [deprecated = true];

// Restart policy determines whether pods will be restarted when they exit
RestartPolicy restart_policy = 4 [deprecated = true];

// The common replica spec
CommonReplicaSpec common = 5;
}
16 changes: 10 additions & 6 deletions flyteidl/protos/flyteidl/plugins/kubeflow/tensorflow.proto
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ syntax = "proto3";

package flyteidl.plugins.kubeflow;

option go_package = "github.com/flyteorg/flyte/flyteidl/gen/pb-go/flyteidl/plugins";
option go_package = "github.com/flyteorg/flyte/flyteidl/gen/pb-go/flyteidl/plugins/kubeflow";

import "flyteidl/core/tasks.proto";
import "flyteidl/plugins/kubeflow/common.proto";
Expand All @@ -28,15 +28,19 @@ message DistributedTensorflowTrainingTask {
}

message DistributedTensorflowTrainingReplicaSpec {
// 1~4 deprecated. Use common instead.
// Number of replicas
int32 replicas = 1;
int32 replicas = 1 [deprecated = true];

// Image used for the replica group
string image = 2;
string image = 2 [deprecated = true];

// Resources required for the replica group
core.Resources resources = 3;
core.Resources resources = 3 [deprecated = true];

// RestartPolicy Determines whether pods will be restarted when they exit
RestartPolicy restart_policy = 4;
// Restart policy determines whether pods will be restarted when they exit
RestartPolicy restart_policy = 4 [deprecated = true];

// The common replica spec
CommonReplicaSpec common = 5;
}

0 comments on commit 928270b

Please sign in to comment.