Source code for parsl_ephemeral_provider.exceptions
"""
Custom exceptions for the EphemeralProvider.
SPDX-License-Identifier: Apache-2.0
SPDX-FileCopyrightText: 2025-2026 Scott Friedman and Project Contributors
"""
from botocore.exceptions import NoCredentialsError as _BotoNoCredentialsError
[docs]
class CredentialResolutionError(_BotoNoCredentialsError):
"""No usable AWS credentials could be resolved, with a reason.
botocore's ``NoCredentialsError`` derives from ``BotoCoreError``, whose
``__init__`` accepts **keyword arguments only** and formats them into a
fixed class-level ``fmt`` — so ``NoCredentialsError("why")`` raises
``TypeError: BotoCoreError.__init__() takes 1 positional argument but 2
were given`` and the reason never reaches the caller. Every raise site in
``security/credential_manager.py`` did exactly that, turning each of the
seven distinct credential failures into the same opaque ``TypeError``.
Subclassing keeps ``except NoCredentialsError`` handlers working —
``compute/{ec2,ecs,lambda_func,spot_fleet}.py`` and
``error_handling.py:269`` all catch the botocore class and must continue to
— while allowing the message through.
"""
fmt = "{message}"
def __init__(self, message: str) -> None:
super().__init__(message=message)
[docs]
class EphemeralAWSError(Exception):
"""Base class for all EphemeralProvider exceptions."""
pass
[docs]
class ResourceCleanupError(ResourceDeletionError):
"""Error cleaning up AWS resources."""
pass
[docs]
class ConfigurationError(ProviderConfigurationError):
"""Error in provider configuration."""
pass
[docs]
class StateError(StateStoreError):
"""General state management error - alias for compatibility."""
pass
[docs]
class NetworkCreationError(ResourceCreationError):
"""Error creating network resources."""
pass
[docs]
class LambdaFunctionError(ResourceCreationError):
"""Error managing Lambda functions."""
pass
[docs]
class SpotFleetRequestError(SpotFleetError):
"""Error creating or managing Spot Fleet requests."""
pass
[docs]
class SpotFleetThrottlingError(SpotFleetError):
"""AWS API throttling for Spot Fleet operations."""
def __init__(
self,
message="AWS Spot Fleet API request was throttled",
operation=None,
retry_after=None,
):
self.operation = operation
self.retry_after = retry_after
super().__init__(message)
[docs]
class CloudFormationError(ResourceCreationError):
"""Error in CloudFormation stack operations."""
pass
[docs]
class SpotInterruptionError(SpotInstanceError):
"""Error related to spot instance interruption."""
pass
[docs]
class InvalidStateError(ProviderError):
"""Provider is in an invalid state for the requested operation."""
pass