Commit 4317ab80 by ‘chizw’

[+]限制优化

1 parent 31bf67f0
...@@ -67,3 +67,4 @@ class ConfigInfo: ...@@ -67,3 +67,4 @@ class ConfigInfo:
kafka_consumer_auto_offset_reset = Config.kafka_consumer_auto_offset_reset kafka_consumer_auto_offset_reset = Config.kafka_consumer_auto_offset_reset
kafka_consumer_analysis_topic = Config.kafka_consumer_analysis_topic kafka_consumer_analysis_topic = Config.kafka_consumer_analysis_topic
charset = Config.charset charset = Config.charset
subprocess_count = Config.charset
...@@ -14,4 +14,5 @@ class Config: ...@@ -14,4 +14,5 @@ class Config:
kafka_consumer_analysis_topic = 'funasr_analysis_topic' kafka_consumer_analysis_topic = 'funasr_analysis_topic'
charset = 'utf8' charset = 'utf8'
domain_mapping = {'glsk-oss.oss-cn-shenzhen-internal.aliyuncs.com': ['glsk-oss.oss-cn-shenzhen.aliyuncs.com']} domain_mapping = {'glsk-oss.oss-cn-shenzhen-internal.aliyuncs.com': ['glsk-oss.oss-cn-shenzhen.aliyuncs.com']}
subprocess_count = 1
# #
...@@ -14,4 +14,5 @@ class Config: ...@@ -14,4 +14,5 @@ class Config:
kafka_consumer_analysis_topic = 'funasr_analysis_topic' kafka_consumer_analysis_topic = 'funasr_analysis_topic'
charset = 'utf8' charset = 'utf8'
domain_mapping = {} domain_mapping = {}
subprocess_count = 1
# #
...@@ -19,3 +19,4 @@ class Config: ...@@ -19,3 +19,4 @@ class Config:
kafka_consumer_analysis_topic = 'funasr_analysis_topic' kafka_consumer_analysis_topic = 'funasr_analysis_topic'
charset = 'utf8' charset = 'utf8'
domain_mapping = {'glsk-oss.oss-cn-shenzhen-internal.aliyuncs.com': ['glsk-oss.oss-cn-shenzhen.aliyuncs.com']} domain_mapping = {'glsk-oss.oss-cn-shenzhen-internal.aliyuncs.com': ['glsk-oss.oss-cn-shenzhen.aliyuncs.com']}
subprocess_count = 3
...@@ -14,4 +14,5 @@ class Config: ...@@ -14,4 +14,5 @@ class Config:
kafka_consumer_analysis_topic = 'funasr_analysis_topic' kafka_consumer_analysis_topic = 'funasr_analysis_topic'
charset = 'utf8' charset = 'utf8'
domain_mapping = {} domain_mapping = {}
subprocess_count = 2
# #
...@@ -80,7 +80,7 @@ def consume_kafka(): ...@@ -80,7 +80,7 @@ def consume_kafka():
try: try:
# 先创建进程池,只复制当前资源 # 先创建进程池,只复制当前资源
# multiprocessing.set_start_method('spawn') # multiprocessing.set_start_method('spawn')
process_pool = multiprocessing.Pool(processes=2, initializer=consumer_process_init) process_pool = multiprocessing.Pool(processes=ConfigInfo.subprocess_count, initializer=consumer_process_init)
# m = multiprocessing.Manager() # m = multiprocessing.Manager()
# q = m.JoinableQueue() # q = m.JoinableQueue()
# # 加载大内存变量 # # 加载大内存变量
......
...@@ -155,8 +155,11 @@ def select_extract_data(): ...@@ -155,8 +155,11 @@ def select_extract_data():
# item.pop("recording_duration") # item.pop("recording_duration")
time.sleep(3) time.sleep(3)
for row in data: for row in data:
print(f"{row.get('id')}\t{row.get('employee_name')}\t{row.get('car_model')}\t" # print(f"{row.get('id')}\t{row.get('employee_name')}\t{row.get('car_model')}\t"
f"{row.get('bussiness_type')}\t{row.get('estimated_result')}\t{row.get('product')}\t{row.get('speed')}") # f"{row.get('bussiness_type')}\t{row.get('estimated_result')}\t{row.get('product')}\t{row.get('speed')}")
print(f"{row.get('id')}\t{row.get('recording_url')}\t{row.get('employee_name')}\t{row.get('car_model')}\t"
f"{row.get('bussiness_type')}\t{row.get('estimated_result')}\t{row.get('speed')}")
# print(f"{row.get('speed')}")
pass pass
return data return data
......
...@@ -58,6 +58,7 @@ def generate_random_filename(): ...@@ -58,6 +58,7 @@ def generate_random_filename():
@app.get("/") @app.get("/")
def hello_world(): def hello_world():
print("Hello World!")
return "Hello World!" return "Hello World!"
@app.get("/funasr/exit") @app.get("/funasr/exit")
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!