Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP][Flyteadmin] Add variablemap in dataproxy for dataclass/pydantic #6136

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions flyteadmin/dataproxy/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -367,10 +367,12 @@ func (s Service) GetDataFromNodeExecution(ctx context.Context, nodeExecID *core.
}

var lm *core.LiteralMap
var vm *core.VariableMap
if ioType == common.ArtifactTypeI {
lm = resp.GetFullInputs()
} else if ioType == common.ArtifactTypeO {
lm = resp.GetFullOutputs()
vm = resp.GetOutputVariableMap()
} else {
// Assume deck, and create a download link request
dlRequest := service.CreateDownloadLinkRequest{
Expand Down Expand Up @@ -402,13 +404,15 @@ func (s Service) GetDataFromNodeExecution(ctx context.Context, nodeExecID *core.
Data: &service.GetDataResponse_LiteralMap{
LiteralMap: lm,
},
VariableMap: vm,
}, nil
}

func (s Service) GetDataFromTaskExecution(ctx context.Context, taskExecID *core.TaskExecutionIdentifier, ioType common.ArtifactType, name string) (
*service.GetDataResponse, error) {

var lm *core.LiteralMap
var vm *core.VariableMap
reqT := &admin.TaskExecutionGetDataRequest{
Id: taskExecID,
}
Expand All @@ -421,6 +425,7 @@ func (s Service) GetDataFromTaskExecution(ctx context.Context, taskExecID *core.
lm = resp.GetFullInputs()
} else if ioType == common.ArtifactTypeO {
lm = resp.GetFullOutputs()
vm = resp.GetOutputVariableMap()
} else {
return nil, errors.NewFlyteAdminErrorf(codes.InvalidArgument, "deck type cannot be specified with a retry attempt, just use the node instead")
}
Expand All @@ -440,6 +445,7 @@ func (s Service) GetDataFromTaskExecution(ctx context.Context, taskExecID *core.
Data: &service.GetDataResponse_LiteralMap{
LiteralMap: lm,
},
VariableMap: vm,
}, nil

}
Expand Down
25 changes: 20 additions & 5 deletions flyteadmin/pkg/manager/impl/node_execution_manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -538,24 +538,39 @@ func (m *NodeExecutionManager) GetNodeExecutionData(

var outputs *core.LiteralMap
var outputURLBlob *admin.UrlBlob
var outputVariableMap *core.VariableMap
group.Go(func() error {
var err error
outputs, outputURLBlob, err = util.GetOutputs(groupCtx, m.urlData, m.config.ApplicationConfiguration().GetRemoteDataConfig(),
m.storageClient, nodeExecution.GetClosure())
return err
})

// TODO: Get the output variable map from the node execution model
// group.Go(func() error {
// var err error

// modelNode, err := m.db.NodeExecutionRepo().Get(groupCtx, repoInterfaces.NodeExecutionResource{
// NodeExecutionIdentifier: request.GetId(),
// })

// node, err := transformers.FromNodeExecutionModel(modelNode, transformers.DefaultExecutionTransformerOptions)

// return err
// })

err = group.Wait()
if err != nil {
return nil, err
}

response := &admin.NodeExecutionGetDataResponse{
Inputs: inputURLBlob,
Outputs: outputURLBlob,
FullInputs: inputs,
FullOutputs: outputs,
FlyteUrls: common.FlyteURLsFromNodeExecutionID(request.GetId(), nodeExecution.GetClosure() != nil && nodeExecution.GetClosure().GetDeckUri() != ""),
Inputs: inputURLBlob,
Outputs: outputURLBlob,
FullInputs: inputs,
FullOutputs: outputs,
FlyteUrls: common.FlyteURLsFromNodeExecutionID(request.GetId(), nodeExecution.GetClosure() != nil && nodeExecution.GetClosure().GetDeckUri() != ""),
OutputVariableMap: outputVariableMap,
}

if len(nodeExecutionModel.DynamicWorkflowRemoteClosureReference) > 0 {
Expand Down
27 changes: 22 additions & 5 deletions flyteadmin/pkg/manager/impl/task_execution_manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -328,24 +328,41 @@ func (m *TaskExecutionManager) GetTaskExecutionData(

var outputs *core.LiteralMap
var outputURLBlob *admin.UrlBlob
var outputVariableMap *core.VariableMap
group.Go(func() error {
var err error
outputs, outputURLBlob, err = util.GetOutputs(groupCtx, m.urlData, m.config.ApplicationConfiguration().GetRemoteDataConfig(),
m.storageClient, taskExecution.GetClosure())
return err
})

group.Go(func() error {
var err error
taskModel, err := m.db.TaskRepo().Get(groupCtx, repoInterfaces.Identifier{
Project: taskExecution.GetId().GetTaskId().GetProject(),
Domain: taskExecution.GetId().GetTaskId().GetDomain(),
Name: taskExecution.GetId().GetTaskId().GetName(),
Version: taskExecution.GetId().GetTaskId().GetVersion(),
})

task, err := transformers.FromTaskModel(taskModel)
outputVariableMap = task.GetClosure().GetCompiledTask().GetTemplate().GetInterface().Outputs

return err
})

err = group.Wait()
if err != nil {
return nil, err
}

response := &admin.TaskExecutionGetDataResponse{
Inputs: inputURLBlob,
Outputs: outputURLBlob,
FullInputs: inputs,
FullOutputs: outputs,
FlyteUrls: common.FlyteURLsFromTaskExecutionID(request.GetId(), false),
Inputs: inputURLBlob,
Outputs: outputURLBlob,
FullInputs: inputs,
FullOutputs: outputs,
FlyteUrls: common.FlyteURLsFromTaskExecutionID(request.GetId(), false),
OutputVariableMap: outputVariableMap,
}

m.metrics.TaskExecutionInputBytes.Observe(float64(response.GetInputs().GetBytes()))
Expand Down
6 changes: 6 additions & 0 deletions flyteidl/clients/go/assets/admin.swagger.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 7 additions & 0 deletions flyteidl/gen/pb-es/flyteidl/admin/node_execution_pb.ts

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 7 additions & 0 deletions flyteidl/gen/pb-es/flyteidl/admin/task_execution_pb.ts

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 9 additions & 0 deletions flyteidl/gen/pb-es/flyteidl/service/dataproxy_pb.ts

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading