forked from feast-dev/feast
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconstants.py
More file actions
274 lines (195 loc) · 8.58 KB
/
constants.py
File metadata and controls
274 lines (195 loc) · 8.58 KB
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
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
#
# Copyright 2019 The Feast Authors
#
# 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
#
# https://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.
#
from enum import Enum
from typing import Optional
class AuthProvider(Enum):
GOOGLE = "google"
OAUTH = "oauth"
class Option:
def __init__(self, name, default):
self._name = name
self._default = default
def __get__(self, instance, owner):
if instance is None:
return self._name.lower()
return self._default
class ConfigMeta(type):
"""
Class factory which customizes ConfigOptions class instantiation.
Specifically, setting configuration option's name to lowercase of capitalized variable.
"""
def __new__(cls, name, bases, attrs):
keys = [
k for k, v in attrs.items() if not k.startswith("_") and not callable(v)
]
attrs["__config_keys__"] = keys
attrs.update({k: Option(k, attrs[k]) for k in keys})
return super().__new__(cls, name, bases, attrs)
#: Default datetime column name for point-in-time join
DATETIME_COLUMN: str = "datetime"
#: Environmental variable to specify Feast configuration file location
FEAST_CONFIG_FILE_ENV: str = "FEAST_CONFIG"
#: Default prefix to Feast environmental variables
CONFIG_FEAST_ENV_VAR_PREFIX: str = "FEAST_"
#: Default directory to Feast configuration file
CONFIG_FILE_DEFAULT_DIRECTORY: str = ".feast"
#: Default Feast configuration file name
CONFIG_FILE_NAME: str = "config"
#: Default section in Feast configuration file to specify options
CONFIG_FILE_SECTION: str = "general"
# Maximum interval(secs) to wait between retries for retry function
MAX_WAIT_INTERVAL: str = "60"
class ConfigOptions(metaclass=ConfigMeta):
""" Feast Configuration Options """
#: Feast project namespace to use
PROJECT: str = "default"
#: Default Feast Core URL
CORE_URL: str = "localhost:6565"
#: Enable or disable TLS/SSL to Feast Core
CORE_ENABLE_SSL: str = "False"
#: Enable user authentication to Feast Core
ENABLE_AUTH: str = "False"
#: JWT Auth token for user authentication to Feast
AUTH_TOKEN: Optional[str] = None
#: Path to certificate(s) to secure connection to Feast Core
CORE_SERVER_SSL_CERT: str = ""
#: Default Feast Serving URL
SERVING_URL: str = "localhost:6566"
#: Enable or disable TLS/SSL to Feast Serving
SERVING_ENABLE_SSL: str = "False"
#: Path to certificate(s) to secure connection to Feast Serving
SERVING_SERVER_SSL_CERT: str = ""
#: Default Feast Job Service URL
JOB_SERVICE_URL: Optional[str] = None
#: Enable or disable TLS/SSL to Feast Job Service
JOB_SERVICE_ENABLE_SSL: str = "False"
#: Path to certificate(s) to secure connection to Feast Job Service
JOB_SERVICE_SERVER_SSL_CERT: str = ""
#: Enable or disable control loop for Feast Job Service
JOB_SERVICE_ENABLE_CONTROL_LOOP: str = "False"
#: Default connection timeout to Feast Serving, Feast Core, and Feast Job Service (in seconds)
GRPC_CONNECTION_TIMEOUT: str = "10"
#: Default gRPC connection timeout when sending an ApplyFeatureTable command to Feast Core (in seconds)
GRPC_CONNECTION_TIMEOUT_APPLY: str = "600"
#: Default timeout when running batch ingestion
BATCH_INGESTION_PRODUCTION_TIMEOUT: str = "120"
#: Time to wait for historical feature requests before timing out.
BATCH_FEATURE_REQUEST_WAIT_TIME_SECONDS: str = "600"
#: Endpoint URL for S3 storage_client
S3_ENDPOINT_URL: Optional[str] = None
#: Account name for Azure blob storage_client
AZURE_BLOB_ACCOUNT_NAME: Optional[str] = None
#: Account access key for Azure blob storage_client
AZURE_BLOB_ACCOUNT_ACCESS_KEY: Optional[str] = None
#: Authentication Provider - Google OpenID/OAuth
#:
#: Options: "google" / "oauth"
AUTH_PROVIDER: str = "google"
#: Spark Job launcher. The choice of storage is connected to the choice of SPARK_LAUNCHER.
#:
#: Options: "standalone", "dataproc", "emr"
SPARK_LAUNCHER: Optional[str] = None
#: Feast Spark Job ingestion jobs staging location. The choice of storage is connected to the choice of SPARK_LAUNCHER.
#:
#: Eg. gs://some-bucket/output/, s3://some-bucket/output/, file:///data/subfolder/
SPARK_STAGING_LOCATION: Optional[str] = None
#: Feast Spark Job ingestion jar file. The choice of storage is connected to the choice of SPARK_LAUNCHER.
#:
#: Eg. "dataproc" (http and gs), "emr" (http and s3), "standalone" (http and file)
SPARK_INGESTION_JAR: str = "https://storage.googleapis.com/feast-jobs/spark/ingestion/feast-ingestion-spark-develop.jar"
#: Spark resource manager master url
SPARK_STANDALONE_MASTER: str = "local[*]"
#: Directory where Spark is installed
SPARK_HOME: Optional[str] = None
#: The project id where the materialized view of BigQuerySource is going to be created
#: by default, use the same project where view is located
SPARK_BQ_MATERIALIZATION_PROJECT: Optional[str] = None
#: The dataset id where the materialized view of BigQuerySource is going to be created
#: by default, use the same dataset where view is located
SPARK_BQ_MATERIALIZATION_DATASET: Optional[str] = None
#: Dataproc cluster to run Feast Spark Jobs in
DATAPROC_CLUSTER_NAME: Optional[str] = None
#: Project of Dataproc cluster
DATAPROC_PROJECT: Optional[str] = None
#: Region of Dataproc cluster
DATAPROC_REGION: Optional[str] = None
#: No. of executor instances for Dataproc cluster
DATAPROC_EXECUTOR_INSTANCES = "2"
#: No. of executor cores for Dataproc cluster
DATAPROC_EXECUTOR_CORES = "2"
#: No. of executor memory for Dataproc cluster
DATAPROC_EXECUTOR_MEMORY = "2g"
# namespace to use for Spark jobs launched using k8s spark operator
SPARK_K8S_NAMESPACE = "default"
# expect k8s spark operator to be running in the same cluster as Feast
SPARK_K8S_USE_INCLUSTER_CONFIG = "True"
# SparkApplication resource template
# Eg. '/home/jovyan/work/sparkapp-template.yaml'
SPARK_K8S_JOB_TEMPLATE_PATH = None
#: File format of historical retrieval features
HISTORICAL_FEATURE_OUTPUT_FORMAT: str = "parquet"
#: File location of historical retrieval features
HISTORICAL_FEATURE_OUTPUT_LOCATION: Optional[str] = None
#: Default Redis host
REDIS_HOST: str = "localhost"
#: Default Redis port
REDIS_PORT: str = "6379"
#: Enable or disable TLS/SSL to Redis
REDIS_SSL: str = "False"
#: Enable or disable StatsD
STATSD_ENABLED: str = "False"
#: Default StatsD port
STATSD_HOST: Optional[str] = None
#: Default StatsD port
STATSD_PORT: Optional[str] = None
#: Ingestion Job DeadLetter Destination. The choice of storage is connected to the choice of SPARK_LAUNCHER.
#:
#: Eg. gs://some-bucket/output/, s3://some-bucket/output/, file:///data/subfolder/
DEADLETTER_PATH: str = ""
#: ProtoRegistry Address (currently only Stencil Server is supported as registry)
#: https://github.com/gojekfarm/stencil
STENCIL_URL: str = ""
#: If set to true rows that do not pass custom validation (see feast.contrib.validation)
#: won't be saved to Online Storage
INGESTION_DROP_INVALID_ROWS = "False"
#: EMR cluster to run Feast Spark Jobs in
EMR_CLUSTER_ID: Optional[str] = None
#: Region of EMR cluster
EMR_REGION: Optional[str] = None
#: Template path of EMR cluster
EMR_CLUSTER_TEMPLATE_PATH: Optional[str] = None
#: Log path of EMR cluster
EMR_LOG_LOCATION: Optional[str] = None
#: Oauth grant type
OAUTH_GRANT_TYPE: Optional[str] = None
#: Oauth client ID
OAUTH_CLIENT_ID: Optional[str] = None
#: Oauth client secret
OAUTH_CLIENT_SECRET: Optional[str] = None
#: Oauth intended recipients
OAUTH_AUDIENCE: Optional[str] = None
#: Oauth token request url
OAUTH_TOKEN_REQUEST_URL: Optional[str] = None
#: Usage enabled
USAGE = "True"
#: Object store registry
REGISTRY_PATH: Optional[str] = None
def defaults(self):
return {
k: getattr(self, k)
for k in self.__config_keys__
if getattr(self, k) is not None
}