@@ -19,19 +19,19 @@ import (
19
19
"encoding/json"
20
20
"flag"
21
21
"fmt"
22
- "os"
23
- "path/filepath"
24
- "strconv"
25
-
26
- "github.com/kubeflow/pipelines/backend/src/v2/cacheutils"
27
- "github.com/kubeflow/pipelines/backend/src/v2/driver"
28
- "github.com/kubeflow/pipelines/kubernetes_platform/go/kubernetesplatform"
22
+ "github.com/kubeflow/pipelines/backend/src/common/util"
29
23
30
24
"github.com/golang/glog"
31
25
"github.com/golang/protobuf/jsonpb"
32
26
"github.com/kubeflow/pipelines/api/v2alpha1/go/pipelinespec"
27
+ "github.com/kubeflow/pipelines/backend/src/v2/cacheutils"
33
28
"github.com/kubeflow/pipelines/backend/src/v2/config"
29
+ "github.com/kubeflow/pipelines/backend/src/v2/driver"
34
30
"github.com/kubeflow/pipelines/backend/src/v2/metadata"
31
+ "github.com/kubeflow/pipelines/kubernetes_platform/go/kubernetesplatform"
32
+ "os"
33
+ "path/filepath"
34
+ "strconv"
35
35
)
36
36
37
37
const (
@@ -116,37 +116,33 @@ func drive() (err error) {
116
116
}
117
117
glog .Infof ("input ComponentSpec:%s\n " , prettyPrint (* componentSpecJson ))
118
118
componentSpec := & pipelinespec.ComponentSpec {}
119
- if err := jsonpb .UnmarshalString (* componentSpecJson , componentSpec ); err != nil {
119
+ if err := util .UnmarshalString (* componentSpecJson , componentSpec ); err != nil {
120
120
return fmt .Errorf ("failed to unmarshal component spec, error: %w\n componentSpec: %v" , err , prettyPrint (* componentSpecJson ))
121
121
}
122
122
var taskSpec * pipelinespec.PipelineTaskSpec
123
123
if * taskSpecJson != "" {
124
124
glog .Infof ("input TaskSpec:%s\n " , prettyPrint (* taskSpecJson ))
125
125
taskSpec = & pipelinespec.PipelineTaskSpec {}
126
- if err := jsonpb .UnmarshalString (* taskSpecJson , taskSpec ); err != nil {
126
+ if err := util .UnmarshalString (* taskSpecJson , taskSpec ); err != nil {
127
127
return fmt .Errorf ("failed to unmarshal task spec, error: %w\n task: %v" , err , taskSpecJson )
128
128
}
129
129
}
130
130
glog .Infof ("input ContainerSpec:%s\n " , prettyPrint (* containerSpecJson ))
131
131
containerSpec := & pipelinespec.PipelineDeploymentConfig_PipelineContainerSpec {}
132
- if err := jsonpb .UnmarshalString (* containerSpecJson , containerSpec ); err != nil {
132
+ if err := util .UnmarshalString (* containerSpecJson , containerSpec ); err != nil {
133
133
return fmt .Errorf ("failed to unmarshal container spec, error: %w\n containerSpec: %v" , err , containerSpecJson )
134
134
}
135
135
var runtimeConfig * pipelinespec.PipelineJob_RuntimeConfig
136
136
if * runtimeConfigJson != "" {
137
137
glog .Infof ("input RuntimeConfig:%s\n " , prettyPrint (* runtimeConfigJson ))
138
138
runtimeConfig = & pipelinespec.PipelineJob_RuntimeConfig {}
139
- if err := jsonpb .UnmarshalString (* runtimeConfigJson , runtimeConfig ); err != nil {
139
+ if err := util .UnmarshalString (* runtimeConfigJson , runtimeConfig ); err != nil {
140
140
return fmt .Errorf ("failed to unmarshal runtime config, error: %w\n runtimeConfig: %v" , err , runtimeConfigJson )
141
141
}
142
142
}
143
- var k8sExecCfg * kubernetesplatform.KubernetesExecutorConfig
144
- if * k8sExecConfigJson != "" {
145
- glog .Infof ("input kubernetesConfig:%s\n " , prettyPrint (* k8sExecConfigJson ))
146
- k8sExecCfg = & kubernetesplatform.KubernetesExecutorConfig {}
147
- if err := jsonpb .UnmarshalString (* k8sExecConfigJson , k8sExecCfg ); err != nil {
148
- return fmt .Errorf ("failed to unmarshal Kubernetes config, error: %w\n KubernetesConfig: %v" , err , k8sExecConfigJson )
149
- }
143
+ k8sExecCfg , err := parseExecConfigJson (k8sExecConfigJson )
144
+ if err != nil {
145
+ return err
150
146
}
151
147
namespace , err := config .InPodNamespace ()
152
148
if err != nil {
@@ -204,11 +200,24 @@ func drive() (err error) {
204
200
IterationCount : * iterationCountPath ,
205
201
CachedDecision : * cachedDecisionPath ,
206
202
Condition : * conditionPath ,
207
- PodSpecPatch : * podSpecPatchPath }
203
+ PodSpecPatch : * podSpecPatchPath ,
204
+ }
208
205
209
206
return handleExecution (execution , * driverType , executionPaths )
210
207
}
211
208
209
+ func parseExecConfigJson (k8sExecConfigJson * string ) (* kubernetesplatform.KubernetesExecutorConfig , error ) {
210
+ var k8sExecCfg * kubernetesplatform.KubernetesExecutorConfig
211
+ if * k8sExecConfigJson != "" {
212
+ glog .Infof ("input kubernetesConfig:%s\n " , prettyPrint (* k8sExecConfigJson ))
213
+ k8sExecCfg = & kubernetesplatform.KubernetesExecutorConfig {}
214
+ if err := util .UnmarshalString (* k8sExecConfigJson , k8sExecCfg ); err != nil {
215
+ return nil , fmt .Errorf ("failed to unmarshal Kubernetes config, error: %w\n KubernetesConfig: %v" , err , k8sExecConfigJson )
216
+ }
217
+ }
218
+ return k8sExecCfg , nil
219
+ }
220
+
212
221
func handleExecution (execution * driver.Execution , driverType string , executionPaths * ExecutionPaths ) error {
213
222
if execution .ID != 0 {
214
223
glog .Infof ("output execution.ID=%v" , execution .ID )
0 commit comments