Skip to content

Commit

Permalink
lint
Browse files Browse the repository at this point in the history
Signed-off-by: Future-Outlier <eric901201@gmail.com>
  • Loading branch information
Future-Outlier committed Jan 2, 2025
1 parent 4068043 commit 65b6efe
Showing 1 changed file with 5 additions and 18 deletions.
23 changes: 5 additions & 18 deletions flytepropeller/pkg/controller/nodes/task/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@ import (
"context"
"fmt"
"runtime/debug"
"strconv"
"strings"
"time"

regErrors "github.com/pkg/errors"
Expand Down Expand Up @@ -435,32 +433,21 @@ func (t Handler) fetchPluginTaskMetrics(pluginID, taskType string) (*taskMetrics
func GetDeckStatus(ctx context.Context, tCtx *taskExecutionContext) (DeckStatus, error) {
// FLYTE_ENABLE_DECK is used when flytekit > 1.14.0
// For backward compatibility,
// we will return DeckUnknow and call a HEAD request to check if the deck file exists in the terminal state.
// we will return DeckUnknown and call a HEAD request to check if the deck file exists in the terminal state.

template, err := tCtx.tr.Read(ctx)
if err != nil {
return DeckUnknown, regErrors.Wrapf(err, "failed to read task template")
}

Check warning on line 441 in flytepropeller/pkg/controller/nodes/task/handler.go

View check run for this annotation

Codecov / codecov/patch

flytepropeller/pkg/controller/nodes/task/handler.go#L440-L441

Added lines #L440 - L441 were not covered by tests

templateConfig := template.GetConfig()
if templateConfig == nil {
metadata := template.GetMetadata()
if metadata == nil {
return DeckUnknown, nil
}

Check warning on line 446 in flytepropeller/pkg/controller/nodes/task/handler.go

View check run for this annotation

Codecov / codecov/patch

flytepropeller/pkg/controller/nodes/task/handler.go#L445-L446

Added lines #L445 - L446 were not covered by tests

rawValue, ok := templateConfig[FLYTE_ENABLE_DECK]
if !ok {
return DeckUnknown, nil
}

rawValue = strings.ToLower(rawValue)
deckEnabled, err := strconv.ParseBool(rawValue)
if err != nil {
return DeckUnknown, nil
}

if deckEnabled {
if metadata.GetGeneratesDeck() {
return DeckEnabled, nil
}

Check warning on line 449 in flytepropeller/pkg/controller/nodes/task/handler.go

View check run for this annotation

Codecov / codecov/patch

flytepropeller/pkg/controller/nodes/task/handler.go#L448-L449

Added lines #L448 - L449 were not covered by tests

return DeckDisabled, nil
}

Expand Down

0 comments on commit 65b6efe

Please sign in to comment.