Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
class InvalidUsage(FatalError):
"""
Raised when a command is not provided all required arguments on
the command line, or the arguments do not match the expected
syntax.
Since the exception message is the last thing a user will see,
try to be specific about what is wrong on the command line.
"""
pass
class LoadError(Error):
"""
Raised upon errors loading a job from the persistent storage.
"""
pass
class LRMSError(Error):
pass
class LRMSSubmitError(LRMSError):
pass
class LRMSSkipSubmissionToNextIteration(LRMSSubmitError, RecoverableError):
Exceptions indicating an error condition after which the program
cannot continue and should immediately stop, should use the
`FatalError`:class: base class.
"""
def __init__(self, msg, do_log=False):
if do_log:
gc3libs.log.error(msg)
Exception.__init__(self, msg)
# mark errors as "Recoverable" (meaning that a retry a ta later time
# could succeed), or "Unrecoverable" (meaning there's no point in
# retrying).
class RecoverableError(Error):
"""
Used to mark transient errors: retrying the same action at a later
time could succeed.
This exception should *never* be instanciated: it is only to be used
in `except` clauses to catch "try again" situations.
"""
pass
class UnrecoverableError(Error):
"""
Used to mark permanent errors: there's no point in retrying the same
action at a later time, because it will yield the same error again.
"""
Raised when the configuration file cannot be read (e.g., does not
exist or has wrong permissions).
"""
pass
class NoValidConfigurationFile(NoConfigurationFile):
"""
Raised when the configuration file cannot be parsed (e.g., is
malformed).
"""
pass
class NoResources(Error):
"""
Raised to signal that no resources are defined, or that none are
compatible with the request.
"""
# FIXME: should we have a separate `NoCompatibleResources` exception?
pass
class OutputNotAvailableError(InvalidOperation):
"""
Raised upon attempts to retrieve the output for jobs that are
still in `NEW` or `SUBMITTED` state.
"""
pass
Since the exception message is the last thing a user will see,
try to be specific about what is wrong on the command line.
"""
pass
class LoadError(Error):
"""
Raised upon errors loading a job from the persistent storage.
"""
pass
class LRMSError(Error):
pass
class LRMSSubmitError(LRMSError):
pass
class LRMSSkipSubmissionToNextIteration(LRMSSubmitError, RecoverableError):
"""
An elastic resource has initiated adapting for a new task.
Although we cannot submit the task right now, it *will* be
accepted in the (not too distant) future.
"""
pass
A specialization of`InvalidArgument` for cases when the type of
the passed argument does not match expectations.
"""
pass
class DuplicateEntryError(InvalidArgument):
"""
Raised by `Application.__init__` if not all (local or remote)
entries in the input or output files are distinct.
"""
pass
class InvalidOperation(Error):
"""
Raised when an operation is attempted, that is not considered
valid according to the system state. For instance, trying to
retrieve the output of a job that has not yet been submitted.
"""
pass
class InvalidResourceName(Error, ValueError):
"""
Raised to signal that no computational resource with the given
name is defined in the configuration file.
Raising this exception will automatically log its message at ERROR
Raised when problems with copying data to or from the remote
execution site occurred.
"""
pass
class InputFileError(FatalError):
"""
Raised when an input file is specified, which does not exist or
cannot be read.
"""
pass
class InternalError(Error, AssertionError):
"""
Raised when some function cannot fulfill its duties, for reasons
that do not depend on the library client code. For instance, when
a response string gotten from an external command cannot be parsed
as expected.
"""
pass
class AuxiliaryCommandError(InternalError):
"""
Raised when some external command that we depend upon has failed.
For instance, we might need to list processes on a remote machine
TransportError.__init__(
self,
"Could not copy '%s' to '%s': %s: %s"
% (source, destination, ex.__class__.__name__, str(ex)))
class UnknownJob(Error, ValueError):
"""
Raised when an operation is attempted on a task, which is
unknown to the remote server or backend.
"""
pass
class UnknownJobState(Error, AssertionError):
"""
Raised when a job state is gotten from the Grid middleware, that
is not handled by the GC3Libs code. Might actually mean that
there is a version mismatch between GC3Libs and the Grid
middleware used.
"""
pass
class ApplicationDescriptionError(FatalError):
"""
Raised when the dumped description on a given Application produces
something that the LRMS backend cannot process.
The message is sent to the logs at CRITICAL level
when the exception is first constructed.
This is the base class for all fatal exceptions.
"""
def __init__(self, msg, do_log=True):
if do_log:
gc3libs.log.critical(msg)
Exception.__init__(self, msg)
# derived exceptions
class AuthError(Error):
"""
Base class for Auth-related errors.
Should *never* be instanciated: create a specific error class
describing the actual error condition.
"""
pass
class RecoverableAuthError(AuthError, RecoverableError):
pass
class UnrecoverableAuthError(AuthError, UnrecoverableError):
pass
Raised when a method (other than :meth:`attach`) is called on
a detached `Task` instance.
"""
pass
class UnexpectedStateError(TaskError):
"""
Raised by :meth:`Task.progress` when a job lands in `STOPPED`
or `TERMINATED` state.
"""
pass
class TransportError(Error):
pass
class RecoverableTransportError(RecoverableError):
pass
class UnrecoverableTransportError(UnrecoverableError):
pass
class CopyError(TransportError):
"""
Error copying a file from `source` to `destination.
"""
class UnrecoverableAuthError(AuthError, UnrecoverableError):
pass
class ConfigurationError(FatalError):
"""
Raised when the configuration file (or parts of it) could not be
read/parsed. Also used to signal that a required parameter is
missing or has an unknown/invalid value.
"""
pass
class DataStagingError(Error):
"""
Base class for data staging and movement errors.
Should *never* be instanciated: create a specific error class
describing the actual error condition.
"""
pass
class RecoverableDataStagingError(DataStagingError, RecoverableError):
"""
Raised when transient problems with copying data to or from the
remote execution site occurred.