Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
J
jumpserver
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
ops
jumpserver
Commits
0dbf2ab2
Commit
0dbf2ab2
authored
Oct 22, 2019
by
ibuler
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[Update] 修改websocket读取日志
parent
6b8b0f4a
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
2 deletions
+9
-2
ws.py
apps/ops/ws.py
+9
-2
No files found.
apps/ops/ws.py
View file @
0dbf2ab2
...
@@ -46,13 +46,20 @@ class CeleryLogWebsocket(JsonWebsocketConsumer):
...
@@ -46,13 +46,20 @@ class CeleryLogWebsocket(JsonWebsocketConsumer):
if
not
task_log_f
:
if
not
task_log_f
:
return
return
task_end_mark
=
[]
while
not
self
.
disconnected
:
while
not
self
.
disconnected
:
data
=
task_log_f
.
read
line
(
)
data
=
task_log_f
.
read
(
4096
)
if
data
:
if
data
:
data
=
data
.
replace
(
b
'
\n
'
,
b
'
\r\n
'
)
data
=
data
.
replace
(
b
'
\n
'
,
b
'
\r\n
'
)
self
.
send_json
({
'message'
:
data
.
decode
(
errors
=
'ignore'
),
'task'
:
task_id
})
self
.
send_json
({
'message'
:
data
.
decode
(
errors
=
'ignore'
),
'task'
:
task_id
})
if
data
.
startswith
(
b
'Task'
)
and
data
.
find
(
b
'succeeded'
):
if
data
.
find
(
b
'succeeded in'
)
!=
-
1
:
task_end_mark
.
append
(
1
)
if
data
.
find
(
bytes
(
task_id
,
'utf8'
))
!=
-
1
:
task_end_mark
.
append
(
1
)
if
len
(
task_end_mark
)
==
2
:
logger
.
debug
(
'Task log end: {}'
.
format
(
task_id
))
break
break
time
.
sleep
(
0.1
)
time
.
sleep
(
0.1
)
task_log_f
.
close
()
task_log_f
.
close
()
...
...
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