1818
1919import click
2020import pkg_resources
21- import toml
2221import yaml
2322
24- from feast import config as feast_config
2523from feast .client import Client
24+ from feast .config import Config
2625from feast .feature_set import FeatureSet
2726from feast .loaders .yaml import yaml_loader
2827
@@ -64,14 +63,7 @@ def version(client_only: bool, **kwargs):
6463 }
6564
6665 if not client_only :
67- feast_client = Client (
68- core_url = feast_config .get_config_property_or_fail (
69- "core_url" , force_config = kwargs
70- ),
71- serving_url = feast_config .get_config_property_or_fail (
72- "serving_url" , force_config = kwargs
73- ),
74- )
66+ feast_client = Client (** kwargs )
7567 feast_versions_dict .update (feast_client .version ())
7668
7769 print (json .dumps (feast_versions_dict ))
@@ -94,13 +86,8 @@ def config_list():
9486 """
9587 List Feast properties for the currently active configuration
9688 """
97-
9889 try :
99- feast_config_string = toml .dumps (feast_config ._get_or_create_config ())
100- if not feast_config_string .strip ():
101- print ("Configuration has not been set" )
102- else :
103- print (feast_config_string .replace ('""' , "" ).strip ())
90+ print (Config ())
10491 except Exception as e :
10592 _logger .error ("Error occurred when reading Feast configuration file" )
10693 _logger .exception (e )
@@ -115,7 +102,9 @@ def config_set(prop, value):
115102 Set a Feast properties for the currently active configuration
116103 """
117104 try :
118- feast_config .set_property (prop .strip (), value .strip ())
105+ conf = Config ()
106+ conf .set (option = prop .strip (), value = value .strip ())
107+ conf .save ()
119108 except Exception as e :
120109 _logger .error ("Error in reading config file" )
121110 _logger .exception (e )
@@ -135,9 +124,7 @@ def feature_set_list():
135124 """
136125 List all feature sets
137126 """
138- feast_client = Client (
139- core_url = feast_config .get_config_property_or_fail ("core_url" )
140- ) # type: Client
127+ feast_client = Client () # type: Client
141128
142129 table = []
143130 for fs in feast_client .list_feature_sets ():
@@ -161,11 +148,7 @@ def feature_set_create(filename):
161148 """
162149
163150 feature_sets = [FeatureSet .from_dict (fs_dict ) for fs_dict in yaml_loader (filename )]
164-
165- feast_client = Client (
166- core_url = feast_config .get_config_property_or_fail ("core_url" )
167- ) # type: Client
168-
151+ feast_client = Client () # type: Client
169152 feast_client .apply (feature_sets )
170153
171154
@@ -176,10 +159,7 @@ def feature_set_describe(name: str, version: int):
176159 """
177160 Describe a feature set
178161 """
179- feast_client = Client (
180- core_url = feast_config .get_config_property_or_fail ("core_url" )
181- ) # type: Client
182-
162+ feast_client = Client () # type: Client
183163 fs = feast_client .get_feature_set (name = name , version = version )
184164 if not fs :
185165 print (
@@ -204,9 +184,7 @@ def project_create(name: str):
204184 """
205185 Create a project
206186 """
207- feast_client = Client (
208- core_url = feast_config .get_config_property_or_fail ("core_url" )
209- ) # type: Client
187+ feast_client = Client () # type: Client
210188 feast_client .create_project (name )
211189
212190
@@ -216,9 +194,7 @@ def project_archive(name: str):
216194 """
217195 Archive a project
218196 """
219- feast_client = Client (
220- core_url = feast_config .get_config_property_or_fail ("core_url" )
221- ) # type: Client
197+ feast_client = Client () # type: Client
222198 feast_client .archive_project (name )
223199
224200
@@ -227,9 +203,7 @@ def project_list():
227203 """
228204 List all projects
229205 """
230- feast_client = Client (
231- core_url = feast_config .get_config_property_or_fail ("core_url" )
232- ) # type: Client
206+ feast_client = Client () # type: Client
233207
234208 table = []
235209 for project in feast_client .list_projects ():
@@ -265,10 +239,7 @@ def ingest(name, version, filename, file_type):
265239 Ingest feature data into a feature set
266240 """
267241
268- feast_client = Client (
269- core_url = feast_config .get_config_property_or_fail ("core_url" )
270- ) # type: Client
271-
242+ feast_client = Client () # type: Client
272243 feature_set = feast_client .get_feature_set (name = name , version = version )
273244 feature_set .ingest_file (file_path = filename )
274245
0 commit comments