Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
P
physical
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
钟尚武
physical
Commits
4396340f
Commit
4396340f
authored
Aug 24, 2019
by
段英荣
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'add_sentry' into 'master'
add_sentry See merge request alpha/physical!440
parents
4bd4da57
5c17f023
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
1 deletion
+12
-1
collect_data.py
linucb/views/collect_data.py
+6
-0
linucb.py
linucb/views/linucb.py
+6
-1
No files found.
linucb/views/collect_data.py
View file @
4396340f
...
...
@@ -15,6 +15,7 @@ from libs.es import ESPerform
from
search.utils.common
import
*
import
libs.tools
as
Tools
from
trans2es.models.pictorial
import
CommunityPictorialHomeFeed
from
libs.error
import
logging_exception
class
KafkaManager
(
object
):
consumser_obj
=
None
...
...
@@ -53,6 +54,7 @@ class CollectData(object):
return
redis_linucb_tag_data_dict
except
:
logging_exception
()
logging
.
error
(
"catch exception,err_msg:
%
s"
%
traceback
.
format_exc
())
return
dict
()
...
...
@@ -143,6 +145,7 @@ class CollectData(object):
return
True
except
:
logging_exception
()
logging
.
error
(
"catch exception,err_msg:
%
s"
%
traceback
.
format_exc
())
return
False
...
...
@@ -151,6 +154,7 @@ class CollectData(object):
user_feature
=
user_feature
if
user_feature
else
self
.
user_feature
return
LinUCB
.
update_linucb_info
(
user_feature
,
reward
,
tag_id
,
device_id
,
self
.
linucb_matrix_redis_prefix
,
redis_client
)
except
:
logging_exception
()
logging
.
error
(
"update_user_linucb_tag_info error!"
)
return
False
...
...
@@ -308,9 +312,11 @@ class CollectData(object):
else
:
logging
.
warning
(
"unknown type msg:
%
s"
%
raw_val_dict
.
get
(
"type"
,
"missing type"
))
except
:
logging_exception
()
logging
.
error
(
"catch exception,err_msg:
%
s"
%
traceback
.
format_exc
())
return
True
except
:
logging_exception
()
logging
.
error
(
"catch exception,err_msg:
%
s"
%
traceback
.
format_exc
())
return
False
linucb/views/linucb.py
View file @
4396340f
...
...
@@ -10,7 +10,7 @@ import traceback
import
json
import
pickle
from
django.conf
import
settings
from
libs.error
import
logging_exception
class
LinUCB
:
d
=
2
...
...
@@ -33,6 +33,7 @@ class LinUCB:
return
cls
.
default_tag_list
except
:
logging_exception
()
logging
.
error
(
"catch exception,err_msg:
%
s"
%
traceback
.
format_exc
())
return
list
()
...
...
@@ -103,6 +104,7 @@ class LinUCB:
logging
.
info
(
"duan add,device_id:
%
s,sorted_np_score_list:
%
s,np_score_dict:
%
s"
%
(
str
(
device_id
),
str
(
sorted_np_score_list
),
str
(
np_score_dict
)))
return
(
top_tag_dict
,
top_tag_set
)
except
:
logging_exception
()
logging
.
error
(
"catch exception,err_msg:
%
s"
%
traceback
.
format_exc
())
return
({},())
...
...
@@ -126,6 +128,7 @@ class LinUCB:
return
True
except
:
logging_exception
()
logging
.
error
(
"catch exception,err_msg:
%
s"
%
traceback
.
format_exc
())
return
False
...
...
@@ -164,5 +167,6 @@ class LinUCB:
redis_cli
.
hset
(
redis_key
,
tag_id
,
pickle
.
dumps
(
user_tag_dict
))
return
True
except
:
logging_exception
()
logging
.
error
(
"catch exception,err_msg:
%
s"
%
traceback
.
format_exc
())
return
False
\ No newline at end of file
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