Module livekit.agents.ipc.job_executor

Classes

class JobExecutor (*args, **kwargs)

Base class for protocol classes.

Protocol classes are defined as::

class Proto(Protocol):
    def meth(self) -> int:
        ...

Such classes are primarily used with static type checkers that recognize structural subtyping (static duck-typing).

For example::

class C:
    def meth(self) -> int:
        return 0

def func(x: Proto) -> int:
    return x.meth()

func(C())  # Passes static type check

See PEP 544 for details. Protocol classes decorated with @typing.runtime_checkable act as simple-minded runtime protocols that check only the presence of given attributes, ignoring their type signatures. Protocol classes can be generic, they are defined as::

class GenProto[T](Protocol):
    def meth(self) -> T:
        ...
Expand source code
class JobExecutor(Protocol):
    @property
    def started(self) -> bool: ...

    @property
    def start_arguments(self) -> Any | None: ...

    @start_arguments.setter
    def start_arguments(self, value: Any | None) -> None: ...

    @property
    def running_job(self) -> RunningJobInfo | None: ...

    @property
    def run_status(self) -> RunStatus: ...

    @property
    def exception(self) -> Exception | None: ...

    async def start(self) -> None: ...

    async def join(self) -> None: ...

    async def initialize(self) -> None: ...

    async def aclose(self) -> None: ...

    async def launch_job(self, info: RunningJobInfo) -> None: ...

Ancestors

  • typing.Protocol
  • typing.Generic

Instance variables

prop exception : Exception | None
Expand source code
@property
def exception(self) -> Exception | None: ...
prop run_statusRunStatus
Expand source code
@property
def run_status(self) -> RunStatus: ...
prop running_job : RunningJobInfo | None
Expand source code
@property
def running_job(self) -> RunningJobInfo | None: ...
prop start_arguments : Any | None
Expand source code
@property
def start_arguments(self) -> Any | None: ...
prop started : bool
Expand source code
@property
def started(self) -> bool: ...

Methods

async def aclose(self) ‑> None
async def initialize(self) ‑> None
async def join(self) ‑> None
async def launch_job(self, info: RunningJobInfo) ‑> None
async def start(self) ‑> None
class JobExecutorError (*args, **kwargs)

Common base class for all non-exit exceptions.

Expand source code
class JobExecutorError(Exception):
    pass

Ancestors

  • builtins.Exception
  • builtins.BaseException

Subclasses

class JobExecutorError_Runtime (*args, **kwargs)

Common base class for all non-exit exceptions.

Expand source code
class JobExecutorError_Runtime(JobExecutorError):
    pass

Ancestors

class JobExecutorError_ShutdownTimeout (*args, **kwargs)

Common base class for all non-exit exceptions.

Expand source code
class JobExecutorError_ShutdownTimeout(JobExecutorError):
    pass

Ancestors

class JobExecutorError_Unresponsive (*args, **kwargs)

Common base class for all non-exit exceptions.

Expand source code
class JobExecutorError_Unresponsive(JobExecutorError):
    pass

Ancestors

class RunStatus (*args, **kwds)

Create a collection of name/value pairs.

Example enumeration:

>>> class Color(Enum):
...     RED = 1
...     BLUE = 2
...     GREEN = 3

Access them by:

  • attribute access:

Color.RED

  • value lookup:

Color(1)

  • name lookup:

Color['RED']

Enumerations can be iterated over, and know how many members they have:

>>> len(Color)
3
>>> list(Color)
[<Color.RED: 1>, <Color.BLUE: 2>, <Color.GREEN: 3>]

Methods can be added to enumerations, and members can have their own attributes – see the documentation for details.

Expand source code
class RunStatus(Enum):
    STARTING = "STARTING"
    WAITING_FOR_JOB = "WAITING_FOR_JOB"
    RUNNING_JOB = "RUNNING_JOB"
    FINISHED_FAILED = "FINISHED_FAILED"
    FINISHED_CLEAN = "FINISHED_CLEAN"

Ancestors

  • enum.Enum

Class variables

var FINISHED_CLEAN
var FINISHED_FAILED
var RUNNING_JOB
var STARTING
var WAITING_FOR_JOB