forked from flyteorg/flyte
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix Presto status bug that prevents task from moving forward (flyteor…
…g#73) * Add more logging for Presto plugin * logs * fix * int format * cleanup
- Loading branch information
Showing
4 changed files
with
14 additions
and
44 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
46 changes: 10 additions & 36 deletions
46
flyteplugins/go/tasks/plugins/presto/client/presto_status.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,43 +1,17 @@ | ||
package client | ||
|
||
import ( | ||
"context" | ||
"strings" | ||
|
||
"github.com/lyft/flytestdlib/logger" | ||
) | ||
|
||
// This type is meant only to encapsulate the response coming from Presto as a type, it is | ||
// not meant to be stored locally. | ||
const ( | ||
PrestoStatusUnknown PrestoStatus = "UNKNOWN" | ||
PrestoStatusWaiting PrestoStatus = "WAITING" | ||
PrestoStatusRunning PrestoStatus = "RUNNING" | ||
PrestoStatusFinished PrestoStatus = "FINISHED" | ||
PrestoStatusFailed PrestoStatus = "FAILED" | ||
PrestoStatusCancelled PrestoStatus = "CANCELLED" | ||
) | ||
|
||
var PrestoStatuses = map[PrestoStatus]struct{}{ | ||
PrestoStatusUnknown: {}, | ||
PrestoStatusWaiting: {}, | ||
PrestoStatusRunning: {}, | ||
PrestoStatusFinished: {}, | ||
PrestoStatusFailed: {}, | ||
PrestoStatusCancelled: {}, | ||
} | ||
//go:generate enumer --type=PrestoStatus | ||
|
||
func NewPrestoStatus(ctx context.Context, state string) PrestoStatus { | ||
upperCased := strings.ToUpper(state) | ||
type PrestoStatus int | ||
|
||
// Presto has different failure modes so this maps them all to a single Failure on the | ||
// Flyte side | ||
if strings.Contains(upperCased, "FAILED") { | ||
return PrestoStatusFailed | ||
} else if _, ok := PrestoStatuses[PrestoStatus(upperCased)]; ok { | ||
return PrestoStatus(upperCased) | ||
} else { | ||
logger.Warnf(ctx, "Invalid Presto Status found: %v", state) | ||
return PrestoStatusUnknown | ||
} | ||
} | ||
const ( | ||
PrestoStatusUnknown PrestoStatus = iota | ||
PrestoStatusWaiting | ||
PrestoStatusRunning | ||
PrestoStatusFinished | ||
PrestoStatusFailed | ||
PrestoStatusCancelled | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters