This repository has been archived by the owner on Oct 9, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 53
Add GetDeckPath to OutputReader #268
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
3306fe8
Add GetDeckPath to RemoteFileOutputReader
pingsutw 773e2a4
make generate
pingsutw 176ea6d
Merge branch 'master' of github.com:flyteorg/flyteplugins into outpath
pingsutw 8b2b88c
Fix tests
pingsutw beaf696
Fix tests
pingsutw f19ef78
Fix tests
pingsutw 2feb8d1
more tests
pingsutw a5d0aa0
nit
pingsutw File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
44 changes: 44 additions & 0 deletions
44
go/tasks/pluginmachinery/ioutils/in_memory_output_reader_test.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
package ioutils | ||
|
||
import ( | ||
"context" | ||
"testing" | ||
|
||
flyteIdlCore "github.com/flyteorg/flyteidl/gen/pb-go/flyteidl/core" | ||
"github.com/flyteorg/flytestdlib/storage" | ||
"github.com/stretchr/testify/assert" | ||
) | ||
|
||
func TestInMemoryOutputReader(t *testing.T) { | ||
deckPath := storage.DataReference("s3://bucket/key") | ||
lt := map[string]*flyteIdlCore.Literal{ | ||
"results": { | ||
Value: &flyteIdlCore.Literal_Scalar{ | ||
Scalar: &flyteIdlCore.Scalar{ | ||
Value: &flyteIdlCore.Scalar_Primitive{ | ||
Primitive: &flyteIdlCore.Primitive{Value: &flyteIdlCore.Primitive_Integer{Integer: 3}}, | ||
}, | ||
}, | ||
}, | ||
}, | ||
} | ||
or := NewInMemoryOutputReader(&flyteIdlCore.LiteralMap{Literals: lt}, &deckPath, nil) | ||
|
||
assert.Equal(t, &deckPath, or.GetDeckPath()) | ||
ctx := context.TODO() | ||
|
||
ok, err := or.IsError(ctx) | ||
assert.False(t, ok) | ||
assert.NoError(t, err) | ||
|
||
assert.False(t, or.IsFile(ctx)) | ||
|
||
ok, err = or.Exists(ctx) | ||
assert.True(t, ok) | ||
assert.NoError(t, err) | ||
|
||
literalMap, executionErr, err := or.Read(ctx) | ||
assert.Equal(t, lt, literalMap.Literals) | ||
assert.Nil(t, executionErr) | ||
assert.NoError(t, err) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
48 changes: 48 additions & 0 deletions
48
go/tasks/pluginmachinery/ioutils/remote_file_output_writer_test.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
package ioutils | ||
|
||
import ( | ||
"context" | ||
"testing" | ||
|
||
"github.com/flyteorg/flytestdlib/promutils" | ||
"github.com/flyteorg/flytestdlib/storage" | ||
"github.com/stretchr/testify/assert" | ||
) | ||
|
||
func TestRemoteFileOutputWriter(t *testing.T) { | ||
ctx := context.TODO() | ||
memStore, err := storage.NewDataStore(&storage.Config{Type: storage.TypeMemory}, promutils.NewTestScope()) | ||
assert.Nil(t, err) | ||
|
||
outputPrefix := storage.DataReference("output") | ||
rawOutputPrefix := storage.DataReference("sandbox") | ||
previousCheckpointPath := storage.DataReference("checkpoint") | ||
|
||
checkpointPath := NewCheckpointRemoteFilePaths( | ||
ctx, | ||
memStore, | ||
outputPrefix, | ||
NewRawOutputPaths(ctx, rawOutputPrefix), | ||
previousCheckpointPath, | ||
) | ||
|
||
t.Run("Test NewCheckpointRemoteFilePaths", func(t *testing.T) { | ||
assert.Equal(t, previousCheckpointPath, checkpointPath.GetPreviousCheckpointsPrefix()) | ||
assert.Equal(t, outputPrefix, checkpointPath.GetOutputPrefixPath()) | ||
|
||
assert.Equal(t, constructPath(memStore, rawOutputPrefix, CheckpointPrefix), checkpointPath.GetCheckpointPrefix()) | ||
assert.Equal(t, constructPath(memStore, outputPrefix, OutputsSuffix), checkpointPath.GetOutputPath()) | ||
assert.Equal(t, constructPath(memStore, outputPrefix, deckSuffix), checkpointPath.GetDeckPath()) | ||
assert.Equal(t, constructPath(memStore, outputPrefix, ErrorsSuffix), checkpointPath.GetErrorPath()) | ||
assert.Equal(t, constructPath(memStore, outputPrefix, FuturesSuffix), checkpointPath.GetFuturesPath()) | ||
}) | ||
|
||
t.Run("Test NewRemoteFileOutputWriter", func(t *testing.T) { | ||
p := NewRemoteFileOutputWriter(ctx, memStore, checkpointPath) | ||
|
||
assert.Equal(t, constructPath(memStore, rawOutputPrefix, CheckpointPrefix), p.GetCheckpointPrefix()) | ||
assert.Equal(t, constructPath(memStore, outputPrefix, OutputsSuffix), p.GetOutputPath()) | ||
assert.Equal(t, constructPath(memStore, outputPrefix, deckSuffix), p.GetDeckPath()) | ||
assert.Equal(t, constructPath(memStore, outputPrefix, ErrorsSuffix), p.GetErrorPath()) | ||
}) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We might want to think about this (maybe open a separate issue) for how to aggregate (if any) these html files in array case
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
okay, will create a new issue for it.