Documentation ¶
Overview ¶
Package command provides utilities for commands.
Package command provides utilities for commands.
Package command provides utilities for commands. This package comment is to satisfy linters without disabling golint for the file.
Package command provides utilities for commands.
Index ¶
- Constants
- Variables
- func RegisterAPIHandler(system *actor.System, echo *echo.Echo, db *db.PgDB, rm rm.ResourceManager, ...)
- func TellNTSC(system *actor.System, msg interface{})
- type CommandSnapshot
- type CreateGeneric
- type NSCAuthZ
- type NSCAuthZBasic
- func (a *NSCAuthZBasic) AccessibleScopes(ctx context.Context, curUser model.User, requestedScope model.AccessScopeID) (model.AccessScopeSet, error)
- func (a *NSCAuthZBasic) CanCreateNSC(ctx context.Context, curUser model.User, workspaceID model.AccessScopeID) error
- func (a *NSCAuthZBasic) CanGetActiveTasksCount(ctx context.Context, curUser model.User) error
- func (a *NSCAuthZBasic) CanGetNSC(ctx context.Context, curUser model.User, workspaceID model.AccessScopeID) error
- func (a *NSCAuthZBasic) CanGetTensorboard(ctx context.Context, curUser model.User, workspaceID model.AccessScopeID, ...) error
- func (a *NSCAuthZBasic) CanSetNSCsPriority(ctx context.Context, curUser model.User, workspaceID model.AccessScopeID, ...) error
- func (a *NSCAuthZBasic) CanTerminateNSC(ctx context.Context, curUser model.User, workspaceID model.AccessScopeID) error
- func (a *NSCAuthZBasic) CanTerminateTensorboard(ctx context.Context, curUser model.User, workspaceID model.AccessScopeID) error
- func (a *NSCAuthZBasic) FilterTensorboards(ctx context.Context, curUser model.User, requestedScope model.AccessScopeID, ...) ([]*tensorboardv1.Tensorboard, error)
Constants ¶
const ( // CommandActorPath is the path of the actor that manages commands. CommandActorPath = "commands" // NotebookActorPath is the path of the actor that manages notebooks. NotebookActorPath = "notebooks" // ShellActorPath is the path of the actor that manages shells. ShellActorPath = "shells" // TensorboardActorPath is the path of the actor that manages tensorboards. TensorboardActorPath = "tensorboard" )
Variables ¶
var AuthZProvider authz.AuthZProviderType[NSCAuthZ]
AuthZProvider is the authz registry for Notebooks, Shells, and Commands.
Functions ¶
func RegisterAPIHandler ¶
func RegisterAPIHandler( system *actor.System, echo *echo.Echo, db *db.PgDB, rm rm.ResourceManager, middleware ...echo.MiddlewareFunc, )
RegisterAPIHandler initializes and registers the API handlers for all command related features.
Types ¶
type CommandSnapshot ¶
type CommandSnapshot struct { bun.BaseModel `bun:"table:command_state"` TaskID model.TaskID `bun:"task_id"` RegisteredTime time.Time `bun:"registered_time"` // taskType can be obtained from related task. // jobType can be obtained from task -> job_id -> job_type // jobId can be obtained from task -> job_id AllocationID model.AllocationID `bun:"allocation_id"` // GenericCommandSpec GenericCommandSpec tasks.GenericCommandSpec `bun:"generic_command_spec"` // Relations Task model.Task `bun:"rel:belongs-to,join:task_id=task_id"` Allocation model.Allocation `bun:"rel:belongs-to,join:allocation_id=allocation_id"` }
CommandSnapshot is a db representation of a generic command.
type CreateGeneric ¶
type CreateGeneric struct { ContextDirectory []byte Spec *tasks.GenericCommandSpec }
CreateGeneric is a request to managers to create a generic command.
type NSCAuthZ ¶
type NSCAuthZ interface { // NSC functions // GET /api/v1/NSCs/:nsc_id // GET /tasks CanGetNSC( ctx context.Context, curUser model.User, workspaceID model.AccessScopeID, ) error // GET /api/v1/tasks/count CanGetActiveTasksCount(ctx context.Context, curUser model.User) error // POST /api/v1/NSCs/:nsc_id/kill CanTerminateNSC( ctx context.Context, curUser model.User, workspaceID model.AccessScopeID, ) error // POST /api/v1/NSCs CanCreateNSC( ctx context.Context, curUser model.User, workspaceID model.AccessScopeID, ) error // PATCH /NSCs/:nsc_id // POST /api/v1/tensorboards/:tb_id/set_priority CanSetNSCsPriority( ctx context.Context, curUser model.User, workspaceID model.AccessScopeID, priority int, ) error // GET /api/v1/NSCs AccessibleScopes( ctx context.Context, curUser model.User, requestedScope model.AccessScopeID, ) (model.AccessScopeSet, error) FilterTensorboards( ctx context.Context, curUser model.User, requestedScope model.AccessScopeID, tensorboards []*tensorboardv1.Tensorboard, ) ([]*tensorboardv1.Tensorboard, error) // Tensorboard functions // GET /api/v1/tensorboards/:tb_id CanGetTensorboard( ctx context.Context, curUser model.User, workspaceID model.AccessScopeID, experimentIDs []int32, trialIDs []int32, ) error // POST /api/v1/tensorboards/:tb_id/kill CanTerminateTensorboard( ctx context.Context, curUser model.User, workspaceID model.AccessScopeID, ) error }
NSCAuthZ describes authz methods for Notebooks, Shells, and Commands.
type NSCAuthZBasic ¶
type NSCAuthZBasic struct{}
NSCAuthZBasic is basic OSS controls.
func (*NSCAuthZBasic) AccessibleScopes ¶
func (a *NSCAuthZBasic) AccessibleScopes( ctx context.Context, curUser model.User, requestedScope model.AccessScopeID, ) (model.AccessScopeSet, error)
AccessibleScopes returns the set of scopes that the user should be limited to.
func (*NSCAuthZBasic) CanCreateNSC ¶
func (a *NSCAuthZBasic) CanCreateNSC( ctx context.Context, curUser model.User, workspaceID model.AccessScopeID, ) error
CanCreateNSC always returns a nil error.
func (*NSCAuthZBasic) CanGetActiveTasksCount ¶
CanGetActiveTasksCount always returns a nil error.
func (*NSCAuthZBasic) CanGetNSC ¶
func (a *NSCAuthZBasic) CanGetNSC( ctx context.Context, curUser model.User, workspaceID model.AccessScopeID, ) error
CanGetNSC returns true and nil error.
func (*NSCAuthZBasic) CanGetTensorboard ¶
func (a *NSCAuthZBasic) CanGetTensorboard( ctx context.Context, curUser model.User, workspaceID model.AccessScopeID, experimentIDs []int32, trialIDs []int32, ) error
CanGetTensorboard returns true and nil error.
func (*NSCAuthZBasic) CanSetNSCsPriority ¶
func (a *NSCAuthZBasic) CanSetNSCsPriority( ctx context.Context, curUser model.User, workspaceID model.AccessScopeID, priority int, ) error
CanSetNSCsPriority always returns a nil error.
func (*NSCAuthZBasic) CanTerminateNSC ¶
func (a *NSCAuthZBasic) CanTerminateNSC( ctx context.Context, curUser model.User, workspaceID model.AccessScopeID, ) error
CanTerminateNSC always returns a nil error.
func (*NSCAuthZBasic) CanTerminateTensorboard ¶
func (a *NSCAuthZBasic) CanTerminateTensorboard( ctx context.Context, curUser model.User, workspaceID model.AccessScopeID, ) error
CanTerminateTensorboard always returns nil.
func (*NSCAuthZBasic) FilterTensorboards ¶
func (a *NSCAuthZBasic) FilterTensorboards( ctx context.Context, curUser model.User, requestedScope model.AccessScopeID, tensorboards []*tensorboardv1.Tensorboard, ) ([]*tensorboardv1.Tensorboard, error)
FilterTensorboards returns the tensorboards that the user has access to.