kernel

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Sep 4, 2023 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func InitKernel

func InitKernel(kernelHost, kernelToken string, debugFlag bool)

Types

type ExceptionMessage

type ExceptionMessage struct {
	EName     string `json:"ename"`
	EValue    string `json:"evalue"`
	Traceback string `json:"traceback"`
}
type Header struct {
	Date     time.Time `json:"date"`
	MsgID    string    `json:"msg_id"`
	MsgType  string    `json:"msg_type"`
	Session  string    `json:"session"`
	Username string    `json:"username"`
	Version  string    `json:"version"`
}

type Kernel

type Kernel struct {
	ID string
	// contains filtered or unexported fields
}

func CreateKernel

func CreateKernel() (*Kernel, error)

func (*Kernel) Close

func (k *Kernel) Close()

func (*Kernel) ExecuteCode

func (k *Kernel) ExecuteCode(code string) ([]ResultMessage, []ExceptionMessage, error)

type Message

type Message struct {
	Buffers      []interface{}  `json:"buffers"`
	Channel      string         `json:"channel"`
	Content      map[string]any `json:"content"`
	Header       Header         `json:"header"`
	Metadata     struct{}       `json:"metadata"`
	MsgID        string         `json:"msg_id"`
	MsgType      MessageType    `json:"msg_type"`
	ParentHeader Header         `json:"parent_header"`
}

type MessageType

type MessageType string
const (
	ExecuteRequest MessageType = "execute_request"
	ExecuteResult  MessageType = "execute_result"
	ExecuteError   MessageType = "error"
	ExecuteReply   MessageType = "execute_reply"
	Stream         MessageType = "stream"
	DisplayData    MessageType = "display_data"
	Status         MessageType = "status"
)

type PreloadedKernels

type PreloadedKernels struct {
	// contains filtered or unexported fields
}

func NewPreloaded

func NewPreloaded() (*PreloadedKernels, error)

func (*PreloadedKernels) Close

func (k *PreloadedKernels) Close()

func (*PreloadedKernels) Get

func (k *PreloadedKernels) Get() (*Kernel, error)

func (*PreloadedKernels) Reset

func (k *PreloadedKernels) Reset(code string) error

type ResultMessage

type ResultMessage struct {
	Data     map[string]any
	MetaData map[string]any
	Stream   *StreamMessage
}

type StreamMessage

type StreamMessage struct {
	Name string
	Text string
}

Jump to

Keyboard shortcuts

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