Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BatchClient ¶
type BatchClient struct {
// contains filtered or unexported fields
}
func NewBatchClient ¶
func NewBatchClient(name string) (*BatchClient, error)
func (*BatchClient) Name ¶
func (s *BatchClient) Name() string
type BatchClientIn ¶
type BatchClientIn interface {
// Name returns the Job name.
Name() string
// Submit will submit the provided request to the job.
Submit(ctx context.Context, data map[string]interface{}) error
}
Batch
type Ctx ¶
type Ctx struct {
Request Request
Response *Response
Extras map[string]interface{}
// contains filtered or unexported fields
}
func NewCtx ¶
func NewCtx(msg *batchpb.ServerMessage) *Ctx
func (*Ctx) ToClientMessage ¶
func (c *Ctx) ToClientMessage() *batchpb.ClientMessage
type HandlerOption ¶
type HandlerOption func(opts *handlerOptions)
func WithCpus ¶
func WithCpus(cpus float32) HandlerOption
WithCpus - Set the number of CPUs/vCPUs to allocate to job handler instances
func WithGpus ¶
func WithGpus(gpus int64) HandlerOption
WithGpus - Set the number of GPUs to allocate to job handler instances
func WithMemory ¶
func WithMemory(mib int64) HandlerOption
WithMemory - Set the amount of memory in MiB to allocate to job handler instances
type JobPermission ¶
type JobPermission string
JobPermission defines the available permissions on a job
const ( // JobSubmit is required to call Submit on a job. JobSubmit JobPermission = "submit" )
type JobReference ¶
type JobReference interface {
// Allow requests the given permissions to the job.
Allow(permission JobPermission, permissions ...JobPermission) *BatchClient
// Handler will register and start the job task handler that will be called for all task submitted to this job.
// Valid function signatures for middleware are:
//
// func()
// func() error
// func(*batch.Ctx)
// func(*batch.Ctx) error
// Handler[batch.Ctx]
Handler(handler interface{}, options ...HandlerOption)
}
func NewJob ¶
func NewJob(name string) JobReference
NewJob creates a new job resource with the give name.
Click to show internal directories.
Click to hide internal directories.