Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
S
saturn
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
赵磊
saturn
Commits
5972574e
Commit
5972574e
authored
Oct 13, 2019
by
钟尚武
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'shangwu/hotfix-xiaohongshu' into 'like-pre/r01'
修复Dockerfile See merge request
alpha/saturn!112
parents
10635e06
aa1f5914
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
16 additions
and
17 deletions
+16
-17
Dockerfile
Dockerfile
+1
-1
reply_commands.py
api/management/commands/reply_commands.py
+14
-15
upload.py
api/utils/upload.py
+1
-1
No files found.
Dockerfile
View file @
5972574e
...
...
@@ -24,4 +24,4 @@ RUN apt-key adv --recv-keys --keyserver keyserver.ubuntu.com 3B4FE6ACC0B21F32 \
RUN
pip3
install
-i
https://pypi.tuna.tsinghua.edu.cn/simple
-r
requirements.txt
CMD
bash -c 'source ~/.bashrc &&
celery -A physical worker -Q tapir-alpha --loglevel=DEBUG --maxtasksperchild 500 -c 62
'
CMD
bash -c 'source ~/.bashrc &&
gunicorn venus.wsgi:saturn -w 4 -b 0.0.0.0:8085 -k gevent
'
api/management/commands/reply_commands.py
View file @
5972574e
...
...
@@ -17,7 +17,7 @@ from engine.logger import info_logger, error_logger, logging_exception
IMAGE_SUFFIX
=
'-w'
FILE_PATH
=
'/
Users/zhongshangwu/workspace/gengmei/like
/saturn/xiaohongshu/'
FILE_PATH
=
'/
srv/apps
/saturn/xiaohongshu/'
class
Command
(
BaseCommand
):
...
...
@@ -49,7 +49,6 @@ class Command(BaseCommand):
start_user_id
=
self
.
user_id_start
,
end_user_id
=
self
.
user_id_start
+
5000
)
.
unwrap
()
print
(
data
,
">>>>>"
)
self
.
shadow_user_ids
=
data
def
get_random_user_id
(
self
):
...
...
@@ -68,19 +67,19 @@ class Command(BaseCommand):
def
get_user_id
(
self
,
id_
,
platform
):
# 获取用户ID 缓存记录保留用户关系
cache_key
=
'grap:{}:{}'
.
format
(
platform
,
id_
)
exist_key
=
'grap:{}:{}'
#
exist_key = 'grap:{}:{}'
value
=
ins_cache
.
get
(
cache_key
)
user_id
=
None
#
user_id = None
if
not
value
:
while
True
:
#
while True:
user_id
=
self
.
get_random_user_id
()
exist
=
exist_key
.
format
(
platform
,
user_id
)
if
not
ins_cache
.
get
(
exist
):
ins_cache
.
set
(
exist
,
id_
)
self
.
del_cache_keys
.
append
(
exist
)
break
ins_cache
.
set
(
cache_key
,
user_id
)
self
.
del_cache_keys
.
append
(
exist
)
#
exist = exist_key.format(platform, user_id)
#
if not ins_cache.get(exist):
#
ins_cache.set(exist, id_)
#
self.del_cache_keys.append(exist)
#
break
#
ins_cache.set(cache_key, user_id)
#
self.del_cache_keys.append(exist)
else
:
user_id
=
int
(
value
)
return
user_id
...
...
@@ -117,7 +116,7 @@ class Command(BaseCommand):
# 获取图片宽高
try
:
url
=
image_url
+
IMAGE_SUFFIX
+
'?imageInfo'
response
=
requests
.
request
(
"GET"
,
url
)
response
=
requests
.
request
(
"GET"
,
url
,
timeout
=
3
)
info
=
response
.
json
()
return
info
.
get
(
'width'
),
info
.
get
(
'height'
)
except
Exception
as
e
:
...
...
@@ -163,7 +162,7 @@ class Command(BaseCommand):
def
create_topic
(
self
,
topics
,
platform
):
count
=
0
for
topic
in
topics
[:
100
]
:
for
topic
in
topics
:
count
+=
1
topic_comments
=
topic
.
pop
(
'comments'
,
None
)
images
=
topic
.
pop
(
'image'
)
...
...
@@ -279,7 +278,7 @@ class Command(BaseCommand):
print
(
'----- start deal pictorial at {} -----'
.
format
(
datetime
.
now
()
.
strftime
(
'
%
Y-
%
m-
%
d
%
H:
%
M:
%
S
%
f'
)))
pictorial_data
=
self
.
get_json_data_from_dir
(
is_pictorial
=
1
)
count
=
0
for
pictorial
in
pictorial_data
[:
50
]
:
for
pictorial
in
pictorial_data
:
count
+=
1
print
(
'------- current pictorial count :'
,
count
)
self
.
create_pictorial
(
pictorial
=
pictorial
,
platform
=
platform
)
...
...
api/utils/upload.py
View file @
5972574e
...
...
@@ -9,7 +9,7 @@ from PIL import Image
def
upload_image
(
url
,
img_type
=
IMG_TYPE
.
TOPIC
):
'''非站内图片处理'''
try
:
response
=
requests
.
get
(
url
)
response
=
requests
.
get
(
url
,
timeout
=
3
)
return
upload
(
response
.
content
,
img_type
=
img_type
)
except
:
return
None
...
...
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