-
Notifications
You must be signed in to change notification settings - Fork 539
/
noop_resourcemanager.go
48 lines (35 loc) · 1.37 KB
/
noop_resourcemanager.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
package resourcemanager
import (
"context"
pluginCore "github.com/flyteorg/flyte/flyteplugins/go/tasks/pluginmachinery/core"
)
const NoopResourceManagerID = "noopresourcemanager"
type NoopResourceManagerBuilder struct {
}
func (r *NoopResourceManagerBuilder) GetID() string {
return NoopResourceManagerID
}
func (r *NoopResourceManagerBuilder) GetResourceRegistrar(namespacePrefix pluginCore.ResourceNamespace) pluginCore.ResourceRegistrar {
return ResourceRegistrarProxy{
ResourceRegistrar: r,
ResourceNamespacePrefix: namespacePrefix,
}
}
func (r *NoopResourceManagerBuilder) RegisterResourceQuota(ctx context.Context, namespace pluginCore.ResourceNamespace, quota int) error {
return nil
}
func (r *NoopResourceManagerBuilder) BuildResourceManager(ctx context.Context) (BaseResourceManager, error) {
return &NoopResourceManager{}, nil
}
type NoopResourceManager struct {
}
func (*NoopResourceManager) GetID() string {
return NoopResourceManagerID
}
func (*NoopResourceManager) AllocateResource(ctx context.Context, namespace pluginCore.ResourceNamespace, allocationToken Token, constraints []FullyQualifiedResourceConstraint) (
pluginCore.AllocationStatus, error) {
return pluginCore.AllocationStatusGranted, nil
}
func (*NoopResourceManager) ReleaseResource(ctx context.Context, namespace pluginCore.ResourceNamespace, allocationToken Token) error {
return nil
}