-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathretraining.py
30 lines (23 loc) · 919 Bytes
/
retraining.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
from movies.model_selection import models_train
from DataCleaning.rate_preprocess import getRatingDf
from DataStreaming.kafkaPipe import getRateData
from subprocess import Popen, PIPE
import os
import timeit
p1 = Popen(['lsof', f'-ti:9092'], stdout=PIPE)
output = p1.communicate()[0]
if not output.decode():
os.system("sshpass -p seaitunnel ssh -o ServerAliveInterval=60 -L 9092:localhost:9092 [email protected] -NTf")
print("###########Getting Rate Data...########")
starttime = timeit.default_timer()
getRateData(1)
print("get rate data took: ", timeit.default_timer()-starttime)
print("Cleaning Rate data.....")
starttime = timeit.default_timer()
df = getRatingDf()
print("cleaningn data took: ", timeit.default_timer()-starttime)
print("Training model....")
starttime = timeit.default_timer()
models_train(df)
print("Trainign model took: ", timeit.default_timer()-starttime)
print("Model trained!!")