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 ProviderError(EphemeralAWSError): """General provider error.""" pass
[docs] class ProviderConfigurationError(ProviderError): """Error in provider configuration.""" pass
[docs] class AWSConnectionError(ProviderError): """Error connecting to AWS services.""" pass
[docs] class AWSAuthenticationError(AWSConnectionError): """AWS authentication failure.""" pass
[docs] class ResourceCreationError(ProviderError): """Error creating AWS resources.""" pass
[docs] class ResourceDeletionError(ProviderError): """Error deleting AWS resources.""" pass
[docs] class ResourceCleanupError(ResourceDeletionError): """Error cleaning up AWS resources.""" pass
[docs] class ResourceNotFoundError(ProviderError): """Requested AWS resource not found.""" pass
[docs] class ConfigurationError(ProviderConfigurationError): """Error in provider configuration.""" pass
[docs] class JobSubmissionError(ProviderError): """Error submitting job for execution.""" pass
[docs] class StateStoreError(ProviderError): """Error in state store operations.""" pass
[docs] class StateError(StateStoreError): """General state management error - alias for compatibility.""" pass
[docs] class StateSerializationError(StateStoreError): """Error serializing state data.""" pass
[docs] class StateDeserializationError(StateStoreError): """Error deserializing state data.""" pass
[docs] class JobExecutionError(ProviderError): """Error executing a job.""" pass
[docs] class JobCancellationError(ProviderError): """Error cancelling a job.""" pass
[docs] class NetworkCreationError(ResourceCreationError): """Error creating network resources.""" pass
[docs] class SecurityGroupError(ResourceCreationError): """Error managing security groups.""" pass
[docs] class EC2InstanceError(ResourceCreationError): """Error managing EC2 instances.""" pass
[docs] class LambdaFunctionError(ResourceCreationError): """Error managing Lambda functions.""" pass
[docs] class ECSTaskError(ResourceCreationError): """Error managing ECS tasks.""" pass
[docs] class BastionHostError(ResourceCreationError): """Error managing bastion hosts.""" pass
[docs] class SpotInstanceError(EC2InstanceError): """Error managing spot instances.""" pass
[docs] class SpotFleetError(EC2InstanceError): """Error managing EC2 Spot Fleet.""" 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 OperatingModeError(ProviderError): """Error in operating mode functionality.""" pass
[docs] class CloudFormationError(ResourceCreationError): """Error in CloudFormation stack operations.""" pass
[docs] class TaskTimeoutError(JobExecutionError): """Task execution timeout.""" 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
[docs] class TaggingError(ProviderError): """Error tagging AWS resources.""" pass
[docs] class CleanupError(ProviderError): """Error cleaning up resources.""" pass
[docs] class AMINotFoundError(ResourceCreationError): """Specified AMI not found.""" pass