Skip to content

Commit

Permalink
handle task validation error wip
Browse files Browse the repository at this point in the history
Signed-off-by: Iaroslav Ciupin <[email protected]>
  • Loading branch information
iaroslav-ciupin committed Nov 9, 2023
1 parent 630724f commit dee8d08
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 4 deletions.
14 changes: 10 additions & 4 deletions flyteadmin/pkg/manager/impl/execution_manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"context"
"fmt"
"strconv"
"strings"
"time"

"github.com/benbjohnson/clock"
Expand Down Expand Up @@ -862,10 +863,14 @@ func (m *ExecutionManager) launchExecutionAndPrepareModel(
})

if err != nil {
m.systemMetrics.PropellerFailures.Inc()
logger.Infof(ctx, "Failed to execute workflow %+v with execution id %+v and inputs %+v with err %v",
request, workflowExecutionID, executionInputs, err)
return nil, nil, err
if strings.Contains(err.Error(), "no node can run task") {
logger.Infof(ctx, "received task validation error, saving execution [%+v] as failed", workflowExecutionID)

Check warning on line 867 in flyteadmin/pkg/manager/impl/execution_manager.go

View check run for this annotation

Codecov / codecov/patch

flyteadmin/pkg/manager/impl/execution_manager.go#L867

Added line #L867 was not covered by tests
} else {
m.systemMetrics.PropellerFailures.Inc()
logger.Infof(ctx, "Failed to execute workflow %+v with execution id %+v and inputs %+v with err %v",
request, workflowExecutionID, executionInputs, err)
return nil, nil, err
}
}
executionCreatedAt := time.Now()
acceptanceDelay := executionCreatedAt.Sub(requestedAt)
Expand Down Expand Up @@ -902,6 +907,7 @@ func (m *ExecutionManager) launchExecutionAndPrepareModel(
SecurityContext: executionConfig.SecurityContext,
LaunchEntity: launchPlan.Id.ResourceType,
Namespace: namespace,
Error: err,
})
if err != nil {
logger.Infof(ctx, "Failed to create execution model in transformer for id: [%+v] with err: %v",
Expand Down
11 changes: 11 additions & 0 deletions flyteadmin/pkg/repositories/transformers/execution.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ type CreateExecutionModelInput struct {
SecurityContext *core.SecurityContext
LaunchEntity core.ResourceType
Namespace string
Error error
}

type ExecutionTransformerOptions struct {
Expand Down Expand Up @@ -91,6 +92,16 @@ func CreateExecutionModel(input CreateExecutionModelInput) (*models.Execution, e
if input.Phase == core.WorkflowExecution_RUNNING {
closure.StartedAt = createdAt
}
if input.Error != nil {
closure.Phase = core.WorkflowExecution_FAILED
closure.OutputResult = &admin.ExecutionClosure_Error{
Error: &core.ExecutionError{
Code: "TaskValidationFailed",
Message: input.Error.Error(),
Kind: core.ExecutionError_USER,
},
}
}

Check warning on line 104 in flyteadmin/pkg/repositories/transformers/execution.go

View check run for this annotation

Codecov / codecov/patch

flyteadmin/pkg/repositories/transformers/execution.go#L96-L104

Added lines #L96 - L104 were not covered by tests

closureBytes, err := proto.Marshal(&closure)

Expand Down

0 comments on commit dee8d08

Please sign in to comment.