Documentation ¶
Index ¶
- Constants
- type BaseResourceConstraint
- type BaseResourceManager
- type Builder
- type FullyQualifiedResourceConstraint
- type Metrics
- type NoopResourceManager
- func (*NoopResourceManager) AllocateResource(ctx context.Context, namespace pluginCore.ResourceNamespace, ...) (pluginCore.AllocationStatus, error)
- func (*NoopResourceManager) GetID() string
- func (*NoopResourceManager) ReleaseResource(ctx context.Context, namespace pluginCore.ResourceNamespace, ...) error
- type NoopResourceManagerBuilder
- func (r *NoopResourceManagerBuilder) BuildResourceManager(ctx context.Context) (BaseResourceManager, error)
- func (r *NoopResourceManagerBuilder) GetID() string
- func (r *NoopResourceManagerBuilder) GetResourceRegistrar(namespacePrefix pluginCore.ResourceNamespace) pluginCore.ResourceRegistrar
- func (r *NoopResourceManagerBuilder) RegisterResourceQuota(ctx context.Context, namespace pluginCore.ResourceNamespace, quota int) error
- type Proxy
- func (p Proxy) AllocateResource(ctx context.Context, namespace pluginCore.ResourceNamespace, ...) (pluginCore.AllocationStatus, error)
- func (p Proxy) ComposeResourceConstraint(spec pluginCore.ResourceConstraintsSpec) []FullyQualifiedResourceConstraint
- func (p Proxy) GetResourcePoolInfo() []*event.ResourcePoolInfo
- func (p Proxy) ReleaseResource(ctx context.Context, namespace pluginCore.ResourceNamespace, ...) error
- type Redis
- func (r *Redis) Ping() (string, error)
- func (r *Redis) SAdd(key string, member interface{}) (int64, error)
- func (r *Redis) SCard(key string) (int64, error)
- func (r *Redis) SIsMember(key string, member interface{}) (bool, error)
- func (r *Redis) SMembers(key string) ([]string, error)
- func (r *Redis) SRem(key string, member interface{}) (int64, error)
- type RedisClient
- type RedisResourceManager
- func (r *RedisResourceManager) AllocateResource(ctx context.Context, namespace pluginCore.ResourceNamespace, ...) (pluginCore.AllocationStatus, error)
- func (r *RedisResourceManager) GetID() string
- func (r *RedisResourceManager) ReleaseResource(ctx context.Context, namespace pluginCore.ResourceNamespace, ...) error
- type RedisResourceManagerBuilder
- func (r *RedisResourceManagerBuilder) BuildResourceManager(ctx context.Context) (BaseResourceManager, error)
- func (r *RedisResourceManagerBuilder) GetID() string
- func (r *RedisResourceManagerBuilder) GetResourceRegistrar(namespacePrefix pluginCore.ResourceNamespace) pluginCore.ResourceRegistrar
- func (r *RedisResourceManagerBuilder) RegisterResourceQuota(ctx context.Context, namespace pluginCore.ResourceNamespace, quota int) error
- type RedisResourceManagerMetrics
- type Resource
- type ResourceConstraint
- type ResourceRegistrarProxy
- type TaskResourceManager
- type Token
- type TokenPrefix
Constants ¶
const NoopResourceManagerID = "noopresourcemanager"
const RedisSetKeyPrefix = "redisresourcemanager"
This is the key that will point to the Redis Set. https://redis.io/commands#set
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BaseResourceConstraint ¶ added in v0.7.0
type BaseResourceConstraint struct {
Value int64
}
func (*BaseResourceConstraint) IsAllowed ¶ added in v0.7.0
func (brc *BaseResourceConstraint) IsAllowed(actualValue int64) bool
type BaseResourceManager ¶ added in v0.7.0
type BaseResourceManager interface { GetID() string AllocateResource(ctx context.Context, namespace pluginCore.ResourceNamespace, allocationToken Token, constraints []FullyQualifiedResourceConstraint) (pluginCore.AllocationStatus, error) ReleaseResource(ctx context.Context, namespace pluginCore.ResourceNamespace, allocationToken Token) error }
type Builder ¶
type Builder interface { GetID() string GetResourceRegistrar(namespacePrefix pluginCore.ResourceNamespace) pluginCore.ResourceRegistrar BuildResourceManager(ctx context.Context) (BaseResourceManager, error) }
type FullyQualifiedResourceConstraint ¶ added in v0.7.0
func (*FullyQualifiedResourceConstraint) IsAllowed ¶ added in v0.7.0
func (fqrc *FullyQualifiedResourceConstraint) IsAllowed(actualValue int64) bool
type NoopResourceManager ¶
type NoopResourceManager struct { }
func (*NoopResourceManager) AllocateResource ¶
func (*NoopResourceManager) AllocateResource(ctx context.Context, namespace pluginCore.ResourceNamespace, allocationToken Token, constraints []FullyQualifiedResourceConstraint) ( pluginCore.AllocationStatus, error)
func (*NoopResourceManager) GetID ¶ added in v0.1.28
func (*NoopResourceManager) GetID() string
func (*NoopResourceManager) ReleaseResource ¶
func (*NoopResourceManager) ReleaseResource(ctx context.Context, namespace pluginCore.ResourceNamespace, allocationToken Token) error
type NoopResourceManagerBuilder ¶
type NoopResourceManagerBuilder struct { }
func (*NoopResourceManagerBuilder) BuildResourceManager ¶
func (r *NoopResourceManagerBuilder) BuildResourceManager(ctx context.Context) (BaseResourceManager, error)
func (*NoopResourceManagerBuilder) GetID ¶ added in v0.1.28
func (r *NoopResourceManagerBuilder) GetID() string
func (*NoopResourceManagerBuilder) GetResourceRegistrar ¶ added in v0.1.28
func (r *NoopResourceManagerBuilder) GetResourceRegistrar(namespacePrefix pluginCore.ResourceNamespace) pluginCore.ResourceRegistrar
func (*NoopResourceManagerBuilder) RegisterResourceQuota ¶
func (r *NoopResourceManagerBuilder) RegisterResourceQuota(ctx context.Context, namespace pluginCore.ResourceNamespace, quota int) error
type Proxy ¶
type Proxy struct { // pluginCore.ResourceManager BaseResourceManager ResourceNamespacePrefix pluginCore.ResourceNamespace ExecutionIdentifier *core.TaskExecutionIdentifier ResourcePoolInfo map[string]*event.ResourcePoolInfo }
A proxy will be created for each TaskExecutionContext. The Proxy of an execution contains the resource namespace prefix (e.g., "qubole-hive-executor" for a hive task) and the token prefix (e.g., ex:<project>:<domain>:<exec_id>) of that execution. The plugins will only have access to a Proxy but not directly the underlying resource manager. The Proxy will prepend proper prefixes for the resource namespace and the allocation token.
func (Proxy) AllocateResource ¶
func (p Proxy) AllocateResource(ctx context.Context, namespace pluginCore.ResourceNamespace, allocationToken string, constraintsSpec pluginCore.ResourceConstraintsSpec) (pluginCore.AllocationStatus, error)
func (Proxy) ComposeResourceConstraint ¶ added in v0.7.0
func (p Proxy) ComposeResourceConstraint(spec pluginCore.ResourceConstraintsSpec) []FullyQualifiedResourceConstraint
func (Proxy) GetResourcePoolInfo ¶ added in v0.7.9
func (p Proxy) GetResourcePoolInfo() []*event.ResourcePoolInfo
func (Proxy) ReleaseResource ¶
func (p Proxy) ReleaseResource(ctx context.Context, namespace pluginCore.ResourceNamespace, allocationToken string) error
type Redis ¶ added in v0.1.28
type Redis struct {
// contains filtered or unexported fields
}
type RedisClient ¶ added in v0.1.28
type RedisClient interface { // A pass-through method. Getting the cardinality of the Redis set SCard(string) (int64, error) // A pass-through method. Checking if an entity is a member of the set specified by the key SIsMember(string, interface{}) (bool, error) // A pass-through method. Adding an entity to the set specified by the key SAdd(string, interface{}) (int64, error) // A pass-through method. Removing an entity from the set specified by the key SRem(string, interface{}) (int64, error) // A pass-through method. Getting the complete list of MEMBERS of the set SMembers(string) ([]string, error) // A pass-through method. Pinging the Redis client Ping() (string, error) }
func NewRedisClient ¶
func NewRedisClient(ctx context.Context, config config.RedisConfig) (RedisClient, error)
type RedisResourceManager ¶
type RedisResourceManager struct { MetricsScope promutils.Scope // contains filtered or unexported fields }
func (*RedisResourceManager) AllocateResource ¶
func (r *RedisResourceManager) AllocateResource(ctx context.Context, namespace pluginCore.ResourceNamespace, allocationToken Token, composedResourceConstraintList []FullyQualifiedResourceConstraint) ( pluginCore.AllocationStatus, error)
func (*RedisResourceManager) GetID ¶ added in v0.1.28
func (r *RedisResourceManager) GetID() string
func (*RedisResourceManager) ReleaseResource ¶
func (r *RedisResourceManager) ReleaseResource(ctx context.Context, namespace pluginCore.ResourceNamespace, allocationToken Token) error
type RedisResourceManagerBuilder ¶
type RedisResourceManagerBuilder struct { MetricsScope promutils.Scope // contains filtered or unexported fields }
func NewRedisResourceManagerBuilder ¶
func NewRedisResourceManagerBuilder(_ context.Context, client RedisClient, scope promutils.Scope) (*RedisResourceManagerBuilder, error)
func (*RedisResourceManagerBuilder) BuildResourceManager ¶
func (r *RedisResourceManagerBuilder) BuildResourceManager(ctx context.Context) (BaseResourceManager, error)
func (*RedisResourceManagerBuilder) GetID ¶ added in v0.1.28
func (r *RedisResourceManagerBuilder) GetID() string
func (*RedisResourceManagerBuilder) GetResourceRegistrar ¶ added in v0.1.28
func (r *RedisResourceManagerBuilder) GetResourceRegistrar(namespacePrefix pluginCore.ResourceNamespace) pluginCore.ResourceRegistrar
func (*RedisResourceManagerBuilder) RegisterResourceQuota ¶
func (r *RedisResourceManagerBuilder) RegisterResourceQuota(ctx context.Context, namespace pluginCore.ResourceNamespace, quota int) error
type RedisResourceManagerMetrics ¶
type RedisResourceManagerMetrics struct { Scope promutils.Scope RedisSizeCheckTime promutils.StopWatch AllocatedTokensGauge prometheus.Gauge ApproximateBackedUpLength prometheus.Gauge }
func NewRedisResourceManagerMetrics ¶
func NewRedisResourceManagerMetrics(scope promutils.Scope) *RedisResourceManagerMetrics
func (RedisResourceManagerMetrics) GetScope ¶
func (rrmm RedisResourceManagerMetrics) GetScope() promutils.Scope
type Resource ¶
type Resource struct {
// contains filtered or unexported fields
}
This struct is designed to serve as the identifier of an user of resource manager
type ResourceConstraint ¶ added in v0.7.0
type ResourceRegistrarProxy ¶
type ResourceRegistrarProxy struct { pluginCore.ResourceRegistrar ResourceNamespacePrefix pluginCore.ResourceNamespace }
The Proxy will prepend a proper prefix for the resource namespace.
func (ResourceRegistrarProxy) RegisterResourceQuota ¶
func (p ResourceRegistrarProxy) RegisterResourceQuota(ctx context.Context, namespace pluginCore.ResourceNamespace, quota int) error
type TaskResourceManager ¶ added in v0.7.9
type TaskResourceManager interface { pluginCore.ResourceManager GetResourcePoolInfo() []*event.ResourcePoolInfo }
func GetTaskResourceManager ¶
func GetTaskResourceManager(r BaseResourceManager, resourceNamespacePrefix pluginCore.ResourceNamespace, id *core.TaskExecutionIdentifier) TaskResourceManager
type TokenPrefix ¶ added in v0.1.23
type TokenPrefix string
func ComposeTokenPrefix ¶ added in v0.1.23
func ComposeTokenPrefix(id *core.TaskExecutionIdentifier) TokenPrefix