Skip to content
This repository has been archived by the owner on Oct 9, 2023. It is now read-only.

Commit

Permalink
Save CheckpointUri in NodeExecution.Closure (#479)
Browse files Browse the repository at this point in the history
* Save CheckpointUri in NodeExecution.Closure

Signed-off-by: Andrew Dye <[email protected]>

* Test failures

Signed-off-by: Andrew Dye <[email protected]>

Signed-off-by: Andrew Dye <[email protected]>
  • Loading branch information
andrewwdye authored Oct 6, 2022
1 parent c09eb7d commit d1ebaae
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 7 deletions.
8 changes: 8 additions & 0 deletions pkg/manager/impl/node_execution_manager_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,9 @@ func TestCreateNodeEvent_Update(t *testing.T) {
StartedAt: occurredAtProto,
Phase: core.NodeExecution_RUNNING,
UpdatedAt: occurredAtProto,
TargetMetadata: &admin.NodeExecutionClosure_TaskNodeMetadata{
TaskNodeMetadata: &admin.TaskNodeMetadata{},
},
}
expectedClosureBytes, _ := proto.Marshal(&expectedClosure)
actualClosure := admin.NodeExecutionClosure{}
Expand Down Expand Up @@ -541,6 +544,11 @@ func TestGetNodeExecution(t *testing.T) {
repository := repositoryMocks.NewMockRepository()
expectedClosure := admin.NodeExecutionClosure{
Phase: core.NodeExecution_SUCCEEDED,
TargetMetadata: &admin.NodeExecutionClosure_TaskNodeMetadata{
TaskNodeMetadata: &admin.TaskNodeMetadata{
CheckpointUri: "last checkpoint uri",
},
},
}
expectedMetadata := admin.NodeExecutionMetaData{
SpecNodeId: "spec_node_id",
Expand Down
13 changes: 8 additions & 5 deletions pkg/repositories/transformers/node_execution.go
Original file line number Diff line number Diff line change
Expand Up @@ -211,16 +211,19 @@ func UpdateNodeExecutionModel(
}

// Update TaskNodeMetadata, which includes caching information today.
if request.Event.GetTaskNodeMetadata() != nil && request.Event.GetTaskNodeMetadata().CatalogKey != nil {
st := request.Event.GetTaskNodeMetadata().GetCacheStatus().String()
if request.Event.GetTaskNodeMetadata() != nil {
targetMetadata := &admin.NodeExecutionClosure_TaskNodeMetadata{
TaskNodeMetadata: &admin.TaskNodeMetadata{
CacheStatus: request.Event.GetTaskNodeMetadata().GetCacheStatus(),
CatalogKey: request.Event.GetTaskNodeMetadata().GetCatalogKey(),
CheckpointUri: request.Event.GetTaskNodeMetadata().CheckpointUri,
},
}
if request.Event.GetTaskNodeMetadata().CatalogKey != nil {
st := request.Event.GetTaskNodeMetadata().GetCacheStatus().String()
targetMetadata.TaskNodeMetadata.CacheStatus = request.Event.GetTaskNodeMetadata().GetCacheStatus()
targetMetadata.TaskNodeMetadata.CatalogKey = request.Event.GetTaskNodeMetadata().GetCatalogKey()
nodeExecutionModel.CacheStatus = &st
}
nodeExecutionClosure.TargetMetadata = targetMetadata
nodeExecutionModel.CacheStatus = &st
}

marshaledClosure, err := proto.Marshal(&nodeExecutionClosure)
Expand Down
6 changes: 4 additions & 2 deletions pkg/repositories/transformers/node_execution_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -328,6 +328,7 @@ func TestUpdateNodeExecutionModel(t *testing.T) {
},
},
},
CheckpointUri: "last checkpoint uri",
},
},
},
Expand All @@ -351,8 +352,9 @@ func TestUpdateNodeExecutionModel(t *testing.T) {
UpdatedAt: occurredAtProto,
TargetMetadata: &admin.NodeExecutionClosure_TaskNodeMetadata{
TaskNodeMetadata: &admin.TaskNodeMetadata{
CacheStatus: request.Event.GetTaskNodeMetadata().CacheStatus,
CatalogKey: request.Event.GetTaskNodeMetadata().CatalogKey,
CacheStatus: request.Event.GetTaskNodeMetadata().CacheStatus,
CatalogKey: request.Event.GetTaskNodeMetadata().CatalogKey,
CheckpointUri: request.Event.GetTaskNodeMetadata().CheckpointUri,
},
},
}
Expand Down

0 comments on commit d1ebaae

Please sign in to comment.