Skip to content

executor

Classes

fastvideo.worker.executor.Executor

Executor(fastvideo_args: FastVideoArgs)

Bases: ABC

Source code in fastvideo/worker/executor.py
def __init__(self, fastvideo_args: FastVideoArgs):
    self.fastvideo_args = fastvideo_args

    self._init_executor()

Functions

fastvideo.worker.executor.Executor.collective_rpc abstractmethod
collective_rpc(method: str | Callable[..., _R], timeout: float | None = None, args: tuple = (), kwargs: dict[str, Any] | None = None) -> list[_R]

Execute an RPC call on all workers.

Parameters:

Name Type Description Default
method str | Callable[..., _R]

Name of the worker method to execute, or a callable that is serialized and sent to all workers to execute.

If the method is a callable, it should accept an additional self argument, in addition to the arguments passed in args and kwargs. The self argument will be the worker object.

required
timeout float | None

Maximum time in seconds to wait for execution. Raises a :exc:TimeoutError on timeout. None means wait indefinitely.

None
args tuple

Positional arguments to pass to the worker method.

()
kwargs dict[str, Any] | None

Keyword arguments to pass to the worker method.

None

Returns:

Type Description
list[_R]

A list containing the results from each worker.

Note

It is recommended to use this API to only pass control messages, and set up data-plane communication to pass data.

Source code in fastvideo/worker/executor.py
@abstractmethod
def collective_rpc(self,
                   method: str | Callable[..., _R],
                   timeout: float | None = None,
                   args: tuple = (),
                   kwargs: dict[str, Any] | None = None) -> list[_R]:
    """
    Execute an RPC call on all workers.

    Args:
        method: Name of the worker method to execute, or a callable that
            is serialized and sent to all workers to execute.

            If the method is a callable, it should accept an additional
            `self` argument, in addition to the arguments passed in `args`
            and `kwargs`. The `self` argument will be the worker object.
        timeout: Maximum time in seconds to wait for execution. Raises a
            :exc:`TimeoutError` on timeout. `None` means wait indefinitely.
        args: Positional arguments to pass to the worker method.
        kwargs: Keyword arguments to pass to the worker method.

    Returns:
        A list containing the results from each worker.

    Note:
        It is recommended to use this API to only pass control messages,
        and set up data-plane communication to pass data.
    """
    raise NotImplementedError
fastvideo.worker.executor.Executor.merge_lora_weights abstractmethod
merge_lora_weights() -> None

Merge the LoRA weights for the workers.

Source code in fastvideo/worker/executor.py
@abstractmethod
def merge_lora_weights(self) -> None:
    """
    Merge the LoRA weights for the workers.
    """
    raise NotImplementedError
fastvideo.worker.executor.Executor.set_lora_adapter abstractmethod
set_lora_adapter(lora_nickname: str, lora_path: str | None = None) -> None

Set the LoRA adapter for the workers.

Source code in fastvideo/worker/executor.py
@abstractmethod
def set_lora_adapter(self,
                     lora_nickname: str,
                     lora_path: str | None = None) -> None:
    """
    Set the LoRA adapter for the workers.
    """
    raise NotImplementedError
fastvideo.worker.executor.Executor.shutdown abstractmethod
shutdown() -> None

Shutdown the executor.

Source code in fastvideo/worker/executor.py
@abstractmethod
def shutdown(self) -> None:
    """
    Shutdown the executor.
    """
    raise NotImplementedError
fastvideo.worker.executor.Executor.unmerge_lora_weights abstractmethod
unmerge_lora_weights() -> None

Unmerge the LoRA weights for the workers.

Source code in fastvideo/worker/executor.py
@abstractmethod
def unmerge_lora_weights(self) -> None:
    """
    Unmerge the LoRA weights for the workers.
    """
    raise NotImplementedError

Functions