kernel

package
v0.0.0-...-84acb48 Latest Latest
Warning

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

Go to latest
Published: Feb 25, 2025 License: AGPL-3.0 Imports: 29 Imported by: 0

Documentation

Index

Constants

View Source
const DELIM = "<IDS|MSG>"

Variables

View Source
var LOCAL_IPS []string
View Source
var ProtocolVersion string
View Source
var ZasperActiveKernels map[string]KernelManager
View Source
var ZasperPendingKernels map[string]KernelManager

Functions

func Cleanup

func Cleanup()

func CwdForPath

func CwdForPath(path string) string

func GetUsername

func GetUsername() string

func KernelListAPIHandler

func KernelListAPIHandler(w http.ResponseWriter, req *http.Request)

func KernelReadAPIHandler

func KernelReadAPIHandler(w http.ResponseWriter, req *http.Request)

func KillKernelById

func KillKernelById(kernelId string) error

func NotifyConnect

func NotifyConnect()

func NotifyDisconnect

func NotifyDisconnect(kernelId string)

func SetUpStateKernels

func SetUpStateKernels() map[string]KernelManager

func StartKernelManager

func StartKernelManager(kernelPath string, kernelName string, env map[string]string) string

Types

type Connection

type Connection struct {
	DataDir    string
	IP         string
	Transport  string
	KernelName string
	Context    context.Context

	HbPort      int
	ShellPort   int
	IopubPort   int
	StdinPort   int
	ControlPort int
}

connectionFileMixin

func (*Connection) ConnectControl

func (conn *Connection) ConnectControl(ctx context.Context) zmq4.Socket

func (*Connection) ConnectHb

func (conn *Connection) ConnectHb(ctx context.Context) zmq4.Socket

func (*Connection) ConnectIopub

func (conn *Connection) ConnectIopub(ctx context.Context) zmq4.Socket

func (*Connection) ConnectShell

func (conn *Connection) ConnectShell(ctx context.Context) zmq4.Socket

func (*Connection) ConnectStdin

func (conn *Connection) ConnectStdin(ctx context.Context) zmq4.Socket

type ConnectionFileData

type ConnectionFileData struct {
	Transport       string `json:"transport"`
	IP              string `json:"ip"`
	Key             string `json:"key"`
	StdinPort       int    `json:"stdin_port"`
	IopubPort       int    `json:"iopub_port"`
	ShellPort       int    `json:"shell_port"`
	HbPort          int    `json:"hb_port"`
	ControlPort     int    `json:"control_port"`
	SignatureScheme string `json:"signature_scheme"`
	KernelName      string `json:"kernel_name"`
}

type KernelManager

type KernelManager struct {
	ConnectionFile string
	OwnsKernel     bool
	ShutdownStatus bool
	AttemptedStart bool
	Ready          bool
	KernelName     string
	ControlSocket  zmq4.Socket
	CachePorts     bool
	Provisioner    provisioner.LocalProvisioner
	Kernelspec     string

	LastActivity   string
	ExecutionState string
	Connections    int

	KernelId     string
	ShuttingDown bool

	Session        KernelSession
	ConnectionInfo Connection
}

func (*KernelManager) StartKernel

func (km *KernelManager) StartKernel(kernelName string)

type KernelSession

type KernelSession struct {
	Key             string
	Pid             int
	Auth            hash.Hash
	SignatureScheme string
	CheckPid        bool
	Packer          string
	Unpacker        string
	AdaptVersion    string
	Debug           bool
	CopyThreshold   int
	// contains filtered or unexported fields
}

func (*KernelSession) Deserialize

func (ks *KernelSession) Deserialize(zmsg zmq4.Msg) []byte

func (*KernelSession) MessageFromDict

func (ks *KernelSession) MessageFromDict(value map[string]interface{}) Message

func (*KernelSession) MessageFromString

func (ks *KernelSession) MessageFromString(value string) Message

func (*KernelSession) Send

func (ks *KernelSession) Send(
	stream zmq4.Socket,
	msgOrType interface{},
	content interface{},
	parent MessageHeader,
	buffers []byte,
	track bool,
	header MessageHeader,
	metadata map[string]interface{},
) Message

func (*KernelSession) SendStreamMsg

func (ks *KernelSession) SendStreamMsg(stream zmq4.Socket, msg Message) Message

type KernelWebSocketConnection

type KernelWebSocketConnection struct {
	Conn                 *websocket.Conn
	Send                 chan []byte
	KernelId             string
	KernelManager        KernelManager
	Context              context.Context
	PollingCancel        context.CancelFunc
	Channels             map[string]zmq4.Socket
	Session              KernelSession
	IOPubWindowMsgCount  int
	IOPubWindowByteCount int
	IOPubMsgsExceeded    int
	IOPubDataExceeded    int
	IOPubWindowByteQueue []interface{}
	KernelInfoChannel    zmq4.Socket
	Subprotocol          string
	// contains filtered or unexported fields
}

func (*KernelWebSocketConnection) Connect

func (kwsConn *KernelWebSocketConnection) Connect()

func (*KernelWebSocketConnection) Prepare

func (kwsConn *KernelWebSocketConnection) Prepare(sessionId string)

func (*KernelWebSocketConnection) ReadMessagesFromClient

func (kwsConn *KernelWebSocketConnection) ReadMessagesFromClient(waiter *sync.WaitGroup)

func (*KernelWebSocketConnection) WriteMessages

func (kwsConn *KernelWebSocketConnection) WriteMessages(waiter *sync.WaitGroup)

type Message

type Message struct {
	Header       MessageHeader `json:"header"`
	ParentHeader MessageHeader `json:"parent_header"`
	MsgId        string        `json:"msg_id"`
	MsgType      string        `json:"msg_type"`
	Content      interface{}   `json:"content"`
	Buffers      []byte        `json:"buffers"`
	Metadata     interface{}   `json:"metadata"`
	Tracker      int           `json:"tracker"`
	Error        error         `json:"error"`
}

type MessageHeader

type MessageHeader struct {
	MsgID           string `json:"msg_id"`
	MsgType         string `json:"msg_type"`
	Username        string `json:"username"`
	Session         string `json:"session"`
	Date            string `json:"date"`
	ProtocolVersion string `json:"version"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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