From c5bcd9939b99ba24f4e4d8134c8600a2a0518ab4 Mon Sep 17 00:00:00 2001 From: Future Outlier Date: Thu, 9 Nov 2023 19:30:34 +0800 Subject: [PATCH] add task metadata runtime flavor error handling Signed-off-by: Future Outlier --- .../go/tasks/pluginmachinery/internal/webapi/core.go | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/flyteplugins/go/tasks/pluginmachinery/internal/webapi/core.go b/flyteplugins/go/tasks/pluginmachinery/internal/webapi/core.go index c7450fbe1b..d8f27367ff 100644 --- a/flyteplugins/go/tasks/pluginmachinery/internal/webapi/core.go +++ b/flyteplugins/go/tasks/pluginmachinery/internal/webapi/core.go @@ -111,8 +111,14 @@ func (c CorePlugin) Handle(ctx context.Context, tCtx core.TaskExecutionContext) } // Use the sync plugin to execute the task if the task template has the sync plugin flavor. - if taskTemplate.GetMetadata().GetRuntime().GetFlavor() == syncPlugin { - return c.syncHandle(ctx, tCtx) + metadata := taskTemplate.GetMetadata() + if metadata != nil { + runtime := metadata.GetRuntime() + if runtime != nil { + if runtime.GetFlavor() == syncPlugin { + return c.syncHandle(ctx, tCtx) + } + } } incomingState, err := c.unmarshalState(ctx, tCtx.PluginStateReader())