Documentation
¶
Index ¶
- Constants
- type AsyncInvocation
- type Handler
- func (h *Handler) ChaosOperations() []string
- func (h *Handler) ChaosRegions() []string
- func (h *Handler) ChaosServiceName() string
- func (h *Handler) ExtractOperation(c *echo.Context) string
- func (h *Handler) ExtractResource(c *echo.Context) string
- func (h *Handler) GetSupportedOperations() []string
- func (h *Handler) Handler() echo.HandlerFunc
- func (h *Handler) MatchPriority() int
- func (h *Handler) Name() string
- func (h *Handler) Restore(ctx context.Context, data []byte) error
- func (h *Handler) RouteMatcher() service.Matcher
- func (h *Handler) Shutdown(_ context.Context)
- func (h *Handler) Snapshot(ctx context.Context) []byte
- type InMemoryBackend
- func (b *InMemoryBackend) ListAsyncInvocations() []*AsyncInvocation
- func (b *InMemoryBackend) ListInvocations() []*Invocation
- func (b *InMemoryBackend) ListSessions() []*Session
- func (b *InMemoryBackend) RecordAsyncInvocation(endpointName, requestedID, input, outputLocation string) *AsyncInvocation
- func (b *InMemoryBackend) RecordInvocation(operation, endpointName, input, output string) *Invocation
- func (b *InMemoryBackend) Region() string
- func (b *InMemoryBackend) Restore(ctx context.Context, data []byte) error
- func (b *InMemoryBackend) Snapshot(ctx context.Context) []byte
- func (b *InMemoryBackend) StartSession(endpointName string) *Session
- func (b *InMemoryBackend) TouchSession(sessionID string)
- type Invocation
- type Provider
- type Session
Constants ¶
const MaxAsyncInvocations = maxAsyncInvocations
MaxAsyncInvocations is the exported value for testing.
const MaxInvocationHistory = maxInvocationHistory
MaxInvocationHistory is the exported value for testing.
const MaxSessions = maxSessions
MaxSessions is the exported value for testing.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AsyncInvocation ¶
type AsyncInvocation struct {
CreatedAt time.Time `json:"createdAt"`
InferenceID string `json:"inferenceId"`
EndpointName string `json:"endpointName"`
Input string `json:"input"`
OutputLocation string `json:"outputLocation"`
FailureLocation string `json:"failureLocation"`
}
AsyncInvocation records accepted asynchronous inference work.
type Handler ¶
type Handler struct {
Backend *InMemoryBackend
}
Handler is the Echo HTTP handler for AWS SageMaker Runtime operations.
func NewHandler ¶
func NewHandler(backend *InMemoryBackend) *Handler
NewHandler creates a new SageMaker Runtime handler backed by backend.
func (*Handler) ChaosOperations ¶
ChaosOperations returns all operations that can be fault-injected.
func (*Handler) ChaosRegions ¶
ChaosRegions returns all regions this handler instance handles.
func (*Handler) ChaosServiceName ¶
ChaosServiceName returns the lowercase AWS service name for fault rule matching.
func (*Handler) ExtractOperation ¶
ExtractOperation returns the operation name derived from the request path.
func (*Handler) ExtractResource ¶
ExtractResource extracts the endpoint name from the request path.
func (*Handler) GetSupportedOperations ¶
GetSupportedOperations returns the list of supported operations.
func (*Handler) Handler ¶
func (h *Handler) Handler() echo.HandlerFunc
Handler returns the Echo handler function for SageMaker Runtime requests.
func (*Handler) MatchPriority ¶
MatchPriority returns the routing priority.
func (*Handler) RouteMatcher ¶
RouteMatcher returns a function that matches SageMaker Runtime requests. It matches all requests to paths beginning with /endpoints/. The real AWS SageMaker Runtime endpoint hostname is "runtime.sagemaker.<region>.amazonaws.com" (see aws-sdk-go-v2/service/sagemakerruntime's endpoint resolver), not "sagemaker-runtime.<region>..." -- the latter would never match real traffic.
type InMemoryBackend ¶
type InMemoryBackend struct {
// contains filtered or unexported fields
}
InMemoryBackend stores SageMaker Runtime state in memory.
func NewInMemoryBackend ¶
func NewInMemoryBackend(accountID, region string) *InMemoryBackend
NewInMemoryBackend creates a new InMemoryBackend.
func (*InMemoryBackend) ListAsyncInvocations ¶
func (b *InMemoryBackend) ListAsyncInvocations() []*AsyncInvocation
ListAsyncInvocations returns accepted asynchronous inference work.
func (*InMemoryBackend) ListInvocations ¶
func (b *InMemoryBackend) ListInvocations() []*Invocation
ListInvocations returns all recorded invocations.
func (*InMemoryBackend) ListSessions ¶
func (b *InMemoryBackend) ListSessions() []*Session
ListSessions returns all active endpoint sessions.
func (*InMemoryBackend) RecordAsyncInvocation ¶
func (b *InMemoryBackend) RecordAsyncInvocation( endpointName, requestedID, input, outputLocation string, ) *AsyncInvocation
RecordAsyncInvocation stores accepted asynchronous inference work. If outputLocation is empty a fake S3 location is synthesised.
func (*InMemoryBackend) RecordInvocation ¶
func (b *InMemoryBackend) RecordInvocation(operation, endpointName, input, output string) *Invocation
RecordInvocation stores a completed invocation in memory.
func (*InMemoryBackend) Region ¶
func (b *InMemoryBackend) Region() string
Region returns the AWS region this backend is configured for.
func (*InMemoryBackend) Restore ¶
func (b *InMemoryBackend) Restore(ctx context.Context, data []byte) error
Restore loads backend state from a JSON snapshot. It implements persistence.Persistable.
func (*InMemoryBackend) Snapshot ¶
func (b *InMemoryBackend) Snapshot(ctx context.Context) []byte
Snapshot serialises the backend state to JSON. It implements persistence.Persistable.
func (*InMemoryBackend) StartSession ¶
func (b *InMemoryBackend) StartSession(endpointName string) *Session
StartSession creates stateful invocation session metadata.
func (*InMemoryBackend) TouchSession ¶
func (b *InMemoryBackend) TouchSession(sessionID string)
TouchSession marks an existing stateful session as invoked.
type Invocation ¶
type Invocation struct {
CreatedAt time.Time `json:"createdAt"`
EndpointName string `json:"endpointName"`
Operation string `json:"operation"`
Input string `json:"input"`
Output string `json:"output"`
}
Invocation records a single SageMaker Runtime endpoint invocation.
type Provider ¶
type Provider struct{}
Provider implements service.Provider for SageMaker Runtime.
func (*Provider) Init ¶
func (p *Provider) Init(ctx *service.AppContext) (service.Registerable, error)
Init initializes the SageMaker Runtime backend and handler.
type Session ¶
type Session struct {
CreatedAt time.Time `json:"createdAt"`
LastInvokedAt time.Time `json:"lastInvokedAt"`
ExpiresAt time.Time `json:"expiresAt"`
ID string `json:"id"`
EndpointName string `json:"endpointName"`
}
Session records a stateful endpoint session established by InvokeEndpoint.