Skip to content

Commit

Permalink
Add RetryAttempt and Phase to Task Event Metadata (flyteorg#381)
Browse files Browse the repository at this point in the history
* transforming TaskInfo ExternalResources to event ExternalResourceInfo to correctly map resource phase

Signed-off-by: Daniel Rammer <[email protected]>

* fixing lint issues

Signed-off-by: Daniel Rammer <[email protected]>

* populating ExternalResource proto Index field

Signed-off-by: Daniel Rammer <[email protected]>

* updated flyteidl and flyteplugins versions

Signed-off-by: Daniel Rammer <[email protected]>
  • Loading branch information
hamersaw authored Jan 26, 2022
1 parent a78ab45 commit 4319d65
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 13 deletions.
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ require (
github.com/DiSiqueira/GoTree v1.0.1-0.20180907134536-53a8e837f295
github.com/benlaurie/objecthash v0.0.0-20180202135721-d1e3d6079fc1
github.com/fatih/color v1.10.0
github.com/flyteorg/flyteidl v0.21.18
github.com/flyteorg/flyteplugins v0.9.4
github.com/flyteorg/flyteidl v0.21.24
github.com/flyteorg/flyteplugins v0.10.3
github.com/flyteorg/flytestdlib v0.4.7
github.com/ghodss/yaml v1.0.0
github.com/go-redis/redis v6.15.7+incompatible
Expand Down
10 changes: 5 additions & 5 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -236,11 +236,11 @@ github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5Kwzbycv
github.com/fatih/color v1.10.0 h1:s36xzo75JdqLaaWoiEHk767eHiwo0598uUxyfiPkDsg=
github.com/fatih/color v1.10.0/go.mod h1:ELkj/draVOlAH/xkhN6mQ50Qd0MPOk5AAr3maGEBuJM=
github.com/fatih/structtag v1.2.0/go.mod h1:mBJUNpUnHmRKrKlQQlmCrh5PuhftFbNv8Ys4/aAZl94=
github.com/flyteorg/flyteidl v0.21.11/go.mod h1:576W2ViEyjTpT+kEVHAGbrTP3HARNUZ/eCwrNPmdx9U=
github.com/flyteorg/flyteidl v0.21.18 h1:tOrb8U96mJPbiYFDGgoafn/XO2EAWK3U6JWzPIlrKO4=
github.com/flyteorg/flyteidl v0.21.18/go.mod h1:576W2ViEyjTpT+kEVHAGbrTP3HARNUZ/eCwrNPmdx9U=
github.com/flyteorg/flyteplugins v0.9.4 h1:HQrAEAaZwkPn7CGuD8d4KRaQAw9UZ2KdnWL36h06XxI=
github.com/flyteorg/flyteplugins v0.9.4/go.mod h1:OEGQztPFDJG4DV7tS9lDsRRd521iUINn5dcsBf6bW5k=
github.com/flyteorg/flyteidl v0.21.23/go.mod h1:576W2ViEyjTpT+kEVHAGbrTP3HARNUZ/eCwrNPmdx9U=
github.com/flyteorg/flyteidl v0.21.24 h1:e2wPBK4aiLE+fw2zmhUDNg39QoJk6Lf5lQRvj8XgtFk=
github.com/flyteorg/flyteidl v0.21.24/go.mod h1:576W2ViEyjTpT+kEVHAGbrTP3HARNUZ/eCwrNPmdx9U=
github.com/flyteorg/flyteplugins v0.10.3 h1:FFtWZNZ3SnhGHImzQzl5B6KMMkgj60LSzD90F6DYAgA=
github.com/flyteorg/flyteplugins v0.10.3/go.mod h1:RXgHGGUGC1akEnAd0yi4cLuYP1BF1rVkxhGjzIrm6VU=
github.com/flyteorg/flytestdlib v0.3.13/go.mod h1:Tz8JCECAbX6VWGwFT6cmEQ+RJpZ/6L9pswu3fzWs220=
github.com/flyteorg/flytestdlib v0.4.7 h1:SMPPXI3j/MjP7D2fqaR+lPQkTrqYS7xZbwsgJI2F8SU=
github.com/flyteorg/flytestdlib v0.4.7/go.mod h1:fv1ar34LJLMTaf0tbfetisLykUlARi7rP+NQTUn6QQs=
Expand Down
25 changes: 19 additions & 6 deletions pkg/controller/nodes/task/transformer.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,13 +99,26 @@ func ToTaskExecutionEvent(input ToTaskExecutionEventInputs) (*event.TaskExecutio
if err != nil {
return nil, err
}
metadata := input.Info.Info().Metadata
if metadata == nil {
metadata = &event.TaskExecutionMetadata{}

metadata := &event.TaskExecutionMetadata{
GeneratedName: input.TaskExecContext.TaskExecutionMetadata().GetTaskExecutionID().GetGeneratedName(),
PluginIdentifier: input.PluginID,
ResourcePoolInfo: input.ResourcePoolInfo,
}
metadata.PluginIdentifier = input.PluginID
metadata.GeneratedName = input.TaskExecContext.TaskExecutionMetadata().GetTaskExecutionID().GetGeneratedName()
metadata.ResourcePoolInfo = input.ResourcePoolInfo

externalResources := input.Info.Info().ExternalResources
if externalResources != nil {
metadata.ExternalResources = make([]*event.ExternalResourceInfo, len(externalResources))
for idx, e := range input.Info.Info().ExternalResources {
metadata.ExternalResources[idx] = &event.ExternalResourceInfo{
ExternalId: e.ExternalID,
Index: e.Index,
RetryAttempt: e.RetryAttempt,
Phase: ToTaskEventPhase(e.Phase),
}
}
}

tev := &event.TaskExecutionEvent{
TaskId: taskExecID.TaskId,
ParentNodeExecutionId: nodeExecutionID,
Expand Down

0 comments on commit 4319d65

Please sign in to comment.