Skip to content
v0.1.3

Process Module API Reference

This section documents the internals of the process module in Bijux CLI.

bijux_cli.contracts.process

Defines the contract for a worker process pool service.

This module specifies the ProcessPoolProtocol, a formal interface that any service managing a pool of worker processes for command execution must implement. This allows for abstracting the details of subprocess management.

ProcessPoolProtocol

Bases: Protocol

Defines the contract for a worker process pool.

This interface specifies the methods for running commands in isolated worker processes and managing the lifecycle of the pool.

get_status

get_status() -> dict[str, Any]

Returns the current status of the process pool.

Returns:

  • dict[str, Any]

    dict[str, Any]: A dictionary containing status information, such as the number of active workers, queue size, etc.

Source code in src/bijux_cli/contracts/process.py
def get_status(self) -> dict[str, Any]:
    """Returns the current status of the process pool.

    Returns:
        dict[str, Any]: A dictionary containing status information, such as
            the number of active workers, queue size, etc.
    """
    ...

run

run(
    cmd: list[str], *, executor: str
) -> tuple[int, bytes, bytes]

Executes a command in a worker process.

Parameters:

  • cmd (list[str]) –

    A list of command arguments to execute.

  • executor (str) –

    The name or identifier of the executor to use.

Returns:

  • tuple[int, bytes, bytes]

    tuple[int, bytes, bytes]: A tuple containing the return code, standard output (stdout), and standard error (stderr) as bytes.

Source code in src/bijux_cli/contracts/process.py
def run(self, cmd: list[str], *, executor: str) -> tuple[int, bytes, bytes]:
    """Executes a command in a worker process.

    Args:
        cmd (list[str]): A list of command arguments to execute.
        executor (str): The name or identifier of the executor to use.

    Returns:
        tuple[int, bytes, bytes]: A tuple containing the return code,
            standard output (stdout), and standard error (stderr) as bytes.
    """
    ...

shutdown

shutdown() -> None

Shuts down the process pool and releases all associated resources.

Source code in src/bijux_cli/contracts/process.py
def shutdown(self) -> None:
    """Shuts down the process pool and releases all associated resources."""
    ...