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.
Merge pull request flyteorg#72 from lyft/fairness-hard-cap
Implementing project-level and namespace-level quota cap
- Loading branch information
Showing
14 changed files
with
583 additions
and
181 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
Large diffs are not rendered by default.
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
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
45 changes: 45 additions & 0 deletions
45
...epropeller/pkg/controller/nodes/task/resourcemanager/fullyqualifiedresourceconstraints.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,45 @@ | ||
package resourcemanager | ||
|
||
import ( | ||
"github.com/lyft/flyteidl/gen/pb-go/flyteidl/core" | ||
pluginCore "github.com/lyft/flyteplugins/go/tasks/pluginmachinery/core" | ||
) | ||
|
||
type ResourceConstraint interface { | ||
IsAllowed(int64) bool | ||
} | ||
|
||
func isAllowed(constraintValue int64, actualValue int64) bool { | ||
return constraintValue > actualValue | ||
} | ||
|
||
type BaseResourceConstraint struct { | ||
Value int64 | ||
} | ||
|
||
func (brc *BaseResourceConstraint) IsAllowed(actualValue int64) bool { | ||
return isAllowed(brc.Value, actualValue) | ||
} | ||
|
||
type FullyQualifiedResourceConstraint struct { | ||
TargetedPrefixString string | ||
Value int64 | ||
} | ||
|
||
func (fqrc *FullyQualifiedResourceConstraint) IsAllowed(actualValue int64) bool { | ||
return isAllowed(fqrc.Value, actualValue) | ||
} | ||
|
||
func composeFullyQualifiedProjectScopeResourceConstraint(spec pluginCore.ResourceConstraintsSpec, id *core.TaskExecutionIdentifier) FullyQualifiedResourceConstraint { | ||
return FullyQualifiedResourceConstraint{ | ||
TargetedPrefixString: string(composeProjectScopePrefix(id)), | ||
Value: spec.ProjectScopeResourceConstraint.Value, | ||
} | ||
} | ||
|
||
func composeFullyQualifiedNamespaceScopeResourceConstraint(spec pluginCore.ResourceConstraintsSpec, id *core.TaskExecutionIdentifier) FullyQualifiedResourceConstraint { | ||
return FullyQualifiedResourceConstraint{ | ||
TargetedPrefixString: string(composeNamespaceScopePrefix(id)), | ||
Value: spec.NamespaceScopeResourceConstraint.Value, | ||
} | ||
} |
157 changes: 110 additions & 47 deletions
157
flytepropeller/pkg/controller/nodes/task/resourcemanager/mocks/redis_client.go
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.