diff --git a/flyteadmin/pkg/common/naming/execution_name_test.go b/flyteadmin/pkg/common/naming/execution_name_test.go index 91f04d3bf1..22729dbb9b 100644 --- a/flyteadmin/pkg/common/naming/execution_name_test.go +++ b/flyteadmin/pkg/common/naming/execution_name_test.go @@ -1,7 +1,6 @@ package naming import ( - "context" "strings" "testing" "time" @@ -10,8 +9,6 @@ import ( runtimeInterfaces "github.com/flyteorg/flyte/flyteadmin/pkg/runtime/interfaces" runtimeMocks "github.com/flyteorg/flyte/flyteadmin/pkg/runtime/mocks" - "github.com/flyteorg/flyte/flyteadmin/scheduler/identifier" - "github.com/flyteorg/flyte/flyteidl/gen/pb-go/flyteidl/core" ) const AllowedExecutionIDAlphabetStr = "abcdefghijklmnopqrstuvwxyz" @@ -64,15 +61,4 @@ func TestGetExecutionName(t *testing.T) { assert.Equal(t, 4, len(words), "FriendlyName should be split into exactly four words") }) - t.Run("deterministic name", func(t *testing.T) { - hashValue := identifier.HashScheduledTimeStamp(context.Background(), &core.Identifier{ - Project: "Project", - Domain: "Domain", - Name: "Name", - Version: "Version", - }, time.Time{}) - - name := GetExecutionName(int64(hashValue)) - assert.Equal(t, name, "carpet-juliet-kentucky-kentucky") - }) } diff --git a/flyteadmin/scheduler/executor/executor_impl.go b/flyteadmin/scheduler/executor/executor_impl.go index e269d79b2a..f3fd86c6cf 100644 --- a/flyteadmin/scheduler/executor/executor_impl.go +++ b/flyteadmin/scheduler/executor/executor_impl.go @@ -12,7 +12,6 @@ import ( "k8s.io/client-go/util/retry" "github.com/flyteorg/flyte/flyteadmin/pkg/common/naming" - "github.com/flyteorg/flyte/flyteadmin/scheduler/identifier" "github.com/flyteorg/flyte/flyteadmin/scheduler/repositories/models" "github.com/flyteorg/flyte/flyteidl/gen/pb-go/flyteidl/admin" "github.com/flyteorg/flyte/flyteidl/gen/pb-go/flyteidl/core" @@ -53,15 +52,7 @@ func (w *executor) Execute(ctx context.Context, scheduledTime time.Time, s model } } - // Making the identifier deterministic using the hash of the identifier and scheduled time - hashValue := identifier.HashScheduledTimeStamp(ctx, &core.Identifier{ - Project: s.Project, - Domain: s.Domain, - Name: s.Name, - Version: s.Version, - }, scheduledTime) - - executionName := naming.GetExecutionName(int64(hashValue)) + executionName := naming.GetExecutionName(time.Now().UnixNano()) executionRequest := &admin.ExecutionCreateRequest{ Project: s.Project, Domain: s.Domain, diff --git a/flyteadmin/scheduler/identifier/identifier.go b/flyteadmin/scheduler/identifier/identifier.go index caf5c94296..5d386e8652 100644 --- a/flyteadmin/scheduler/identifier/identifier.go +++ b/flyteadmin/scheduler/identifier/identifier.go @@ -34,7 +34,7 @@ func GetScheduleName(ctx context.Context, s models.SchedulableEntity) string { // GetExecutionIdentifier returns UUID using the hashed value of the schedule identifier and the scheduledTime func GetExecutionIdentifier(ctx context.Context, identifier *core.Identifier, scheduledTime time.Time) (uuid.UUID, error) { - hashValue := HashScheduledTimeStamp(ctx, identifier, scheduledTime) + hashValue := hashScheduledTimeStamp(ctx, identifier, scheduledTime) b := make([]byte, 16) binary.LittleEndian.PutUint64(b, hashValue) return uuid.FromBytes(b) @@ -55,8 +55,8 @@ func hashIdentifier(ctx context.Context, identifier *core.Identifier) uint64 { return h.Sum64() } -// HashScheduledTimeStamp return the hash of the identifier and the scheduledTime -func HashScheduledTimeStamp(ctx context.Context, identifier *core.Identifier, scheduledTime time.Time) uint64 { +// hashScheduledTimeStamp return the hash of the identifier and the scheduledTime +func hashScheduledTimeStamp(ctx context.Context, identifier *core.Identifier, scheduledTime time.Time) uint64 { h := fnv.New64() _, err := h.Write([]byte(fmt.Sprintf(executionIDInputsFormat, identifier.Project, identifier.Domain, identifier.Name, identifier.Version, scheduledTime.Unix())))