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 59
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
cache crd fields instead of wf closure
Signed-off-by: Babis Kiosidis <[email protected]>
- Loading branch information
Showing
16 changed files
with
256 additions
and
261 deletions.
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
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
2 changes: 1 addition & 1 deletion
2
...ller/workflowclosurestore/config_flags.go → ...controller/crdfieldsstore/config_flags.go
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
2 changes: 1 addition & 1 deletion
2
...workflowclosurestore/config_flags_test.go → ...oller/crdfieldsstore/config_flags_test.go
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
2 changes: 1 addition & 1 deletion
2
...controller/workflowclosurestore/errors.go → pkg/controller/crdfieldsstore/errors.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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
package workflowclosurestore | ||
package crdfieldsstore | ||
|
||
import "fmt" | ||
|
||
|
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,42 @@ | ||
package crdfieldsstore | ||
|
||
import ( | ||
"context" | ||
"fmt" | ||
|
||
"github.com/flyteorg/flytestdlib/promutils" | ||
|
||
"github.com/flyteorg/flytepropeller/pkg/apis/flyteworkflow/v1alpha1" | ||
|
||
"github.com/flyteorg/flytestdlib/storage" | ||
) | ||
|
||
//go:generate mockery -all -output=mocks -case=underscore | ||
|
||
// WfClosureCrdFields interface provides an abstraction for retrieving CompiledWorkflowClosure blobs | ||
// and transforming them to the static CRD fields that it contains. | ||
// Caching the WfClosureCrdFields instead of the CompiledWorkflowClosure to avoid the | ||
// expensive transformations. | ||
type WfClosureCrdFieldsStore interface { | ||
Get(ctx context.Context, dataReference v1alpha1.DataReference) (*WfClosureCrdFields, error) | ||
Remove(ctx context.Context, dataReference v1alpha1.DataReference) error | ||
} | ||
|
||
func NewWfClosureCrdFieldsStore(ctx context.Context, cfg *Config, dataStore *storage.DataStore, scope promutils.Scope) (WfClosureCrdFieldsStore, error) { | ||
switch cfg.Policy { | ||
case PolicyActive: | ||
return NewActiveWfClosureCrdFieldsStore(NewPassthroughWfClosureCrdFieldsStore(dataStore), scope), nil | ||
case PolicyLRU: | ||
return NewLRUWfClosureCrdFieldsStore(NewPassthroughWfClosureCrdFieldsStore(dataStore), cfg.Size, scope) | ||
case PolicyPassThrough: | ||
return NewPassthroughWfClosureCrdFieldsStore(dataStore), nil | ||
} | ||
|
||
return nil, fmt.Errorf("empty workflow closure store config") | ||
} | ||
|
||
type WfClosureCrdFields struct { | ||
*v1alpha1.WorkflowSpec `json:"spec"` | ||
SubWorkflows map[v1alpha1.WorkflowID]*v1alpha1.WorkflowSpec `json:"subWorkflows,omitempty"` | ||
Tasks map[v1alpha1.TaskID]*v1alpha1.TaskSpec `json:"tasks"` | ||
} |
Oops, something went wrong.