This repository has been archived by the owner on Apr 25, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 274
/
Copy pathconfig.py
155 lines (134 loc) · 5.87 KB
/
config.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
# Copyright 2013 Google Inc
#
# 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
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""
This is the labqueue configuration file. It contains various settings
which allow the customization of the system's behavior.
"""
import os
import datetime
# This is the worker GUID used to signify topics, tasks, etc. which
# were created internally by this system (as opposed to, say, a
# sketchbot connecting over the REST interface).
#
API_WORKER_GUID = 'api.openweblab'
# This setting specifies the maximum size of a file which can be POSTed
# directly to the binary storage section of the queue. Any content which
# exceeds this amount must be uploaded to a special dynamic URL generated by
# the server. Such URLs must be requested from the server just prior to
# uploading the content.
MAX_DIRECT_UPLOAD_FILE_SIZE_BYTES = 800000
# If ALLOW_UNAUTHENTICATED_USE_WITH_WARNING is True, the server will
# allow connection from sketchbots, etc. without any kind of security
# or authorization. In that case, the server will complain with a
# warning, but allow such requests to proceed.
#
# If it is False, then the server will require an authorization header
# with pre-shared security key to be included with all requests.
#
ALLOW_UNAUTHENTICATED_USE_WITH_WARNING = True
# The HELP_TEMPLATES_PATH and ADMIN_TEMPLATES_PATH settings should point
# to the location of the template source files used to render online API
# help and browser-based admin UI.
#
HELP_TEMPLATES_PATH = os.path.join(os.path.dirname(__file__), 'templates', 'help' )
ADMIN_TEMPLATES_PATH = os.path.join(os.path.dirname(__file__), 'templates', 'admin' )
# If LDCS_ONLY_EDITABLE_BY_ORIGINAL_CREATOR is True, then an LDC can only
# be modified by the same worker that created it. If False, then any worker
# can edit any LDC.
#
LDCS_ONLY_EDITABLE_BY_ORIGINAL_CREATOR = False
# The number of seconds a Task reservation will be held before being
# automatically released by the system.
#
TASK_RESERVATION_MAX_HOLD_TIME_SEC = 500
# If True, then Topics with task policies using a 'max_num_tasks'
# rule will get max_num_tasks new 'slots' each hour for new Tasks,
# even if the Tasks from the previous hour have not been completed.
# If False, then the topic will have an absolute cap at 'max_num_tasks'
# so that Tasks must be completed for new ones to get in."
#
TASK_POLICY_MAX_NUM_TASKS_USES_SLOT_MODE = False
# Records are kept to check the last time the system was contacted
# by a particular worker. Set DISABLE_WORKER_STATUS_WRITES to silently
# disable updates to these records. This can be useful for debugging
# or reducing the number of datastore writes.
#
DISABLE_WORKER_STATUS_WRITES = False
# The minimum time between allowed worker status updates, in seconds.
# If a worker tries to update its own status less than MIN_WORKER_STATUS_UPDATE_PERIOD_SEC
# since its last update the server will return an error. This is used
# to prevent over-active workers from gobbling up app engine quota.
# To reduce quota use, set this to a higher number (or better yet, make
# your robots check in less frequently).
#
MIN_WORKER_STATUS_UPDATE_PERIOD_SEC = 5
# When listing the recent status of all workers that have contacted
# the system, ANCIENT_WORKER_STATUS_CUTOFF_DAYS can be used to automatically
# filter out old entries. If non-None, then this should indicate the
# maximum age of a workrer before they are dropped from status lists.
# Even ancient workers can have their status queried via directly
# requesting that single worker's status.
#
ANCIENT_WORKER_STATUS_CUTOFF_DAYS = None # 10
# This is the canonical list of valid touchpoint names. A touchpoint
# is a grouping of closely-related interactive exhibit pieces.
#
VALID_TOUCHPOINT_NAMES = [
'rob',
]
# This is the canonical list of valid activity space names. An activity
# space is a logical grouping of touchpoints.
#
VALID_ACTIVITY_SPACES = [
'www',
]
# If HTTP_RAISE_EXCEPTIONS_IN_REQUESTS is True, the RESTful HTTP interface
# will allow any Exceptions encountered in the labqueue code to bubble up
# as true Python Exceptions. This will cause any Exception-generating request
# to respond as HTTP status 500. That will potentially obscure any bugs from
# users connecting via HTTP, in exchange for allowing the system to be debugged
# via a live debugger. If it is False, however, the Exceptions will be caught
# and (hopefully) userful error responses will be returned over HTTP, with
# appropriate status codes.
#
HTTP_RAISE_EXCEPTIONS_IN_REQUESTS = False
# If HTTP_HELP is True, then a built-in human interface to the RESTful API
# will be accessible by appending ?HELP=GET (to try out GET requests) or
# ?HELP=POST (for POST requests) to any API URL.
#
HTTP_HELP = True
LDC_THUMBNAIL_PARAMS = {
'small': {
'all': {
'max_source_height': None,
'min_source_height': None,
'max_source_width': None,
'min_source_width': None,
'width': 140,
'height': 110,
'overlay_path': None,
'valign': 'middle',
# these are good for robot portraits:
'top_crop_pct': None,
'bottom_crop_pct': None,
'left_crop_pct': None,
'right_crop_pct': None,
'crop_x': None,
'crop_y': None,
'post_crop_uniform_scale_pct': None,
},
},
}
# The number of seconds to allow edge cache to hold LDC public media content
PUBLIC_MEDIA_CACHE_MAX_AGE_SEC = 61