Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
KWH40
fml40-reference-implementation
Commits
5ed3fdb6
Commit
5ed3fdb6
authored
Jun 23, 2021
by
Jiahang Chen
Browse files
add freq input
parent
68ec0d0f
Pipeline
#494646
passed with stages
in 33 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
ml/dt_factory.py
View file @
5ed3fdb6
...
...
@@ -341,7 +341,8 @@ def add_function_impl_obj(thing, impl_obj, feature_name, **kwargs):
def
create_thing
(
model
,
grant_type
=
"password"
,
secret
=
""
,
username
=
None
,
password
=
None
,
is_broker_rest
=
False
,
is_broker
=
False
,
is_repo
=
False
,
is_stanford2010
=
False
,
stanford2010_path
=
None
):
is_broker_rest
=
False
,
is_broker
=
False
,
is_repo
=
False
,
is_stanford2010
=
False
,
stanford2010_sync_freq
=
None
,
stanford2010_path
=
None
):
"""
Creates and launches a thing which connects to the S3I
...
...
@@ -385,6 +386,7 @@ def create_thing(model, grant_type="password",
is_broker
=
is_broker
,
is_repo
=
is_repo
,
is_stanford2010
=
is_stanford2010
,
stanford2010_sync_freq
=
stanford2010_sync_freq
,
stanford2010_path
=
stanford2010_path
)
build
(
thing_ref
,
model
)
...
...
ml/thing.py
View file @
5ed3fdb6
...
...
@@ -44,6 +44,7 @@ def __init__(
is_broker_rest
=
True
,
is_stanford2010
=
False
,
stanford2010_path
=
None
,
stanford2010_sync_freq
=
None
,
username
=
None
,
password
=
None
,
):
...
...
@@ -84,8 +85,9 @@ def __init__(
self
.
__is_broker_rest
=
is_broker_rest
self
.
__is_repo
=
is_repo
self
.
__is_stanford2010
=
is_stanford2010
self
.
__stanford2010_path
=
stanford2010_path
self
.
__stanford2010_sync_freq
=
stanford2010_sync_freq
self
.
__access_token
=
""
self
.
__endpoint
=
""
...
...
@@ -259,7 +261,8 @@ def run_forever(self):
if
self
.
__is_repo
:
threading
.
Thread
(
target
=
self
.
__repo_syn
).
start
()
if
self
.
__is_stanford2010
:
threading
.
Thread
(
target
=
self
.
__stanford2010_syn
,
args
=
(
self
.
__stanford2010_path
,
True
,
10
)).
start
()
threading
.
Thread
(
target
=
self
.
__stanford2010_syn
,
args
=
(
self
.
__stanford2010_path
,
True
,
self
.
__stanford2010_sync_freq
)).
start
()
@
staticmethod
def
add_user_def
(
func
):
...
...
@@ -355,13 +358,16 @@ def get_last_hpr(hpr_files):
return
hpr
_stanford2010
=
get_last_hpr
(
get_hpr_files
(
path
))
if
_stanford2010
is
None
:
APP_LOGGER
.
warn
(
"StanForD2010 Data not found"
)
return
self
.
__stanford2010
=
_stanford2010
APP_LOGGER
.
info
(
"Parsing the StanForD2010 Data in DT"
)
while
True
:
_stanford2010
=
get_last_hpr
(
get_hpr_files
(
path
))
time
.
sleep
(
1
)
if
_stanford2010
is
None
:
APP_LOGGER
.
warn
(
"StanForD2010 Data not found in the specified folder, wait for the data"
)
continue
else
:
self
.
__stanford2010
=
_stanford2010
APP_LOGGER
.
info
(
"Parsing the StanForD2010 Data in DT"
)
break
while
is_period
:
time
.
sleep
(
freq
)
hpr_temp
=
get_last_hpr
(
hpr_files
=
get_hpr_files
(
path
))
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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