Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
students
eue
Commits
e55ec4f0
Commit
e55ec4f0
authored
May 26, 2021
by
KangMin An
Browse files
Update : 데이터 처리 예약 작업 - 파일 경로 문제 수정.
parent
770773aa
Changes
3
Show whitespace changes
Inline
Side-by-side
server/src/data_processing/main.py
View file @
e55ec4f0
...
@@ -22,7 +22,7 @@ def storeParameters(link, filename, data):
...
@@ -22,7 +22,7 @@ def storeParameters(link, filename, data):
time_dir
=
'/'
+
year
+
'/'
+
year
+
month
+
'/'
+
year
+
month
+
day
time_dir
=
'/'
+
year
+
'/'
+
year
+
month
+
'/'
+
year
+
month
+
day
file_dir
=
getcwd
()
+
'/server'
+
link
+
time_dir
+
filename
file_dir
=
getcwd
()
+
link
+
time_dir
+
filename
file
=
open
(
file_dir
,
"w"
)
file
=
open
(
file_dir
,
"w"
)
...
@@ -34,6 +34,8 @@ def storeParameters(link, filename, data):
...
@@ -34,6 +34,8 @@ def storeParameters(link, filename, data):
dbconfig
=
{
"host"
:
sys
.
argv
[
1
],
"user"
:
sys
.
argv
[
2
],
dbconfig
=
{
"host"
:
sys
.
argv
[
1
],
"user"
:
sys
.
argv
[
2
],
"password"
:
sys
.
argv
[
3
],
"database"
:
sys
.
argv
[
4
]}
"password"
:
sys
.
argv
[
3
],
"database"
:
sys
.
argv
[
4
]}
print
(
dbconfig
)
eue_db
=
pymysql
.
connect
(
user
=
dbconfig
[
"user"
],
password
=
dbconfig
[
"password"
],
eue_db
=
pymysql
.
connect
(
user
=
dbconfig
[
"user"
],
password
=
dbconfig
[
"password"
],
host
=
dbconfig
[
"host"
],
db
=
dbconfig
[
"database"
],
charset
=
'utf8'
)
host
=
dbconfig
[
"host"
],
db
=
dbconfig
[
"database"
],
charset
=
'utf8'
)
cursor
=
eue_db
.
cursor
(
pymysql
.
cursors
.
DictCursor
)
cursor
=
eue_db
.
cursor
(
pymysql
.
cursors
.
DictCursor
)
...
@@ -71,10 +73,8 @@ for userdata in result:
...
@@ -71,10 +73,8 @@ for userdata in result:
print
(
"After Linear Regression -
\n
"
)
print
(
"After Linear Regression -
\n
"
)
test_data
=
np
.
array
([[
5
],
[
20
],
[
0
],
[
16.87
],
[
40
],
[
test_data
=
np
.
array
([[
5
],
[
20
],
[
0
],
[
16.87
],
[
40
],
[
1011
],
[
0.72
],
[
26.70
],
[
47.00
],
[
64
]])
1011
],
[
0.72
],
[
26.70
],
[
47.00
],
[
64
]])
print
(
test_data
.
shape
,
mean
.
shape
,
std_d
.
shape
)
test_data
=
(
test_data
-
mean
)
/
std_d
test_data
=
(
test_data
-
mean
)
/
std_d
y_hat
=
model
.
predict
(
test_data
,
model
.
weights
,
model
.
bias
)
y_hat
=
model
.
predict
(
test_data
,
model
.
weights
,
model
.
bias
)
print
(
y_hat
.
shape
)
print
(
"Test Data.
\n
"
,
test_data
,
"
\n
"
)
print
(
"Test Data.
\n
"
,
test_data
,
"
\n
"
)
print
(
"Predict - standard deviation : "
,
y_hat
)
print
(
"Predict - standard deviation : "
,
y_hat
)
...
...
server/src/data_processing/preprocessing.py
View file @
e55ec4f0
...
@@ -27,7 +27,7 @@ def loadRawData(link, file_name):
...
@@ -27,7 +27,7 @@ def loadRawData(link, file_name):
str
(
yesterday
.
year
)
+
str
(
yMonth
)
+
"/"
+
\
str
(
yesterday
.
year
)
+
str
(
yMonth
)
+
"/"
+
\
str
(
yesterday
.
year
)
+
str
(
yMonth
)
+
str
(
yDay
)
str
(
yesterday
.
year
)
+
str
(
yMonth
)
+
str
(
yDay
)
file_dir
=
os
.
getcwd
()
+
"/server"
+
link
+
time_dir
+
file_name
file_dir
=
os
.
getcwd
()
+
link
+
time_dir
+
file_name
if
not
os
.
path
.
isfile
(
file_dir
):
if
not
os
.
path
.
isfile
(
file_dir
):
print
(
"File doesn't exist on {0}"
.
format
(
file_dir
))
print
(
"File doesn't exist on {0}"
.
format
(
file_dir
))
...
...
server/src/schedules.js
View file @
e55ec4f0
...
@@ -35,8 +35,9 @@ const dataProcessingJob = schedule.scheduleJob(rule, () => {
...
@@ -35,8 +35,9 @@ const dataProcessingJob = schedule.scheduleJob(rule, () => {
console
.
log
(
"
Data processing is start.
"
);
console
.
log
(
"
Data processing is start.
"
);
});
});
pyprocess
.
stderr
.
on
(
"
data
"
,
(
data
)
=>
{
pyprocess
.
stderr
.
on
(
"
data
"
,
(
error
)
=>
{
console
.
log
(
"
Error in the data processing.
"
);
console
.
log
(
"
Error in the data processing.
"
);
console
.
log
(
error
);
});
});
pyprocess
.
on
(
"
close
"
,
()
=>
{
pyprocess
.
on
(
"
close
"
,
()
=>
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment