Skip to content

Commit

Permalink
fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
StpMax committed Oct 4, 2021
1 parent d441e45 commit b96136c
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 8 deletions.
1 change: 1 addition & 0 deletions mindsdb/interfaces/model/model_controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@ def learn(self, name: str, from_data: dict, to_predict: str, datasource_id: int,
p.join()
if not IS_PY36:
p.close()
db.session.refresh(predictor_record)

@mark_process(name='predict')
def predict(self, name: str, when_data: Union[dict, list, pd.DataFrame], pred_format: str, company_id: int):
Expand Down
4 changes: 2 additions & 2 deletions mindsdb/streams/stream_controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ def __init__(self, name, predictor, stream_in, stream_out, anomaly_stream=None,

self.target = p.to_predict[0]

ts_settings = p.learn_args.get('timeseries_settings', {})
if ts_settings.get('is_timeseries', False) is False:
ts_settings = p.learn_args.get('timeseries_settings')
if isinstance(ts_settings, dict) is False or len(ts_settings) == 0:
ts_settings = None

if ts_settings is None:
Expand Down
9 changes: 3 additions & 6 deletions tests/integration_tests/flows/test_redis.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ def train_ts_predictor(self, ds_name, predictor_name, with_gb=True):
"order_by": ["order"],
"nr_predictions": 1,
"use_previous_target": True,
"window": 5}
"window": 10}

if with_gb:
ts_settings["group_by"] = ["group"]
Expand Down Expand Up @@ -143,7 +143,6 @@ def test_2_create_redis_stream(self):
print(f"\nExecuting {self._testMethodName}")
self.upload_ds(DS_NAME)
self.train_predictor(DS_NAME, DEFAULT_PREDICTOR)
time.sleep(30)

url = f'{HTTP_API_ROOT}/streams/{NORMAL_STREAM_NAME}'
res = requests.put(url, json={
Expand Down Expand Up @@ -194,8 +193,7 @@ def test_5_making_ts_stream_prediction(self):
time.sleep(0.01)
time.sleep(10)

# FIXME pass
# self.assertEqual(len(list(stream_out.read())), 2)
self.assertEqual(len(list(stream_out.read())), 2)

def test_6_create_stream_redis_native_api(self):
print(f"\nExecuting {self._testMethodName}")
Expand Down Expand Up @@ -266,8 +264,7 @@ def test_9_making_ts_stream_prediction_no_group(self):
stream_in.write({'x1': x, 'x2': 2*x, 'order': x, 'y': 3 * x})
time.sleep(5)

# FIXME pass
# self.assertEqual(len(list(stream_out.read())), 2)
self.assertEqual(len(list(stream_out.read())), 2)

def test_delete_stream_http_api(self):
print(f"\nExecuting {self._testMethodName}")
Expand Down

0 comments on commit b96136c

Please sign in to comment.