1#!/usr/bin/env python
2# Copyright 2011 Google Inc.
3#
4# Licensed under the Apache License, Version 2.0 (the "License");
5# you may not use this file except in compliance with the License.
6# You may obtain a copy of the License at
7#
8#     http://www.apache.org/licenses/LICENSE-2.0
9#
10# Unless required by applicable law or agreed to in writing, software
11# distributed under the License is distributed on an "AS IS" BASIS,
12# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13# See the License for the specific language governing permissions and
14# limitations under the License.
15
16"""Map Reduce framework errors."""
17
18
19
20__all__ = [
21    "BadCombinerOutputError",
22    "BadParamsError",
23    "BadReaderParamsError",
24    "BadWriterParamsError",
25    "BadYamlError",
26    "Error",
27    "FailJobError",
28    "MissingYamlError",
29    "MultipleDocumentsInMrYaml",
30    "NotEnoughArgumentsError",
31    "RetrySliceError",
32    "ShuffleServiceError",
33    "InvalidRecordError",
34    ]
35
36
37class Error(Exception):
38  """Base-class for exceptions in this module."""
39
40
41class BadYamlError(Error):
42  """Raised when the mapreduce.yaml file is invalid."""
43
44
45class MissingYamlError(BadYamlError):
46  """Raised when the mapreduce.yaml file could not be found."""
47
48
49class MultipleDocumentsInMrYaml(BadYamlError):
50  """There's more than one document in mapreduce.yaml file."""
51
52
53class BadParamsError(Error):
54  """One of the mapper parameters is invalid."""
55
56
57class BadReaderParamsError(BadParamsError):
58  """The input parameters to a reader were invalid."""
59
60
61class BadWriterParamsError(BadParamsError):
62  """The input parameters to a reader were invalid."""
63
64
65class FailJobError(Error):
66  """The job will be failed if this exception is thrown anywhere."""
67
68
69class NotEnoughArgumentsError(Error):
70  """Required argument is missing."""
71
72
73class BadCombinerOutputError(Error):
74  """Combiner outputs data instead of yielding it."""
75
76
77class ShuffleServiceError(Error):
78  """Error doing shuffle through shuffle service."""
79
80
81class RetrySliceError(Error):
82  """The slice will be retried up to some maximum number of times.
83
84  The job will be failed if the slice can't progress before maximum
85  number of retries.
86  """
87
88
89class InvalidRecordError(Error):
90  """Raised when invalid record encountered."""
91