Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Y
ydl_ai_recommender
Overview
Overview
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
闫发泽
ydl_ai_recommender
Commits
0c491807
Commit
0c491807
authored
Dec 13, 2022
by
柴鹏飞
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
接口默认返回100。修改接口线程池为1,不然数据库连接会断
parent
b2f7c64e
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
5 deletions
+5
-5
recommend_service.py
src/service/recommend_service.py
+5
-5
No files found.
src/service/recommend_service.py
View file @
0c491807
...
...
@@ -18,7 +18,7 @@ recommender = UserCFRecommender(top_n=5, k=5)
class
RecommendHandler
(
tornado
.
web
.
RequestHandler
):
executor
=
ThreadPoolExecutor
(
2
)
executor
=
ThreadPoolExecutor
(
1
)
@tornado.gen.coroutine
def
get
(
self
):
...
...
@@ -26,12 +26,12 @@ class RecommendHandler(tornado.web.RequestHandler):
if
uid
is
None
:
logger
.
warn
(
'请求参数不正确,无uid'
)
size
=
self
.
get_argument
(
'size'
,
10
)
size
=
self
.
get_argument
(
'size'
,
10
0
)
try
:
size
=
int
(
size
)
except
Exception
as
e
:
logger
.
warn
(
'size=
%
s 不是数字'
,
size
)
size
=
10
size
=
10
0
ret
=
yield
self
.
run
(
uid
,
size
)
self
.
write
(
ret
)
...
...
@@ -41,7 +41,7 @@ class RecommendHandler(tornado.web.RequestHandler):
def
post
(
self
):
param
=
json
.
loads
(
self
.
request
.
body
.
decode
(
'utf-8'
))
uid
=
param
.
get
(
'uid'
,
None
)
size
=
param
.
get
(
'size'
,
10
)
size
=
param
.
get
(
'size'
,
10
0
)
if
uid
is
None
:
logger
.
warn
(
'请求参数不正确,无uid'
)
...
...
@@ -50,7 +50,7 @@ class RecommendHandler(tornado.web.RequestHandler):
@run_on_executor
def
run
(
self
,
uid
,
size
=
10
):
def
run
(
self
,
uid
,
size
=
10
0
):
logger
.
info
(
'request@@uid=
%
s@@size=
%
s'
,
uid
,
size
)
try
:
recommend_result
=
recommender
.
recommend
(
uid
,
size
=
size
,
is_merge
=
True
)
...
...
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