rm

package
v0.38.0-rc2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 28, 2024 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

AuthZProvider provides ResourceManagerAuthZ implementations.

Functions

func CopyGetAgentsResponse

func CopyGetAgentsResponse(resp *apiv1.GetAgentsResponse) (*apiv1.GetAgentsResponse, error)

CopyGetAgentsResponse returns a deep copy of GetAgentsResponse struct.

func FetchAvgQueuedTime

func FetchAvgQueuedTime(pool string) (
	[]*jobv1.AggregateQueueStats, error,
)

FetchAvgQueuedTime fetches the average queued time for a resource pool.

Types

type ClusterName

type ClusterName string

ClusterName is the name of the cluster within which we want to send a request.

func (ClusterName) String

func (c ClusterName) String() string

type ResourceManager

type ResourceManager interface {
	// Basic functionality
	GetAllocationSummaries() (map[model.AllocationID]sproto.AllocationSummary, error)
	Allocate(sproto.AllocateRequest) (*sproto.ResourcesSubscription, error)
	Release(sproto.ResourcesReleased)
	ValidateResources(sproto.ValidateResourcesRequest) ([]command.LaunchWarning, error)
	DeleteJob(sproto.DeleteJob) (sproto.DeleteJobResponse, error)
	NotifyContainerRunning(sproto.NotifyContainerRunning) error

	// Scheduling related stuff
	SetGroupMaxSlots(sproto.SetGroupMaxSlots)
	SetGroupWeight(sproto.SetGroupWeight) error
	SetGroupPriority(sproto.SetGroupPriority) error
	IsReattachableOnlyAfterStarted() bool
	SmallerValueIsHigherPriority() (bool, error)

	// Resource pool stuff.
	GetResourcePools() (*apiv1.GetResourcePoolsResponse, error)
	GetDefaultComputeResourcePool() (ResourcePoolName, error)
	GetDefaultAuxResourcePool() (ResourcePoolName, error)
	ValidateResourcePool(ResourcePoolName) error
	ResolveResourcePool(name ResourcePoolName, workspace, slots int) (ResourcePoolName, error)
	TaskContainerDefaults(
		ResourcePoolName, model.TaskContainerDefaultsConfig,
	) (model.TaskContainerDefaultsConfig, error)

	// Job queue
	GetJobQ(ResourcePoolName) (map[model.JobID]*sproto.RMJobInfo, error)
	GetJobQueueStatsRequest(*apiv1.GetJobQueueStatsRequest) (*apiv1.GetJobQueueStatsResponse, error)
	RecoverJobPosition(sproto.RecoverJobPosition)
	GetExternalJobs(ResourcePoolName) ([]*jobv1.Job, error)

	// Cluster Management APIs
	GetAgents() (*apiv1.GetAgentsResponse, error)
	GetAgent(*apiv1.GetAgentRequest) (*apiv1.GetAgentResponse, error)
	EnableAgent(*apiv1.EnableAgentRequest) (*apiv1.EnableAgentResponse, error)
	DisableAgent(*apiv1.DisableAgentRequest) (*apiv1.DisableAgentResponse, error)
	GetSlots(*apiv1.GetSlotsRequest) (*apiv1.GetSlotsResponse, error)
	GetSlot(*apiv1.GetSlotRequest) (*apiv1.GetSlotResponse, error)
	EnableSlot(*apiv1.EnableSlotRequest) (*apiv1.EnableSlotResponse, error)
	DisableSlot(*apiv1.DisableSlotRequest) (*apiv1.DisableSlotResponse, error)
	HealthCheck() []model.ResourceManagerHealth

	// Kubernetes Namespaces and Quotas.
	DefaultNamespace(string) (*string, error)
	VerifyNamespaceExists(string, string) error
	CreateNamespace(string, string, bool) error
	DeleteNamespace(string) error
	RemoveEmptyNamespace(string, string) error
	GetNamespaceResourceQuota(string, string) (*float64, error)
	SetResourceQuota(int, string, string) error
}

ResourceManager is an interface for a resource manager, which can allocate and manage resources.

type ResourceManagerAuthZ

type ResourceManagerAuthZ interface {
	// GET /api/v1/resource-pools
	FilterResourcePools(
		ctx context.Context, curUser model.User, resourcePools []*resourcepoolv1.ResourcePool,
		accessibleWorkspaces []int32,
	) ([]*resourcepoolv1.ResourcePool, error)
}

ResourceManagerAuthZ is the interface for resource manager authorization.

type ResourceManagerAuthZBasic

type ResourceManagerAuthZBasic struct{}

ResourceManagerAuthZBasic is classic OSS Determined authentication for resource managers.

func (*ResourceManagerAuthZBasic) FilterResourcePools

func (a *ResourceManagerAuthZBasic) FilterResourcePools(
	ctx context.Context, curUser model.User, resourcePools []*resourcepoolv1.ResourcePool,
	_ []int32,
) ([]*resourcepoolv1.ResourcePool, error)

FilterResourcePools always returns provided list and a nil error.

type ResourceManagerAuthZRBAC

type ResourceManagerAuthZRBAC struct{}

ResourceManagerAuthZRBAC is RBAC authorization for resource managers.

func (*ResourceManagerAuthZRBAC) FilterResourcePools

func (r *ResourceManagerAuthZRBAC) FilterResourcePools(
	ctx context.Context, curUser model.User, resourcePools []*resourcepoolv1.ResourcePool,
	accessibleWorkspaces []int32,
) ([]*resourcepoolv1.ResourcePool, error)

FilterResourcePools takes in a slice of all resource pools and the IDs of the workspaces the curUser has access to. It outputs a list of resource pools the user has access to by combining all unbound pools with those bound to workspaces the user has access to.

type ResourcePoolName

type ResourcePoolName string

ResourcePoolName holds the name of the resource pool, and describes the input/output of several ResourceManager methods.

func (ResourcePoolName) String

func (r ResourcePoolName) String() string

String converts a ResourcePoolName to String.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL