Source code for rucio.common.exception

# Copyright European Organization for Nuclear Research (CERN)
#
# Licensed under the Apache License, Version 2.0 (the "License");
# You may not use this file except in compliance with the License.
# You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
#
# Authors:
# - Thomas Beermann, <thomas.beermann@cern.ch> , 2012
# - Angelos Molfetas, <angelos.molfetas@cern,ch>, 2012
# - Mario Lassnig, <mario.lassnig@cern.ch>, 2012, 2014
# - Vincent Garonne, <vincent.garonne@cern.ch>, 2011-2013
# - Ralph Vigne, <ralph.vigne@cern.ch>, 2012-2013
# - Martin Barisits, <martin.barisits@cern.ch>, 2012-2015
# - Cedric Serfon, <cedric.serfon@cern.ch>, 2013-2015
# - Wen Guan, <wen.guan@cern.ch>, 2014


"""Exceptions used with Rucio.

The base exception class is :class:`. RucioException`.
Exceptions which are raised are all subclasses of it.

"""

from rucio.common.constraints import AUTHORIZED_VALUE_TYPES


[docs]class RucioException(Exception): """ To correctly use this class, inherit from it and define a 'message' property. That message will get printf'd with the keyword arguments provided to the constructor. """ def __init__(self, *args, **kwargs): self._message = "An unknown exception occurred." self.args = args self.kwargs = kwargs def __str__(self): try: self._error_string = self._message % self.kwargs except Exception: # at least get the core message out if something happened self._error_string = self._message if len(self.args) > 0: # If there is a non-kwarg parameter, assume it's the error # message or reason description and tack it on to the end # of the exception message # Convert all arguments into their string representations... args = ["%s" % arg for arg in self.args if arg] self._error_string = (self._error_string + "\nDetails: %s" % '\n'.join(args)) return self._error_string.strip() # Please insert new exceptions in alphabetic order
[docs]class AccessDenied(RucioException): def __init__(self, *args, **kwargs): super(AccessDenied, self).__init__(args, kwargs) self._message = "Access to the requested resource denied."
[docs]class AccountNotFound(RucioException): def __init__(self, *args, **kwargs): super(AccountNotFound, self).__init__(args, kwargs) self._message = "Account does not exist."
[docs]class CannotAuthenticate(RucioException): def __init__(self, *args, **kwargs): super(CannotAuthenticate, self).__init__(args, kwargs) self._message = "Cannot authenticate."
[docs]class ClientParameterMismatch(RucioException): def __init__(self, *args, **kwargs): super(ClientParameterMismatch, self).__init__(args, kwargs) self._message = "Client parameters don\'t match."
[docs]class ClientProtocolNotSupported(RucioException): def __init__(self, *args, **kwargs): super(ClientProtocolNotSupported, self).__init__(args, kwargs) self._message = "Client protocol not supported."
[docs]class ConfigNotFound(RucioException): def __init__(self, *args, **kwargs): super(ConfigNotFound, self).__init__(args, kwargs) self._message = "Configuration not found."
[docs]class ConfigurationError(RucioException): def __init__(self, *args, **kwargs): super(ConfigurationError, self).__init__(args, kwargs) self._message = "Error during configuration."
[docs]class CounterNotFound(RucioException): def __init__(self, *args, **kwargs): super(CounterNotFound, self).__init__(args, kwargs) self._message = "The requested counter does not exist."
[docs]class DatabaseException(RucioException): def __init__(self, *args, **kwargs): super(DatabaseException, self).__init__(args, kwargs) self._message = "Database exception."
[docs]class DatasetAccessDenied(RucioException): def __init__(self, *args, **kwargs): super(DatasetAccessDenied, self).__init__(args, kwargs) self._message = "Access to Referenced dataset denied."
[docs]class DatasetAlreadyExists(RucioException): def __init__(self, *args, **kwargs): super(DatasetAlreadyExists, self).__init__(args, kwargs) self._message = "Dataset name in specified scope already exists"
[docs]class DatabaseMigrationError(RucioException): def __init__(self, *args, **kwargs): super(DatabaseMigrationError, self).__init__(args, kwargs) self._message = "Error when migrating the database."
[docs]class DataIdentifierAlreadyExists(RucioException): def __init__(self, *args, **kwargs): super(DataIdentifierAlreadyExists, self).__init__(args, kwargs) self._message = "Data Identifier Already Exists."
[docs]class DataIdentifierNotFound(RucioException): def __init__(self, *args, **kwargs): super(DataIdentifierNotFound, self).__init__(args, kwargs) self._message = "Data identifier not found."
[docs]class DatasetIsMonotonic(RucioException): def __init__(self, *args, **kwargs): super(DatasetIsMonotonic, self).__init__(args, kwargs) self._message = "Dataset is monotonic"
[docs]class DatasetNotFound(RucioException): def __init__(self, *args, **kwargs): super(DatasetNotFound, self).__init__(args, kwargs) self._message = "Dataset not found in scope"
[docs]class DatasetObsolete(RucioException): def __init__(self, *args, **kwargs): super(DatasetObsolete, self).__init__(args, kwargs) self._message = "Dataset is obsolete"
[docs]class DestinationNotAccessible(RucioException): def __init__(self, *args, **kwargs): super(DestinationNotAccessible, self).__init__(args, kwargs) self._message = "Access to local destination denied."
[docs]class Duplicate(RucioException): def __init__(self, *args, **kwargs): super(Duplicate, self).__init__(args, kwargs) self._message = "An object with the same identifier already exists."
[docs]class DuplicateContent(RucioException): def __init__(self, *args, **kwargs): super(DuplicateContent, self).__init__(args, kwargs) self._message = "Data identifier already added to the destination content."
[docs]class DuplicateRule(RucioException): def __init__(self, *args, **kwargs): super(DuplicateRule, self).__init__(args, kwargs) self._message = "A duplicate rule for this account, did, rse_expression, copies already exists."
[docs]class ErrorLoadingCredentials(RucioException): def __init__(self, *args, **kwargs): super(ErrorLoadingCredentials, self).__init__(args, kwargs) self._message = "Unable to to load user credentials."
[docs]class FileAlreadyExists(RucioException): def __init__(self, *args, **kwargs): super(FileAlreadyExists, self).__init__(args, kwargs) self._message = "The file already exists."
[docs]class FileAssociationsRemain(RucioException): def __init__(self, *args, **kwargs): super(FileAssociationsRemain, self).__init__(args, kwargs) self._message = "Dataset has file associations"
[docs]class FileConsistencyMismatch(RucioException): def __init__(self, *args, **kwargs): super(FileConsistencyMismatch, self).__init__(args, kwargs) self._message = "Error related to file consistency."
[docs]class FileNotFound(RucioException): def __init__(self, *args, **kwargs): super(FileNotFound, self).__init__(args, kwargs) self._message = "File not found in scope"
[docs]class FileObsolete(RucioException): def __init__(self, *args, **kwargs): super(FileObsolete, self).__init__(args, kwargs) self._message = "File is obsolete"
[docs]class FileReplicaAlreadyExists(RucioException): def __init__(self, *args, **kwargs): super(FileReplicaAlreadyExists, self).__init__(args, kwargs) self._message = "File name in specified scope already exists"
[docs]class ReplicaNotFound(RucioException): def __init__(self, *args, **kwargs): super(ReplicaNotFound, self).__init__(args, kwargs) self._message = "Replica not found"
[docs]class ReplicaUnAvailable(RucioException): def __init__(self, *args, **kwargs): super(ReplicaUnAvailable, self).__init__(args, kwargs) self._message = "Replica unavailable"
[docs]class ForbiddenSearch(RucioException): def __init__(self, *args, **kwargs): super(ForbiddenSearch, self).__init__(args, kwargs) self._message = "Wildcard search too broad"
[docs]class FullStorage(RucioException): def __init__(self, *args, **kwargs): super(FullStorage, self).__init__(args, kwargs) self._message = "The Referenced storage is out of disk space."
[docs]class IdentityError(RucioException): def __init__(self, *args, **kwargs): super(IdentityError, self).__init__(args, kwargs) self._message = "Identity error."
[docs]class InputValidationError(RucioException): def __init__(self, *args, **kwargs): super(InputValidationError, self).__init__(args, kwargs) self._message = "There is an error with one of the input parameters."
[docs]class InsufficientAccountLimit(RucioException): def __init__(self, *args, **kwargs): super(InsufficientAccountLimit, self).__init__(args, kwargs) self._message = "There is not enough space left to fulfil the operation."
[docs]class InsufficientTargetRSEs(RucioException): def __init__(self, *args, **kwargs): super(InsufficientTargetRSEs, self).__init__(args, kwargs) self._message = "There are not enough target RSEs to fulfil the request at this time."
[docs]class InvalidMetadata(RucioException): def __init__(self, *args, **kwargs): super(InvalidMetadata, self).__init__(args, kwargs) self._message = "Provided metadata is considered invalid."
[docs]class InvalidObject(RucioException): def __init__(self, *args, **kwargs): super(InvalidObject, self).__init__(args, kwargs) self._message = "Provided object does not match schema."
[docs]class InvalidReplicaLock(RucioException): def __init__(self, *args, **kwargs): super(InvalidReplicaLock, self).__init__(args, kwargs) self._message = "Provided replica lock is considered invalid."
[docs]class InvalidReplicationRule(RucioException): def __init__(self, *args, **kwargs): super(InvalidReplicationRule, self).__init__(args, kwargs) self._message = "Provided replication rule is considered invalid."
[docs]class InvalidRSEExpression(RucioException): def __init__(self, *args, **kwargs): super(InvalidRSEExpression, self).__init__(args, kwargs) self._message = "Provided RSE expression is considered invalid."
[docs]class InvalidRuleWeight(RucioException): def __init__(self, *args, **kwargs): super(InvalidRuleWeight, self).__init__(args, kwargs) self._message = "An invalid weight value/type is used for an RSE."
[docs]class InvalidType(RucioException): def __init__(self, *args, **kwargs): super(InvalidType, self).__init__(args, kwargs) self._message = "Provided type is considered invalid."
[docs]class InvalidValueForKey(RucioException): def __init__(self, *args, **kwargs): super(InvalidValueForKey, self).__init__(args, kwargs) self._message = "Invalid value for the key."
[docs]class KeyNotFound(RucioException): def __init__(self, *args, **kwargs): super(KeyNotFound, self).__init__(args, kwargs) self._message = "Key does not exist."
[docs]class MissingClientParameter(RucioException): def __init__(self, *args, **kwargs): super(MissingClientParameter, self).__init__(args, kwargs) self._message = "Client parameters are missing."
[docs]class MissingFileParameter(RucioException): def __init__(self, *args, **kwargs): super(MissingFileParameter, self).__init__(args, kwargs) self._message = "File parameter is missing."
[docs]class MissingSourceReplica(RucioException): def __init__(self, *args, **kwargs): super(MissingSourceReplica, self).__init__(args, kwargs) self._message = "Source replicas are missing to fulfil the request at this moment."
[docs]class NameTypeError(RucioException): def __init__(self, *args, **kwargs): super(NameTypeError, self).__init__(args, kwargs) self._message = "Name is of the wrong type"
[docs]class NoAuthInformation(RucioException): def __init__(self, *args, **kwargs): super(NoAuthInformation, self).__init__(args, kwargs) self._message = "No authentication information passed."
[docs]class NoPermissions(RucioException): def __init__(self, *args, **kwargs): super(NoPermissions, self).__init__(args, kwargs) self._message = "User does not have necessary permissions to perform operation."
[docs]class NotADataset(RucioException): def __init__(self, *args, **kwargs): super(NotADataset, self).__init__(args, kwargs) self._message = 'Specified name is not a dataset'
[docs]class NotAFile(RucioException): def __init__(self, *args, **kwargs): super(NotAFile, self).__init__(args, kwargs) self._message = 'Specified name is not a file'
[docs]class ReplicationRuleCreationTemporaryFailed(RucioException): def __init__(self, *args, **kwargs): super(ReplicationRuleCreationTemporaryFailed, self).__init__(args, kwargs) self._message = "The creation of the replication rule failed at this time. Please try again later."
[docs]class RSEAccessDenied(RucioException): def __init__(self, *args, **kwargs): super(RSEAccessDenied, self).__init__(args, kwargs) self._message = "Referenced RSE not reachable."
[docs]class RSEBlacklisted(RucioException): def __init__(self, *args, **kwargs): super(RSEBlacklisted, self).__init__(args, kwargs) self._message = "RSE excluded due to write blacklisting."
[docs]class RSENotConnected(RucioException): def __init__(self, *args, **kwargs): super(RSENotConnected, self).__init__(args, kwargs) self._message = "Connection to RSE not established."
[docs]class RSENotFound(RucioException): def __init__(self, *args, **kwargs): super(RSENotFound, self).__init__(args, kwargs) self._message = "RSE does not exist."
[docs]class RSEProtocolNotSupported(RucioException): def __init__(self, *args, **kwargs): super(RSEProtocolNotSupported, self).__init__(args, kwargs) self._message = "RSE does not support requested protocol."
[docs]class RSEProtocolPriorityError(RucioException): def __init__(self, *args, **kwargs): super(RSEProtocolPriorityError, self).__init__(args, kwargs) self._message = "RSE does not support provided protocol priority for protocol."
[docs]class RSEProtocolDomainNotSupported(RucioException): def __init__(self, *args, **kwargs): super(RSEProtocolDomainNotSupported, self).__init__(args, kwargs) self._message = "RSE does not support requested protocol scope."
[docs]class RSEOperationNotSupported(RucioException): def __init__(self, *args, **kwargs): super(RSEOperationNotSupported, self).__init__(args, kwargs) self._message = "RSE does not support requested operation."
[docs]class RSEFileNameNotSupported(RucioException): def __init__(self, *args, **kwargs): super(RSEFileNameNotSupported, self).__init__(args, kwargs) self._message = "RSE does not support provided filename."
[docs]class RSEOverQuota(RucioException): def __init__(self, *args, **kwargs): super(RSEOverQuota, self).__init__(args, kwargs) self._message = "Quota of Referenced RSE is exceeded."
[docs]class RSETagNotFound(RucioException): def __init__(self, *args, **kwargs): super(RSETagNotFound, self).__init__(args, kwargs) self._message = "RSE Tag does not exist."
[docs]class ResourceTemporaryUnavailable(RucioException): def __init__(self, *args, **kwargs): super(ResourceTemporaryUnavailable, self).__init__(args, kwargs) self._message = "The resource is temporary not available."
[docs]class RuleNotFound(RucioException): def __init__(self, *args, **kwargs): super(RuleNotFound, self).__init__(args, kwargs) self._message = "No replication rule found."
[docs]class RuleReplaceFailed(RucioException): def __init__(self, *args, **kwargs): super(RuleReplaceFailed, self).__init__(args, kwargs) self._message = "The replace operation for the rule failed."
[docs]class ServiceUnavailable(RucioException): def __init__(self, *args, **kwargs): super(ServiceUnavailable, self).__init__(args, kwargs) self._message = "The requested service is not available at the moment."
[docs]class ScopeAccessDenied(RucioException): def __init__(self, *args, **kwargs): super(ScopeAccessDenied, self).__init__(args, kwargs) self._message = "Access to Referenced scope denied."
[docs]class ScopeNotFound(RucioException): def __init__(self, *args, **kwargs): super(ScopeNotFound, self).__init__(args, kwargs) self._message = "Scope does not exist."
[docs]class SourceAccessDenied(RucioException): def __init__(self, *args, **kwargs): super(SourceAccessDenied, self).__init__(args, kwargs) self._message = "Access to local source file denied."
[docs]class SourceNotFound(RucioException): def __init__(self, *args, **kwargs): super(SourceNotFound, self).__init__(args, kwargs) self._message = "Source file not found."
[docs]class StagingAreaRuleRequiresLifetime(RucioException): def __init__(self, *args, **kwargs): super(StagingAreaRuleRequiresLifetime, self).__init__(args, kwargs) self._message = "A rule involving a staging area requires a lifetime!"
[docs]class SubscriptionDuplicate(RucioException): def __init__(self, *args, **kwargs): super(SubscriptionDuplicate, self).__init__(args, kwargs) self._message = "A subscription with the same identifier already exists."
[docs]class SubscriptionNotFound(RucioException): def __init__(self, *args, **kwargs): super(SubscriptionNotFound, self).__init__(args, kwargs) self._message = "Subscription not found."
[docs]class UnsupportedOperation(RucioException): def __init__(self, *args, **kwargs): super(UnsupportedOperation, self).__init__(args, kwargs) self._message = "The resource doesn't support the requested operation."
[docs]class UnsupportedStatus(RucioException): def __init__(self, *args, **kwargs): super(UnsupportedStatus, self).__init__(args, kwargs) self._message = "Unsupported data identifier status."
[docs]class UnsupportedValueType(RucioException): def __init__(self, *args, **kwargs): super(UnsupportedValueType, self).__init__(args, kwargs) self._message = "Unsupported type for the value. List of supported types: %s." % str(AUTHORIZED_VALUE_TYPES)
Rucio logo