Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Return InvalidArgument for workflow compilation failures in CreateWorkflow #4566

Merged
merged 3 commits into from
Dec 11, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion flyteadmin/cmd/entrypoints/serve.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ var serveCmd = &cobra.Command{

// register otel tracer providers
for _, serviceName := range []string{otelutils.AdminGormTracer, otelutils.AdminServerTracer} {
if err := otelutils.RegisterTracerProvider(serviceName, otelutils.GetConfig()) ; err != nil {
if err := otelutils.RegisterTracerProvider(serviceName, otelutils.GetConfig()); err != nil {
logger.Errorf(ctx, "Failed to create otel tracer provider. %v", err)
return err
}
Expand Down
2 changes: 1 addition & 1 deletion flyteadmin/pkg/manager/impl/workflow_manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ func (w *WorkflowManager) CreateWorkflow(
workflowClosure, err := w.getCompiledWorkflow(ctx, finalizedRequest)
if err != nil {
logger.Errorf(ctx, "Failed to compile workflow with err: %v", err)
return nil, errors.NewFlyteAdminErrorf(codes.Internal,
return nil, errors.NewFlyteAdminErrorf(codes.InvalidArgument,
"failed to compile workflow for [%+v] with err %v", request.Id, err)
}
err = validation.ValidateCompiledWorkflow(
Expand Down
6 changes: 5 additions & 1 deletion flyteadmin/pkg/manager/impl/workflow_manager_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (
"github.com/golang/protobuf/proto"
"github.com/stretchr/testify/assert"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/status"

"github.com/flyteorg/flyte/flyteadmin/pkg/common"
commonMocks "github.com/flyteorg/flyte/flyteadmin/pkg/common/mocks"
Expand Down Expand Up @@ -243,10 +244,13 @@ func TestCreateWorkflow_CompileWorkflowError(t *testing.T) {
getMockWorkflowConfigProvider(), mockCompiler, getMockStorage(), storagePrefix, mockScope.NewTestScope())
request := testutils.GetWorkflowRequest()
response, err := workflowManager.CreateWorkflow(context.Background(), request)
assert.Nil(t, response)
s, ok := status.FromError(err)
assert.True(t, ok)
assert.Equal(t, codes.InvalidArgument, s.Code())
assert.EqualError(t, err, fmt.Sprintf(
"failed to compile workflow for [resource_type:WORKFLOW project:\"project\" domain:\"domain\" "+
"name:\"name\" version:\"version\" ] with err %v", expectedErr.Error()))
assert.Nil(t, response)
}

func TestCreateWorkflow_DatabaseError(t *testing.T) {
Expand Down
Loading