3 # Copyright 2007 Google Inc.
5 # Licensed under the Apache License, Version 2.0 (the "License");
6 # you may not use this file except in compliance with the License.
7 # You may obtain a copy of the License at
9 # http://www.apache.org/licenses/LICENSE-2.0
11 # Unless required by applicable law or agreed to in writing, software
12 # distributed under the License is distributed on an "AS IS" BASIS,
13 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 # See the License for the specific language governing permissions and
15 # limitations under the License.
17 """Parameters to control Mapreduce."""
19 __all__
= ["CONFIG_NAMESPACE",
22 from google
.appengine
.api
import lib_config
24 CONFIG_NAMESPACE
= "mapreduce"
27 class _ConfigDefaults(object):
30 Do not change parameters whose names begin with _.
32 SHARD_MAX_ATTEMPTS: Max attempts to execute a shard before giving up.
34 TASK_MAX_ATTEMPTS: Max attempts to execute a task before dropping it. Task
35 is any taskqueue task created by MR framework. A task is dropped
36 when its X-AppEngine-TaskExecutionCount is bigger than this number.
37 Dropping a task will cause abort on the entire MR job.
39 TASK_MAX_DATA_PROCESSING_ATTEMPTS:
40 Max times to execute a task when previous task attempts failed during
41 data processing stage. An MR work task has three major stages:
42 initial setup, data processing, and final checkpoint.
43 Setup stage should be allowed to be retried more times than data processing
44 stage: setup failures are caused by unavailable GAE services while
45 data processing failures are mostly due to user function error out on
46 certain input data. Thus, set TASK_MAX_ATTEMPTS higher than this parameter.
48 QUEUE_NAME: Default queue for MR.
50 SHARD_COUNT: Default shard count.
52 PROCESSING_RATE_PER_SEC: Default rate of processed entities per second.
54 BASE_PATH : Base path of mapreduce and pipeline handlers.
57 SHARD_MAX_ATTEMPTS
= 4
60 TASK_MAX_ATTEMPTS
= 31
62 TASK_MAX_DATA_PROCESSING_ATTEMPTS
= 11
64 QUEUE_NAME
= "default"
69 PROCESSING_RATE_PER_SEC
= 1000000
72 BASE_PATH
= "/_ah/mapreduce"
77 _SLICE_DURATION_SEC
= 15
80 _LEASE_GRACE_PERIOD
= 1
83 _REQUEST_EVENTUAL_TIMEOUT
= 10 * 60 + 30
86 _CONTROLLER_PERIOD_SEC
= 2
89 config
= lib_config
.register(CONFIG_NAMESPACE
, _ConfigDefaults
.__dict
__)
95 _DEFAULT_PIPELINE_BASE_PATH
= config
.BASE_PATH
+ "/pipeline"
97 _GCS_URLFETCH_TIMEOUT_SEC
= 30