Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
lichenggang
/
tas_monitor
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
b7720fe9
authored
Nov 20, 2019
by
lichenggang
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
update
parent
47acfcf5
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
3 additions
and
3 deletions
crawler_process.py
utils/mysql.py
crawler_process.py
View file @
b7720fe9
...
@@ -21,9 +21,9 @@ ichunt_elk = Elasticsearch(host="127.0.0.1", port=9200, timeout=20)
...
@@ -21,9 +21,9 @@ ichunt_elk = Elasticsearch(host="127.0.0.1", port=9200, timeout=20)
def
get_process_task
(
task_code
):
def
get_process_task
(
task_code
):
keys
=
task_redis
.
keys
(
task_code
+
'*'
)
keys
=
task_redis
.
keys
(
task_code
+
'
_
*'
)
keys_len
=
sum
([
task_redis
.
llen
(
k
)
for
k
in
keys
])
keys_len
=
sum
([
task_redis
.
llen
(
k
)
for
k
in
keys
])
abnormal_keys
=
task_redis
.
keys
(
'abnormal_'
+
task_code
+
'*'
)
abnormal_keys
=
task_redis
.
keys
(
'abnormal_'
+
task_code
+
'
_
*'
)
abnormal_keys_len
=
sum
([
task_redis
.
llen
(
k
)
for
k
in
abnormal_keys
])
abnormal_keys_len
=
sum
([
task_redis
.
llen
(
k
)
for
k
in
abnormal_keys
])
return
keys_len
,
abnormal_keys_len
return
keys_len
,
abnormal_keys_len
...
...
utils/mysql.py
View file @
b7720fe9
...
@@ -38,7 +38,7 @@ class MySqlOperator:
...
@@ -38,7 +38,7 @@ class MySqlOperator:
def
update_process
(
self
,
p
):
def
update_process
(
self
,
p
):
with
self
.
db
.
cursor
()
as
cursor
:
with
self
.
db
.
cursor
()
as
cursor
:
sql
=
"""
sql
=
"""
UPDATE lie_spider_board SET run_time=
%(run_time)
s, remain_task=
%(remain_task)
s,
UPDATE lie_spider_board SET run_time=
%(run_time)
s, remain_task=
%(remain_task)
s,
concurrency=
%(concurrency)
s,
remain_wrong_task=
%(remain_wrong_task)
s, wrong_radio=
%(wrong_radio)
s WHERE unique_code=
%(unique_code)
s
remain_wrong_task=
%(remain_wrong_task)
s, wrong_radio=
%(wrong_radio)
s WHERE unique_code=
%(unique_code)
s
"""
"""
cursor
.
execute
(
sql
,
p
)
cursor
.
execute
(
sql
,
p
)
...
...
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