diff --git a/go/tasks/pluginmachinery/io/iface.go b/go/tasks/pluginmachinery/io/iface.go index 9f623350d..e2a3f5875 100644 --- a/go/tasks/pluginmachinery/io/iface.go +++ b/go/tasks/pluginmachinery/io/iface.go @@ -43,7 +43,7 @@ type OutputReader interface { Read(ctx context.Context) (*core.LiteralMap, *ExecutionError, error) // DeckExists checks if the deck file has been generated. DeckExists(ctx context.Context) (bool, error) - // GetOutputMetadata get the metadata from task's output, like deck uri + // GetOutputMetadata get the metadata from the output of tasks, such as deck URI. GetOutputMetadata(ctx context.Context) map[string]string } diff --git a/go/tasks/pluginmachinery/ioutils/in_memory_output_reader.go b/go/tasks/pluginmachinery/ioutils/in_memory_output_reader.go index bb1beb06e..d22a5b621 100644 --- a/go/tasks/pluginmachinery/ioutils/in_memory_output_reader.go +++ b/go/tasks/pluginmachinery/ioutils/in_memory_output_reader.go @@ -48,6 +48,9 @@ func (r InMemoryOutputReader) DeckExists(_ context.Context) (bool, error) { } func (r InMemoryOutputReader) GetOutputMetadata(_ context.Context) map[string]string { + if r.DeckPath == nil { + return map[string]string{} + } return map[string]string{deckURIKey: r.DeckPath.String()} } diff --git a/go/tasks/pluginmachinery/ioutils/in_memory_output_reader_test.go b/go/tasks/pluginmachinery/ioutils/in_memory_output_reader_test.go index 3cae110fd..a87113477 100644 --- a/go/tasks/pluginmachinery/ioutils/in_memory_output_reader_test.go +++ b/go/tasks/pluginmachinery/ioutils/in_memory_output_reader_test.go @@ -25,6 +25,7 @@ func TestInMemoryOutputReader(t *testing.T) { or := NewInMemoryOutputReader(&flyteIdlCore.LiteralMap{Literals: lt}, &deckPath, nil) assert.Equal(t, &deckPath, or.DeckPath) + assert.Equal(t, deckPath.String(), or.GetOutputMetadata(context.Background())[deckURIKey]) ctx := context.TODO() ok, err := or.IsError(ctx) diff --git a/go/tasks/pluginmachinery/ioutils/remote_file_output_reader_test.go b/go/tasks/pluginmachinery/ioutils/remote_file_output_reader_test.go index ee10638b4..db213f36e 100644 --- a/go/tasks/pluginmachinery/ioutils/remote_file_output_reader_test.go +++ b/go/tasks/pluginmachinery/ioutils/remote_file_output_reader_test.go @@ -68,6 +68,7 @@ func TestReadOrigin(t *testing.T) { exists, err := r.DeckExists(ctx) assert.NoError(t, err) assert.True(t, exists) + assert.Equal(t, "deck.html", r.GetOutputMetadata(ctx)[deckURIKey]) }) t.Run("system", func(t *testing.T) {