Skip to content

Commit

Permalink
Artifact fixes (#193)
Browse files Browse the repository at this point in the history
Signed-off-by: Yee Hing Tong <wild-endeavor@users.noreply.github.com>
  • Loading branch information
wild-endeavor committed Apr 9, 2024
1 parent 494cbcc commit 7ff0059
Show file tree
Hide file tree
Showing 10 changed files with 53 additions and 406 deletions.
12 changes: 2 additions & 10 deletions flyteadmin/pkg/manager/impl/execution_manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -799,16 +799,8 @@ func (m *ExecutionManager) fillInTemplateArgs(ctx context.Context, query core.Ar
return query, errors.NewFlyteAdminErrorf(codes.InvalidArgument, "id doesn't have key")
}
var project, domain string
if ak.GetProject() == "" {
project = contextutils.Value(ctx, contextutils.ProjectKey)
} else {
project = ak.GetProject()
}
if ak.GetDomain() == "" {
domain = contextutils.Value(ctx, contextutils.DomainKey)
} else {
domain = ak.GetDomain()
}
project = contextutils.Value(ctx, contextutils.ProjectKey)
domain = contextutils.Value(ctx, contextutils.DomainKey)

var partitions map[string]*core.LabelValue

Expand Down
15 changes: 14 additions & 1 deletion flyteadmin/pkg/manager/impl/execution_manager_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"context"
"errors"
"fmt"
"github.com/flyteorg/flyte/flytestdlib/contextutils"
"strings"
"testing"
"time"
Expand Down Expand Up @@ -5968,6 +5969,12 @@ func TestQueryTemplate(t *testing.T) {
Name: "testname",
}

akNameOnly := &core.ArtifactKey{
Project: "",
Domain: "",
Name: "testname",
}

t.Run("test all present, nothing to fill in", func(t *testing.T) {
pMap := map[string]*core.LabelValue{
"partition1": {Value: &core.LabelValue_StaticValue{StaticValue: "my value"}},
Expand All @@ -5978,7 +5985,7 @@ func TestQueryTemplate(t *testing.T) {
q := core.ArtifactQuery{
Identifier: &core.ArtifactQuery_ArtifactId{
ArtifactId: &core.ArtifactID{
ArtifactKey: ak,
ArtifactKey: akNameOnly,
Partitions: p,
TimePartition: nil,
},
Expand All @@ -5988,6 +5995,12 @@ func TestQueryTemplate(t *testing.T) {
filledQuery, err := m.fillInTemplateArgs(ctx, q, otherInputs.Literals)
assert.NoError(t, err)
assert.True(t, proto.Equal(&q, &filledQuery))

q.GetArtifactId().ArtifactKey = ak
ctx = contextutils.WithProjectDomain(ctx, "project", "domain")
filledQuery, err = m.fillInTemplateArgs(ctx, q, otherInputs.Literals)
assert.NoError(t, err)
assert.True(t, proto.Equal(&q, &filledQuery))
})

t.Run("template date-times, both in explicit tp and not", func(t *testing.T) {
Expand Down
49 changes: 0 additions & 49 deletions flyteidl/gen/pb-es/flyteidl/core/artifact_id_pb.ts

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

144 changes: 31 additions & 113 deletions flyteidl/gen/pb-go/flyteidl/core/artifact_id.pb.go

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

58 changes: 0 additions & 58 deletions flyteidl/gen/pb-js/flyteidl.d.ts

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

Loading

0 comments on commit 7ff0059

Please sign in to comment.