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
alpha
physical
Commits
f02b3ae3
Commit
f02b3ae3
authored
Apr 24, 2019
by
lixiaofang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add
parent
fe070f21
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
55 additions
and
8 deletions
+55
-8
app_conf.xml
app_conf.xml
+0
-1
tasks.py
injection/data_sync/tasks.py
+52
-4
celery_task_router.py
physical/celery_task_router.py
+3
-3
No files found.
app_conf.xml
View file @
f02b3ae3
...
@@ -17,6 +17,5 @@
...
@@ -17,6 +17,5 @@
<element
value=
"search.views.contrast_similar"
/>
<element
value=
"search.views.contrast_similar"
/>
<element
value=
"injection.data_sync.tasks"
/>
<element
value=
"injection.data_sync.tasks"
/>
<element
value=
"search.views.contrast_similar"
/>
<element
value=
"search.views.contrast_similar"
/>
<!--<element value="majia..tasks.tasks"/>-->
</config>
</config>
</gm_rpcd_config>
</gm_rpcd_config>
injection/data_sync/tasks.py
View file @
f02b3ae3
...
@@ -11,8 +11,8 @@ from libs.es import ESPerform
...
@@ -11,8 +11,8 @@ from libs.es import ESPerform
from
libs.cache
import
redis_client
from
libs.cache
import
redis_client
from
trans2es.models.face_user_contrast_similar
import
FaceUserContrastSimilar
,
UserSimilarScore
from
trans2es.models.face_user_contrast_similar
import
FaceUserContrastSimilar
,
UserSimilarScore
from
linucb.utils.register_user_tag
import
RegisterUserTag
from
linucb.utils.register_user_tag
import
RegisterUserTag
from
majia.tasks
import
auto_click
# from majia.get_session import get_comments, click, login
# from majia.get_session import host, user, passwd, db
@shared_task
@shared_task
...
@@ -35,8 +35,8 @@ def write_to_es(es_type, pk_list, use_batch_query_set=False):
...
@@ -35,8 +35,8 @@ def write_to_es(es_type, pk_list, use_batch_query_set=False):
use_batch_query_set
=
use_batch_query_set
,
use_batch_query_set
=
use_batch_query_set
,
es
=
ESPerform
.
get_cli
()
es
=
ESPerform
.
get_cli
()
)
)
auto_click
(
pk_list
)
#
auto_click(pk_list)
logging
.
info
(
"-----------------"
)
#
logging.info("-----------------")
except
:
except
:
logging
.
error
(
"catch exception,err_msg:
%
s"
%
traceback
.
format_exc
())
logging
.
error
(
"catch exception,err_msg:
%
s"
%
traceback
.
format_exc
())
...
@@ -73,6 +73,7 @@ def sync_face_similar_data_to_redis():
...
@@ -73,6 +73,7 @@ def sync_face_similar_data_to_redis():
except
:
except
:
logging
.
error
(
"catch exception,err_msg:
%
s"
%
traceback
.
format_exc
())
logging
.
error
(
"catch exception,err_msg:
%
s"
%
traceback
.
format_exc
())
@shared_task
@shared_task
def
sync_user_similar_score
():
def
sync_user_similar_score
():
try
:
try
:
...
@@ -96,3 +97,49 @@ def sync_user_similar_score():
...
@@ -96,3 +97,49 @@ def sync_user_similar_score():
except
:
except
:
logging
.
error
(
"catch exception,err_msg:
%
s"
%
traceback
.
format_exc
())
logging
.
error
(
"catch exception,err_msg:
%
s"
%
traceback
.
format_exc
())
@shared_task
def
auto_click
(
pk_list
):
logging
.
info
(
"get----------------------:
%
s"
%
pk_list
)
exec_count
=
0
# try:
# pc = pymysql.connect(host=host, user=user, passwd=passwd, db=db, port=3306)
# cursor = pc.cursor()
# cursor.execute(
# "SELECT id,user_id FROM topic WHERE id in " + str(
# tuple(pk_list)) + " and user_id in (select user_id from user_extra where is_shadow = 0)")
# data = cursor.fetchall()
# topic_id_list = list(data)
# logging.info("Database version : %s " % topic_id_list)
# pc.close()
# exec_count = 0
# if topic_id_list:
#
# def fun_timer():
# cookies = login()
# if cookies:
# click(cookies, topic_id_list[0])
#
# global timer
# global exec_count
#
# exec_count += 1
# if exec_count == 1:
# # sleep_time = random.randint(300, 540)
# sleep_time = 30
# timer = threading.Timer(sleep_time, fun_timer)
# timer.start()
#
# if exec_count == 2:
# # sleep_time = random.randint(1000, 1900)
# sleep_time = 50
# timer = threading.Timer(sleep_time, fun_timer)
# timer.start()
#
# sleep_time = random.randint(300, 540)
# timer = threading.Timer(10, fun_timer) # 首次启动
# timer.start()
# else:
# pass
# except:
# logging.error("catch exception,main:%s" % traceback.format_exc())
\ No newline at end of file
physical/celery_task_router.py
View file @
f02b3ae3
...
@@ -10,9 +10,9 @@ class CeleryTaskRouter(object):
...
@@ -10,9 +10,9 @@ class CeleryTaskRouter(object):
"tapir-alpha"
:
[
"tapir-alpha"
:
[
'injection.data_sync.tasks.write_to_es'
,
'injection.data_sync.tasks.write_to_es'
,
],
],
#
"majia-alpha": [
"majia-alpha"
:
[
#
'majia.tasks.auto_majia_effect',
'majia.tasks.auto_majia_effect'
,
#
],
],
}
}
# Map[TaskName, QueueName]
# Map[TaskName, QueueName]
...
...
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