forked from flyteorg/flyte
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix and re-enable resource revision cache (flyteorg#53)
- [X] Introduce a config-based factory method to control the workflow store type. - [X] Change WorkflowStore interface to return the committed version of the workflow object from etcd. - [X] Change resource version caching to only occur when the etcd. update operation results in a resource version change. - [X] Fix unit tests to simulate updating resource versions.
- Loading branch information
Showing
13 changed files
with
293 additions
and
60 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
package workflowstore | ||
|
||
import ( | ||
ctrlConfig "github.com/lyft/flytepropeller/pkg/controller/config" | ||
) | ||
|
||
//go:generate pflags Config --default-var=defaultConfig | ||
|
||
type Policy string | ||
|
||
const ( | ||
PolicyInMemory = "InMemory" | ||
PolicyPassThrough = "PassThrough" | ||
PolicyResourceVersionCache = "ResourceVersionCache" | ||
) | ||
|
||
var ( | ||
defaultConfig = &Config{ | ||
Policy: PolicyPassThrough, | ||
} | ||
|
||
configSection = ctrlConfig.MustRegisterSubSection("workflowStore", defaultConfig) | ||
) | ||
|
||
type Config struct { | ||
Policy Policy `json:"policy" pflag:",Workflow Store Policy to initialize"` | ||
} | ||
|
||
func GetConfig() *Config { | ||
return configSection.GetConfig().(*Config) | ||
} | ||
|
||
func SetConfig(cfg *Config) error { | ||
return configSection.SetConfig(*cfg) | ||
} |
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,25 @@ | ||
package workflowstore | ||
|
||
import ( | ||
"context" | ||
"fmt" | ||
|
||
flyteworkflowv1alpha1 "github.com/lyft/flytepropeller/pkg/client/clientset/versioned/typed/flyteworkflow/v1alpha1" | ||
"github.com/lyft/flytepropeller/pkg/client/listers/flyteworkflow/v1alpha1" | ||
"github.com/lyft/flytestdlib/promutils" | ||
) | ||
|
||
func NewWorkflowStore(ctx context.Context, cfg *Config, lister v1alpha1.FlyteWorkflowLister, | ||
workflows flyteworkflowv1alpha1.FlyteworkflowV1alpha1Interface, scope promutils.Scope) (FlyteWorkflow, error) { | ||
|
||
switch cfg.Policy { | ||
case PolicyInMemory: | ||
return NewInMemoryWorkflowStore(), nil | ||
case PolicyPassThrough: | ||
return NewPassthroughWorkflowStore(ctx, scope, workflows, lister), nil | ||
case PolicyResourceVersionCache: | ||
return NewResourceVersionCachingStore(ctx, scope, NewPassthroughWorkflowStore(ctx, scope, workflows, lister)), nil | ||
} | ||
|
||
return nil, fmt.Errorf("empty workflow store config") | ||
} |
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.