Skip to content

Commit 7f6115c

Browse files
committed
Do not use colon-separated string yaml keys
1 parent 5dcb71d commit 7f6115c

File tree

7 files changed

+12
-13
lines changed

7 files changed

+12
-13
lines changed

cesium_app/handlers/dataset.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ def post(self):
3737

3838
zipfile_name = (str(uuid.uuid4()) + "_" +
3939
util.secure_filename(zipfile['name']))
40-
zipfile_path = pjoin(self.cfg['paths:upload_folder'], zipfile_name)
40+
zipfile_path = pjoin(self.cfg['paths']['upload_folder'], zipfile_name)
4141

4242
for prefix in tarball_content_types:
4343
zipfile['body'] = zipfile['body'].replace(prefix, '')
@@ -55,7 +55,7 @@ def post(self):
5555
headerfile = data['headerFile']
5656
headerfile_name = (str(uuid.uuid4()) + "_" +
5757
util.secure_filename(headerfile['name']))
58-
headerfile_path = pjoin(self.cfg['paths:upload_folder'], headerfile_name)
58+
headerfile_path = pjoin(self.cfg['paths']['upload_folder'], headerfile_name)
5959

6060
with open(headerfile_path, 'w') as f:
6161
f.write(headerfile['body'])
@@ -66,7 +66,7 @@ def post(self):
6666
p = Project.query.filter(Project.id == project_id).one()
6767
ts_paths = data_management.parse_and_store_ts_data(
6868
zipfile_path,
69-
self.cfg['paths:ts_data_folder'],
69+
self.cfg['paths']['ts_data_folder'],
7070
headerfile_path)
7171
meta_features = list(time_series.load(ts_paths[0]).meta_features.keys())
7272
unique_ts_paths = [os.path.join(os.path.dirname(ts_path),

cesium_app/handlers/feature.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ async def post(self):
9494
if not dataset.is_owned_by(self.current_user):
9595
raise AccessError('No such data set')
9696

97-
fset_path = pjoin(self.cfg['paths:features_folder'],
97+
fset_path = pjoin(self.cfg['paths']['features_folder'],
9898
'{}_featureset.npz'.format(uuid.uuid4()))
9999

100100
fset = Featureset(name=featureset_name,
@@ -161,7 +161,7 @@ def post(self):
161161
else:
162162
labels = [None]
163163
fset_path = pjoin(
164-
self.cfg['paths:features_folder'],
164+
self.cfg['paths']['features_folder'],
165165
'{}_{}.npz'.format(uuid.uuid4(), data['dataFile']['name']))
166166

167167
featurize.save_featureset(fset, fset_path, labels=labels)

cesium_app/handlers/model.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ async def post(self):
148148
model_params, params_to_optimize = check_model_param_types(model_type,
149149
model_params)
150150
model_type = model_type.split()[0]
151-
model_path = pjoin(self.cfg['paths:models_folder'],
151+
model_path = pjoin(self.cfg['paths']['models_folder'],
152152
'{}_model.pkl'.format(uuid.uuid4()))
153153

154154
model = Model(name=model_name, file_uri=model_path,

cesium_app/handlers/prediction.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ async def post(self):
6868
if (model.finished is None) or (fset.finished is None):
6969
return self.error('Computation of model or feature set still in progress')
7070

71-
pred_path = os.path.abspath(pjoin(self.cfg['paths:predictions_folder'],
71+
pred_path = os.path.abspath(pjoin(self.cfg['paths']['predictions_folder'],
7272
'{}_prediction.npz'.format(uuid.uuid4())))
7373
prediction = Prediction(file_uri=pred_path, dataset=dataset,
7474
project=dataset.project, model=model)

cesium_app/tests/conftest.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
print('Loading test configuration from test_config.yaml')
1818
basedir = pathlib.Path(os.path.dirname(__file__))/'../..'
1919
cfg = load_config([basedir/'test_config.yaml'])
20-
set_server_url(f'http://localhost:{cfg["ports:app"]}')
20+
set_server_url(f'http://localhost:{cfg["ports"]["app"]}')
2121
print('Setting test database to:', cfg['database'])
2222
models.init_db(**cfg['database'])
2323

cesium_app/tests/frontend/test_predict.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ def test_download_prediction_csv_class(driver, project, dataset, featureset,
159159
model, prediction):
160160
driver.get('/')
161161
_click_download(project.id, driver)
162-
matching_downloads_paths = glob.glob(f'{cfg["paths:downloads_folder"]}/'
162+
matching_downloads_paths = glob.glob(f'{cfg["paths"]["downloads_folder"]}/'
163163
'cesium_prediction_results*')
164164
assert len(matching_downloads_paths) == 1
165165
try:
@@ -179,7 +179,7 @@ def test_download_prediction_csv_class(driver, project, dataset, featureset,
179179
def test_download_prediction_csv_class_unlabeled(driver, project, unlabeled_prediction):
180180
driver.get('/')
181181
_click_download(project.id, driver)
182-
matching_downloads_paths = glob.glob(f'{cfg["paths:downloads_folder"]}/'
182+
matching_downloads_paths = glob.glob(f'{cfg["paths"]["downloads_folder"]}/'
183183
'cesium_prediction_results*')
184184
assert len(matching_downloads_paths) == 1
185185
try:
@@ -195,7 +195,7 @@ def test_download_prediction_csv_class_prob(driver, project, dataset,
195195
featureset, model, prediction):
196196
driver.get('/')
197197
_click_download(project.id, driver)
198-
matching_downloads_paths = glob.glob(f'{cfg["paths:downloads_folder"]}/'
198+
matching_downloads_paths = glob.glob(f'{cfg["paths"]["downloads_folder"]}/'
199199
'cesium_prediction_results*')
200200
assert len(matching_downloads_paths) == 1
201201
try:
@@ -217,7 +217,7 @@ def test_download_prediction_csv_regr(driver, project, dataset, featureset,
217217
model, prediction):
218218
driver.get('/')
219219
_click_download(project.id, driver)
220-
matching_downloads_paths = glob.glob(f'{cfg["paths:downloads_folder"]}/'
220+
matching_downloads_paths = glob.glob(f'{cfg["paths"]["downloads_folder"]}/'
221221
'cesium_prediction_results*')
222222
assert len(matching_downloads_paths) == 1
223223
try:

config.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ paths:
1515
features_folder: './data/extracted_features'
1616
predictions_folder: './data/predictions'
1717
ts_data_folder: './data/ts_data'
18-
1918
upload_folder: './data/uploads'
2019
custom_feature_script_folder: './data/uploads/custom_feature_scripts'
2120

0 commit comments

Comments
 (0)