Skip to content

proxystore.endpoint.config

Endpoint configuration.

EndpointRelayAuthConfig

Bases: BaseModel

Endpoint relay server authentication configuration.

Attributes:

  • method (Optional[Literal['globus']]) –

    Relay server authentication method.

  • kwargs (Dict[str, Any]) –

    Arbitrary options used by the authentication method.

EndpointRelayConfig

Bases: BaseModel

Endpoint relay server configuration.

Attributes:

  • address (Optional[str]) –

    Address of the relay server to register with.

  • auth (EndpointRelayAuthConfig) –

    Relay server authentication configuration.

  • peer_channels (int) –

    Number of peer channels to multiplex communication over.

  • verify_certificates (int) –

    Validate the relay server's SSL certificate. This should only be disabled when testing endpoint with local relay servers using self-signed certificates.

EndpointStorageConfig

Bases: BaseModel

Endpoint data storage configuration.

Attributes:

  • database_path (Optional[str]) –

    Optional path to SQLite database file that will be used for storing endpoint data. If None, data will only be stored in-memory.

  • max_object_size (Optional[int]) –

    Optional maximum object size.

EndpointConfig

Bases: BaseModel

Endpoint configuration.

Attributes:

  • name (str) –

    Endpoint name.

  • uuid (str) –

    Endpoint UUID.

  • host (Optional[str]) –

    Host endpoint is running on.

  • port (int) –

    Port endpoint is running on.

  • peering (int) –

    Peering configuration.

  • storage (EndpointStorageConfig) –

    Storage configuration.

Raises:

  • ValueError

    If the name does not contain only alphanumeric, dash, or underscore characters, if the UUID cannot be parsed, or if the port is not in the range [1, 65535].

get_configs

get_configs(proxystore_dir: str) -> list[EndpointConfig]

Get all valid endpoint configurations in parent directory.

Parameters:

  • proxystore_dir (str) –

    Parent directory containing possible endpoint configurations.

Returns:

Source code in proxystore/endpoint/config.py
def get_configs(proxystore_dir: str) -> list[EndpointConfig]:
    """Get all valid endpoint configurations in parent directory.

    Args:
        proxystore_dir: Parent directory containing possible endpoint
            configurations.

    Returns:
        List of found configs.
    """
    endpoints: list[EndpointConfig] = []

    if not os.path.isdir(proxystore_dir):
        return endpoints

    for dirpath, _, _ in os.walk(proxystore_dir):
        if os.path.samefile(proxystore_dir, dirpath):
            continue
        try:
            cfg = read_config(dirpath)
        except FileNotFoundError:
            continue
        except ValueError:
            continue
        else:
            endpoints.append(cfg)

    return endpoints

get_log_filepath

get_log_filepath(endpoint_dir: str) -> str

Return path to log file for endpoint.

Parameters:

  • endpoint_dir (str) –

    Directory for the endpoint.

Returns:

  • str

    Path to log file.

Source code in proxystore/endpoint/config.py
def get_log_filepath(endpoint_dir: str) -> str:
    """Return path to log file for endpoint.

    Args:
        endpoint_dir: Directory for the endpoint.

    Returns:
        Path to log file.
    """
    return os.path.join(endpoint_dir, ENDPOINT_LOG_FILE)

get_pid_filepath

get_pid_filepath(endpoint_dir: str) -> str

Return path to PID file for endpoint.

Parameters:

  • endpoint_dir (str) –

    Directory for the endpoint.

Returns:

  • str

    Path to PID file.

Source code in proxystore/endpoint/config.py
def get_pid_filepath(endpoint_dir: str) -> str:
    """Return path to PID file for endpoint.

    Args:
        endpoint_dir: Directory for the endpoint.

    Returns:
        Path to PID file.
    """
    return os.path.join(endpoint_dir, ENDPOINT_PID_FILE)

read_config

read_config(endpoint_dir: str) -> EndpointConfig

Read endpoint config file.

Parameters:

  • endpoint_dir (str) –

    Directory containing endpoint configuration file.

Returns:

Raises:

  • FileNotFoundError

    If a config files does not exist in the directory.

  • ValueError

    If config contains an invalid value or cannot be parsed.

Source code in proxystore/endpoint/config.py
def read_config(endpoint_dir: str) -> EndpointConfig:
    """Read endpoint config file.

    Args:
        endpoint_dir: Directory containing endpoint configuration file.

    Returns:
        Config found in `endpoint_dir`.

    Raises:
        FileNotFoundError: If a config files does not exist in the directory.
        ValueError: If config contains an invalid value or cannot be parsed.
    """
    path = os.path.join(endpoint_dir, ENDPOINT_CONFIG_FILE)

    if os.path.exists(path):
        with open(path, 'rb') as f:
            try:
                return load(EndpointConfig, f)
            except Exception as e:
                raise ValueError(
                    f'Unable to parse ({path}): {e!s}.',
                ) from None
    else:
        raise FileNotFoundError(
            f'Endpoint directory {endpoint_dir} does not contain a valid '
            'configuration.',
        )

validate_name

validate_name(name: str) -> bool

Validate name only contains alphanumeric or dash/underscore chars.

Source code in proxystore/endpoint/config.py
def validate_name(name: str) -> bool:
    """Validate name only contains alphanumeric or dash/underscore chars."""
    return len(re.findall(r'[^A-Za-z0-9_\-]', name)) == 0 and len(name) > 0

write_config

write_config(
    cfg: EndpointConfig, endpoint_dir: str
) -> None

Write config to endpoint directory.

Parameters:

  • cfg (EndpointConfig) –

    Configuration to write.

  • endpoint_dir (str) –

    Directory to write config to.

Source code in proxystore/endpoint/config.py
def write_config(cfg: EndpointConfig, endpoint_dir: str) -> None:
    """Write config to endpoint directory.

    Args:
        cfg: Configuration to write.
        endpoint_dir: Directory to write config to.
    """
    os.makedirs(endpoint_dir, exist_ok=True)
    path = os.path.join(endpoint_dir, ENDPOINT_CONFIG_FILE)
    with open(path, 'wb') as f:
        dump(cfg, f)