python

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Aug 8, 2024 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ContextAwareMutex

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

func NewContextAwareMutex

func NewContextAwareMutex() *ContextAwareMutex

func (*ContextAwareMutex) AssertLocked

func (c *ContextAwareMutex) AssertLocked()

func (*ContextAwareMutex) Lock

func (c *ContextAwareMutex) Lock() error

func (*ContextAwareMutex) LockWithContext

func (c *ContextAwareMutex) LockWithContext(ctx context.Context) error

func (*ContextAwareMutex) Unlock

func (c *ContextAwareMutex) Unlock()

type InterpreterTicket

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

func (*InterpreterTicket) Id

func (i *InterpreterTicket) Id() int64

type MultiInterpreterRuntime

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

MultiInterpreterRuntime creates and manages multiple Python sub-interpreters.

func NewMultiInterpreterRuntime

func NewMultiInterpreterRuntime(exe string, cnt int, legacyMode bool, logger *service.Logger) (*MultiInterpreterRuntime, error)

func (*MultiInterpreterRuntime) Acquire

func (*MultiInterpreterRuntime) Apply

func (r *MultiInterpreterRuntime) Apply(token *InterpreterTicket, _ context.Context, f func() error) error

func (*MultiInterpreterRuntime) Map

Map a function fn over all the interpreters, one at a time. Useful for initializing all interpreters to a given state.

func (*MultiInterpreterRuntime) Release

func (r *MultiInterpreterRuntime) Release(token *InterpreterTicket) error

func (*MultiInterpreterRuntime) Start

Start the Python runtime. A MultiInterpreterRuntime centralizes modification of the main interpreter in a go routine.

func (*MultiInterpreterRuntime) Stop

Stop a running Python Runtime.

type Runtime

type Runtime interface {
	// Start the Python runtime.
	Start(ctx context.Context) error

	// Stop the Python runtime, removing all interpreter state.
	Stop(ctx context.Context) error

	// Acquire ownership of an interpreter until Release is called.
	Acquire(ctx context.Context) (token *InterpreterTicket, err error)

	// Release ownership of an interpreter identified by the given
	// InterpreterTicket.
	Release(token *InterpreterTicket) error

	// Apply a function f over the interpreter described by the given
	// InterpreterTicket.
	Apply(token *InterpreterTicket, ctx context.Context, f func() error) error

	// Map a function f over the interpreter or interpreters.
	// In the case of multiple interpreters, an error aborts mapping over the
	// rest.
	Map(ctx context.Context, f func(token *InterpreterTicket) error) error
}

type SingleInterpreterRuntime

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

func NewSingleInterpreterRuntime

func NewSingleInterpreterRuntime(exe string, logger *service.Logger) (*SingleInterpreterRuntime, error)

func (*SingleInterpreterRuntime) Acquire

func (*SingleInterpreterRuntime) Apply

func (r *SingleInterpreterRuntime) Apply(ticket *InterpreterTicket, _ context.Context, f func() error) error

func (*SingleInterpreterRuntime) Map

func (*SingleInterpreterRuntime) Release

func (r *SingleInterpreterRuntime) Release(ticket *InterpreterTicket) error

func (*SingleInterpreterRuntime) Start

func (*SingleInterpreterRuntime) Stop

Jump to

Keyboard shortcuts

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