Documentation
¶
Index ¶
- Constants
- Variables
- func CheckAll(ctx context.Context)
- func FetchMachines(ctx context.Context) error
- func HandleMachineCheck(w http.ResponseWriter, r *http.Request)
- func RegisterRouter(ctx context.Context)
- type EndpointState
- type GenerationMessage
- type GetMachinesResponse
- type ImageModels
- type Machine
- func (m *Machine) GetBackoff() time.Duration
- func (m *Machine) GetLogTags() string
- func (m *Machine) LogWithTags(ctx context.Context, msg ...string)
- func (machine *Machine) PublishStatus(sendCtx context.Context) error
- func (machine *Machine) PublishUpdate(sendCtx context.Context, msg []byte, kind string) error
- func (m *Machine) URL() string
- type MachineRequest
- type MachineResponse
- type QueuedGenerationRequest
- type QueuedImage
- type QueuedImageMetadata
- type ReadinessResponse
- type VersionReference
Constants ¶
View Source
const ( // Define a shorter duration for when no machines are available FAST_POLL_DURATION = 30 * time.Second )
Variables ¶
View Source
var ( UserMachines = make(map[string][]string) UserChecks = make(map[string]time.Time) )
View Source
var (
MachineMap = make(map[string]*Machine)
)
Functions ¶
func FetchMachines ¶
fetch updated machine list if not MACHINE_CACHE_DURATION
func HandleMachineCheck ¶
func HandleMachineCheck(w http.ResponseWriter, r *http.Request)
Handler for the /machines endpoint
func RegisterRouter ¶
RegisterRouter creates the generation queue
Types ¶
type EndpointState ¶
type EndpointState int
const ( // Machine is ready to accept new generations Ready EndpointState = iota // Machine is currently generating an image Generating // Machine is either downloading or updating the model Preparing // Machine failed to generate an image or is past max check interval Failed // Machine state has not been set yet Unknown )
Enumeration of endpoint states
func (EndpointState) MarshalJSON ¶
func (d EndpointState) MarshalJSON() ([]byte, error)
func (EndpointState) String ¶
func (d EndpointState) String() string
type GenerationMessage ¶
type GetMachinesResponse ¶
type GetMachinesResponse struct {
// contains filtered or unexported fields
}
func GetMachineList ¶
func GetMachineList(ctx context.Context, input *MachineRequest) (*GetMachinesResponse, error)
type ImageModels ¶
type ImageModels struct {
Checkpoint VersionReference `json:"checkpoint" validate:"required"`
HrCheckpoint *VersionReference `json:"hr_checkpoint"`
HrLoras []VersionReference `json:"hr_loras"`
Loras []VersionReference `json:"loras"`
Embeddings []VersionReference `json:"embeddings"`
ControlNets []VersionReference `json:"controlnets"`
}
type Machine ¶
type Machine struct {
MachineResponse
Progress float32 `json:"progress"`
EtaRelative float32 `json:"eta"`
Generation *generator.ImageDetailResponse `json:"generation"`
State EndpointState `json:"state"`
LastRequest time.Time
Failures int
// contains filtered or unexported fields
}
func FetchUserMachines ¶
func (*Machine) GetBackoff ¶
func (*Machine) GetLogTags ¶
func (*Machine) PublishStatus ¶
Machine publishes it's current state to the status exchange
func (*Machine) PublishUpdate ¶
TODO: combine with NotifyRequestor? Possibly write wrappers around different kinds to have better Message schemas. This is a bit of a mess. Not sure if it should be a method on machine or a seperate message struct with a method for publishing.
type MachineRequest ¶
type MachineRequest struct{}
type MachineResponse ¶
type MachineResponse struct {
ID string `json:"id"`
Name string `json:"name"`
Description string `json:"description"`
Endpoint string `json:"url"`
OwnerID string `json:"owner_id"`
IsPublic bool `json:"is_public"`
Enabled bool `json:"enabled"`
CreatedAt time.Time `json:"createdAt"`
UpdatedAt time.Time `json:"updatedAt"`
}
type QueuedGenerationRequest ¶
type QueuedGenerationRequest struct {
Image QueuedImage `json:"image"`
ImageMetadata QueuedImageMetadata `json:"image_metadata"`
Models ImageModels `json:"models"`
}
type QueuedImage ¶
type QueuedImageMetadata ¶
type ReadinessResponse ¶
type ReadinessResponse = struct {
Progress float32 `json:"progress"`
EtaRelative float32 `json:"eta_relative"`
}
Sends information about the state of the machine to consumers
type VersionReference ¶
type VersionReference struct {
VersionId string `json:"model_id" validate:"required,uuid"`
}
Click to show internal directories.
Click to hide internal directories.