Skip to content

Commit

Permalink
Add additional nil check (flyteorg#156)
Browse files Browse the repository at this point in the history
Signed-off-by: Sean Lin <[email protected]>
  • Loading branch information
mayitbeegh authored and robert-ulbrich-mercedes-benz committed Jul 2, 2024
1 parent 9ab0ba2 commit b6f8aa7
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 15 deletions.
12 changes: 7 additions & 5 deletions flytectl/cmd/get/launch_plan.go
Original file line number Diff line number Diff line change
Expand Up @@ -128,11 +128,13 @@ func LaunchplanToTableProtoMessages(l []*admin.LaunchPlan) []proto.Message {
messages := make([]proto.Message, 0, len(l))
for _, m := range l {
m := proto.Clone(m).(*admin.LaunchPlan)
if m.Closure.ExpectedInputs != nil {
printer.FormatParameterDescriptions(m.Closure.ExpectedInputs.Parameters)
}
if m.Closure.ExpectedOutputs != nil {
printer.FormatVariableDescriptions(m.Closure.ExpectedOutputs.Variables)
if m.Closure != nil {
if m.Closure.ExpectedInputs != nil {
printer.FormatParameterDescriptions(m.Closure.ExpectedInputs.Parameters)
}
if m.Closure.ExpectedOutputs != nil {
printer.FormatVariableDescriptions(m.Closure.ExpectedOutputs.Variables)
}
}
messages = append(messages, m)
}
Expand Down
16 changes: 11 additions & 5 deletions flytectl/cmd/get/task.go
Original file line number Diff line number Diff line change
Expand Up @@ -116,11 +116,17 @@ func TaskToTableProtoMessages(l []*admin.Task) []proto.Message {
messages := make([]proto.Message, 0, len(l))
for _, m := range l {
m := proto.Clone(m).(*admin.Task)
if m.Closure.CompiledTask.Template.Interface.Inputs != nil {
printer.FormatVariableDescriptions(m.Closure.CompiledTask.Template.Interface.Inputs.Variables)
}
if m.Closure.CompiledTask.Template.Interface.Outputs != nil {
printer.FormatVariableDescriptions(m.Closure.CompiledTask.Template.Interface.Outputs.Variables)
if m.Closure != nil && m.Closure.CompiledTask != nil {
if m.Closure.CompiledTask.Template != nil {
if m.Closure.CompiledTask.Template.Interface != nil {
if m.Closure.CompiledTask.Template.Interface.Inputs != nil {
printer.FormatVariableDescriptions(m.Closure.CompiledTask.Template.Interface.Inputs.Variables)
}
if m.Closure.CompiledTask.Template.Interface.Outputs != nil {
printer.FormatVariableDescriptions(m.Closure.CompiledTask.Template.Interface.Outputs.Variables)
}
}
}
}
messages = append(messages, m)
}
Expand Down
18 changes: 13 additions & 5 deletions flytectl/cmd/get/workflow.go
Original file line number Diff line number Diff line change
Expand Up @@ -104,11 +104,19 @@ func WorkflowToTableProtoMessages(l []*admin.Workflow) []proto.Message {
messages := make([]proto.Message, 0, len(l))
for _, m := range l {
m := proto.Clone(m).(*admin.Workflow)
if m.Closure.CompiledWorkflow.Primary.Template.Interface.Inputs != nil {
printer.FormatVariableDescriptions(m.Closure.CompiledWorkflow.Primary.Template.Interface.Inputs.Variables)
}
if m.Closure.CompiledWorkflow.Primary.Template.Interface.Outputs != nil {
printer.FormatVariableDescriptions(m.Closure.CompiledWorkflow.Primary.Template.Interface.Outputs.Variables)
if m.Closure != nil && m.Closure.CompiledWorkflow != nil {
if m.Closure.CompiledWorkflow.Primary != nil {
if m.Closure.CompiledWorkflow.Primary.Template != nil {
if m.Closure.CompiledWorkflow.Primary.Template.Interface != nil {
if m.Closure.CompiledWorkflow.Primary.Template.Interface.Inputs != nil {
printer.FormatVariableDescriptions(m.Closure.CompiledWorkflow.Primary.Template.Interface.Inputs.Variables)
}
if m.Closure.CompiledWorkflow.Primary.Template.Interface.Outputs != nil {
printer.FormatVariableDescriptions(m.Closure.CompiledWorkflow.Primary.Template.Interface.Outputs.Variables)
}
}
}
}
}
messages = append(messages, m)
}
Expand Down

0 comments on commit b6f8aa7

Please sign in to comment.