Skip to content

Commit 464ca39

Browse files
droctothorpecmdevotoCarterFendley
authored
feat(backend): implement logs as artifacts + CI updates (#11809)
* feat(backend): implement logs as artifacts Signed-off-by: droctothorpe <[email protected]> Co-authored-by: cmdevoto <[email protected]> * Address feedback and update golangci-lint Signed-off-by: droctothorpe <[email protected]> * Implement flag Signed-off-by: droctothorpe <[email protected]> Co-authored-by: carter.fendley <[email protected]> * Handle logs in kubernetesPlatformOps Signed-off-by: droctothorpe <[email protected]> * Broaden sdk execution test filter Signed-off-by: droctothorpe <[email protected]> * Delete MinIO PVC at end of SDK execution tests Signed-off-by: droctothorpe <[email protected]> * Emit more logs from sdk execution tests Signed-off-by: droctothorpe <[email protected]> --------- Signed-off-by: droctothorpe <[email protected]> Co-authored-by: cmdevoto <[email protected]> Co-authored-by: carter.fendley <[email protected]>
1 parent 38a4653 commit 464ca39

File tree

14 files changed

+490
-83
lines changed

14 files changed

+490
-83
lines changed

.github/workflows/kfp-kubernetes-execution-tests.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@ on:
1111
- 'sdk/python/**'
1212
- 'api/v2alpha1/**'
1313
- 'kubernetes_platform/**'
14+
- 'backend/**'
15+
- '!**/*.md'
16+
- '!**/OWNERS'
1417

1518
jobs:
1619
kfp-kubernetes-execution-tests:

.github/workflows/sdk-execution.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,9 @@ on:
1010
- '.github/resources/**'
1111
- 'sdk/python/**'
1212
- 'api/v2alpha1/**'
13-
- 'backend/src/v2/compiler/**'
13+
- 'backend/**'
14+
- '!**/*.md'
15+
- '!**/OWNERS'
1416

1517
jobs:
1618
sdk-execution-tests:
@@ -72,7 +74,7 @@ jobs:
7274
run: |
7375
export KFP_ENDPOINT="http://localhost:8888"
7476
export TIMEOUT_SECONDS=2700
75-
pytest -v -n 5 ./test/sdk-execution-tests/sdk_execution_tests.py
77+
pytest -v -n 5 -rP ./test/sdk-execution-tests/sdk_execution_tests.py
7678
continue-on-error: true
7779

7880
- name: Collect failed logs

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ repos:
5555

5656
# Golang pre-submit hooks
5757
- repo: https://github.com/golangci/golangci-lint
58-
rev: v1.52.2
58+
rev: v1.64.8
5959
hooks:
6060
- id: golangci-lint
6161
name: golangci-lint

backend/src/v2/cmd/driver/main.go

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,14 @@ import (
1919
"encoding/json"
2020
"flag"
2121
"fmt"
22+
2223
"github.com/kubeflow/pipelines/backend/src/apiserver/config/proxy"
2324
"github.com/kubeflow/pipelines/backend/src/common/util"
2425

26+
"os"
27+
"path/filepath"
28+
"strconv"
29+
2530
"github.com/golang/glog"
2631
"github.com/golang/protobuf/jsonpb"
2732
"github.com/kubeflow/pipelines/api/v2alpha1/go/pipelinespec"
@@ -30,9 +35,6 @@ import (
3035
"github.com/kubeflow/pipelines/backend/src/v2/driver"
3136
"github.com/kubeflow/pipelines/backend/src/v2/metadata"
3237
"github.com/kubeflow/pipelines/kubernetes_platform/go/kubernetesplatform"
33-
"os"
34-
"path/filepath"
35-
"strconv"
3638
)
3739

3840
const (
@@ -77,9 +79,10 @@ var (
7779
logLevel = flag.String("log_level", "1", "The verbosity level to log.")
7880

7981
// proxy
80-
httpProxy = flag.String(httpProxyArg, unsetProxyArgValue, "The proxy for HTTP connections.")
81-
httpsProxy = flag.String(httpsProxyArg, unsetProxyArgValue, "The proxy for HTTPS connections.")
82-
noProxy = flag.String(noProxyArg, unsetProxyArgValue, "Addresses that should ignore the proxy.")
82+
httpProxy = flag.String(httpProxyArg, unsetProxyArgValue, "The proxy for HTTP connections.")
83+
httpsProxy = flag.String(httpsProxyArg, unsetProxyArgValue, "The proxy for HTTPS connections.")
84+
noProxy = flag.String(noProxyArg, unsetProxyArgValue, "Addresses that should ignore the proxy.")
85+
publishLogs = flag.String("publish_logs", "true", "Whether to publish component logs to the object store")
8386
)
8487

8588
// func RootDAG(pipelineName string, runID string, component *pipelinespec.ComponentSpec, task *pipelinespec.PipelineTaskSpec, mlmd *metadata.Client) (*Execution, error) {
@@ -189,6 +192,7 @@ func drive() (err error) {
189192
DAGExecutionID: *dagExecutionID,
190193
IterationIndex: *iterationIndex,
191194
PipelineLogLevel: *logLevel,
195+
PublishLogs: *publishLogs,
192196
}
193197
var execution *driver.Execution
194198
var driverErr error

backend/src/v2/cmd/launcher-v2/main.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ var (
4242
mlmdServerAddress = flag.String("mlmd_server_address", "", "The MLMD gRPC server address.")
4343
mlmdServerPort = flag.String("mlmd_server_port", "8080", "The MLMD gRPC server port.")
4444
logLevel = flag.String("log_level", "1", "The verbosity level to log.")
45+
publishLogs = flag.String("publish_logs", "true", "Whether to publish component logs to the object store")
4546
)
4647

4748
func main() {
@@ -79,6 +80,7 @@ func run() error {
7980
MLMDServerPort: *mlmdServerPort,
8081
PipelineName: *pipelineName,
8182
RunID: *runID,
83+
PublishLogs: *publishLogs,
8284
}
8385

8486
switch *executorType {

backend/src/v2/compiler/argocompiler/container.go

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,13 @@ package argocompiler
1616

1717
import (
1818
"fmt"
19-
"github.com/kubeflow/pipelines/backend/src/apiserver/config/proxy"
20-
"k8s.io/apimachinery/pkg/util/intstr"
2119
"os"
2220
"strconv"
2321
"strings"
2422

23+
"github.com/kubeflow/pipelines/backend/src/apiserver/config/proxy"
24+
"k8s.io/apimachinery/pkg/util/intstr"
25+
2526
wfapi "github.com/argoproj/argo-workflows/v3/pkg/apis/workflow/v1alpha1"
2627
"github.com/golang/glog"
2728
"github.com/golang/protobuf/jsonpb"
@@ -46,6 +47,7 @@ const (
4647
DriverCommandEnvVar = "V2_DRIVER_COMMAND"
4748
PipelineRunAsUserEnvVar = "PIPELINE_RUN_AS_USER"
4849
PipelineLogLevelEnvVar = "PIPELINE_LOG_LEVEL"
50+
PublishLogsEnvVar = "PUBLISH_LOGS"
4951
gcsScratchLocation = "/gcs"
5052
gcsScratchName = "gcs-scratch"
5153
s3ScratchLocation = "/s3"
@@ -192,6 +194,9 @@ func (c *workflowCompiler) addContainerDriverTemplate() string {
192194
if value, ok := os.LookupEnv(PipelineLogLevelEnvVar); ok {
193195
args = append(args, "--log_level", value)
194196
}
197+
if value, ok := os.LookupEnv(PublishLogsEnvVar); ok {
198+
args = append(args, "--publish_logs", value)
199+
}
195200

196201
t := &wfapi.Template{
197202
Name: name,
@@ -316,6 +321,9 @@ func (c *workflowCompiler) addContainerExecutorTemplate(name string, refName str
316321
if value, ok := os.LookupEnv(PipelineLogLevelEnvVar); ok {
317322
args = append(args, "--log_level", value)
318323
}
324+
if value, ok := os.LookupEnv(PublishLogsEnvVar); ok {
325+
args = append(args, "--publish_logs", value)
326+
}
319327
executor := &wfapi.Template{
320328
Name: nameContainerImpl,
321329
RetryStrategy: c.getTaskRetryStrategy(name),

backend/src/v2/compiler/argocompiler/dag.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -559,6 +559,9 @@ func (c *workflowCompiler) addDAGDriverTemplate() string {
559559
if value, ok := os.LookupEnv(PipelineLogLevelEnvVar); ok {
560560
args = append(args, "--log_level", value)
561561
}
562+
if value, ok := os.LookupEnv(PublishLogsEnvVar); ok {
563+
args = append(args, "--publish_logs", value)
564+
}
562565

563566
t := &wfapi.Template{
564567
Name: name,

backend/src/v2/compiler/argocompiler/importer.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,9 @@ func (c *workflowCompiler) addImporterTemplate() string {
8585
if value, ok := os.LookupEnv(PipelineLogLevelEnvVar); ok {
8686
args = append(args, "--log_level", value)
8787
}
88+
if value, ok := os.LookupEnv(PublishLogsEnvVar); ok {
89+
args = append(args, "--publish_logs", value)
90+
}
8891
importerTemplate := &wfapi.Template{
8992
Name: name,
9093
Inputs: wfapi.Inputs{

0 commit comments

Comments
 (0)