Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
Amazon-Selection-Data
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
abel_cjy
Amazon-Selection-Data
Commits
66c45f86
Commit
66c45f86
authored
Apr 21, 2026
by
fangxingjun
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'developer' of 47.106.101.75:abel_cjy/Amazon-Selection-Data into developer
parents
72ac75ce
44e5900a
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
9 deletions
+17
-9
templates.py
Pyspark_job/utils/templates.py
+17
-9
No files found.
Pyspark_job/utils/templates.py
View file @
66c45f86
...
@@ -345,15 +345,23 @@ class Templates(object):
...
@@ -345,15 +345,23 @@ class Templates(object):
pass
pass
def
kafka_stream_stop
(
self
):
def
kafka_stream_stop
(
self
):
try
:
import
threading
,
os
self
.
start_process_instance
()
# 开启海豚调度
self
.
start_process_instance
()
# 开启海豚调度
if
self
.
query
is
not
None
:
self
.
query
.
stop
()
# 退出实时消费(移除awaitTermination避免线程冲突)
def
_do_stop
():
if
self
.
spark
is
not
None
:
try
:
self
.
spark
.
stop
()
if
self
.
query
is
not
None
:
exit
(
0
)
# 退出程序
self
.
query
.
stop
()
# 在子线程中调用,避免 foreachBatch 回调内死锁
except
Exception
as
e
:
if
self
.
spark
is
not
None
:
print
(
e
,
traceback
.
format_exc
())
self
.
spark
.
stop
()
except
Exception
as
e
:
print
(
e
,
traceback
.
format_exc
())
finally
:
os
.
_exit
(
0
)
# 强制退出 JVM,不被 try/except 拦截
t
=
threading
.
Thread
(
target
=
_do_stop
,
daemon
=
False
)
t
.
start
()
# foreachBatch 回调从此处正常返回,不阻塞等待 stop 完成
# def kafka_consumption_is_finished(self):
# def kafka_consumption_is_finished(self):
# while True:
# while 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