Source code for jina.excepts

"""This modules defines all kinds of exceptions raised in Jina."""

__copyright__ = "Copyright (c) 2020 Jina AI Limited. All rights reserved."
__license__ = "Apache-2.0"

[docs]class NoExplicitMessage(Exception): """Waiting until all partial messages are received."""
[docs]class ChainedPodException(Exception): """Chained exception from the last Pod."""
[docs]class MismatchedVersion(SystemError): """When the jina version info of the incoming message does not match the local Jina version."""
[docs]class ExecutorFailToLoad(SystemError): """When the executor can not be loaded in pea/pod."""
[docs]class RuntimeFailToStart(SystemError): """When pea/pod is failed to started."""
[docs]class MemoryOverHighWatermark(Exception): """When the memory usage is over the defined high water mark."""
[docs]class NoAvailablePortError(Exception): """When no available random port could be found"""
[docs]class DriverError(Exception): """Driver related exceptions."""
[docs]class RuntimeTerminated(KeyboardInterrupt): """The event loop of BasePea ends."""
[docs]class PodRunTimeError(Exception): """The error propagated by Pods when Executor throws an exception."""
[docs]class DriverNotInstalled(DriverError): """Driver is not installed in the BasePea."""
[docs]class NoDriverForRequest(DriverError): """No matched driver for this request."""
[docs]class UnattachedDriver(DriverError): """Driver is not attached to any BasePea or executor."""
[docs]class UnknownControlCommand(RuntimeError): """The control command received can not be recognized."""
[docs]class FlowTopologyError(Exception): """Flow exception when the topology is ambiguous."""
[docs]class FlowConnectivityError(Exception): """Flow exception when the flow is not connective via network."""
[docs]class FlowMissingPodError(Exception): """Flow exception when a pod can not be found in the flow."""
[docs]class FlowBuildLevelError(Exception): """Flow exception when required build level is higher than the current build level."""
[docs]class EmptyExecutorYAML(Exception): """The yaml config file is empty, nothing to read from there."""
[docs]class BadConfigSource(FileNotFoundError): """The yaml config file is bad, not loadable or not exist."""
[docs]class BadWorkspace(Exception): """Can not determine the separate storage strategy for the executor."""
[docs]class BadClient(Exception): """A wrongly defined grpc client, can not communicate with jina server correctly."""
[docs]class BadClientCallback(BadClient): """Error in the callback function on the client side."""
[docs]class BadClientInput(BadClient): """Error in the request generator function on the client side."""
[docs]class BadPersistantFile(Exception): """Bad or broken dump file that can not be deserialized with ``pickle.load``."""
[docs]class GRPCServerError(Exception): """Can not connect to the grpc gateway."""
[docs]class GatewayPartialMessage(Exception): """Gateway receives a multi-part message but it can not handle it."""
[docs]class UndefinedModel(Exception): """Any time a non-defined model is tried to be used."""
[docs]class MongoDBException(Exception): """Any errors raised by MongoDb."""
[docs]class TimedOutException(Exception): """Errors raised for timeout operations."""
[docs]class ModelCheckpointNotExist(FileNotFoundError): """Exception to raise for executors depending on pretrained model files when they do not exist."""
[docs]class PretrainedModelFileDoesNotExist(ModelCheckpointNotExist): """Depreciated, used in the hub executors. TODO: to be removed after hub executors uses ModelCheckpointNotExist """
[docs]class HubBuilderError(Exception): """Base exception to raise when :command:`jina hub build` fails."""
[docs]class HubBuilderBuildError(HubBuilderError): """Exception to raise when :command:`jina hub build` fails to build image."""
[docs]class HubBuilderTestError(HubBuilderError): """Exception to raise when :command:`jina hub build` fails to test image."""
[docs]class CompressionRateTooLow(Exception): """Compression rate is too low, no need to compression."""
[docs]class DryRunException(Exception): """Dryrun is not successful on the given flow."""
[docs]class BadDocID(Exception): """Exception when user give a non-hex string as the doc id."""
[docs]class BadDocType(TypeError): """Exception when can not construct a document from the given data."""
[docs]class BadQueryLangType(TypeError): """Exception when can not construct a query language from the given data."""
[docs]class BadRequestType(TypeError): """Exception when can not construct a request object from given data."""
[docs]class BadNamedScoreType(TypeError): """Exception when can not construct a named score from the given data."""
[docs]class LengthMismatchException(Exception): """Exception when length of two items should be identical while not."""
[docs]class ImageAlreadyExists(Exception): """Exception when an image with the name, module version, and Jina version already exists on the Hub."""
[docs]class BadImageNameError(Exception): """Exception when an image name can not be found either local & remote"""
[docs]class BadFlowYAMLVersion(Exception): """Exception when Flow YAML config specifies a wrong version number."""
[docs]class LookupyError(Exception): """Base exception class for all exceptions raised by lookupy."""
[docs]class EventLoopError(Exception): """Exception when a running event loop is found but not under jupyter or ipython."""
[docs]class ZMQSocketError(Exception): """Exception when ZMQlet/ZMQStreamlet can not be initialized."""
[docs]class HubLoginRequired(Exception): """Exception to raise for jina hub login."""
[docs]class DaemonConnectivityError(Exception): """Exception to raise when jina daemon is not connectable."""
[docs]class NotSupportedError(Exception): """Exeception when user accidentally using a retired argument."""
[docs]class RequestTypeError(Exception): """Raised when such request type does not exist."""
[docs]class ValidationError(Exception): """Raised when a certain validation cannot be completed."""
[docs]class MetricTypeError(Exception): """Raised when such metric type does not exist."""
[docs]class SocketTypeError(Exception): """Raised when such socket type is not supported or does not exist."""