feat design stream 部署
fix
This commit is contained in:
@@ -2,6 +2,7 @@ import logging
|
|||||||
import threading
|
import threading
|
||||||
import time
|
import time
|
||||||
|
|
||||||
|
import requests
|
||||||
from minio import Minio
|
from minio import Minio
|
||||||
|
|
||||||
from app.core.config import *
|
from app.core.config import *
|
||||||
@@ -138,16 +139,9 @@ def design_generate(request_data):
|
|||||||
@RunTime
|
@RunTime
|
||||||
def design_generate_v2(request_data):
|
def design_generate_v2(request_data):
|
||||||
objects_data = request_data.dict()['objects']
|
objects_data = request_data.dict()['objects']
|
||||||
# process_id = request_data.dict()['process_id']
|
|
||||||
# object_response = {}
|
|
||||||
threads = []
|
threads = []
|
||||||
active_threads = 0
|
|
||||||
lock = threading.Lock()
|
|
||||||
|
|
||||||
# total = len(objects_data)
|
|
||||||
|
|
||||||
def process_object(step, object):
|
def process_object(step, object):
|
||||||
nonlocal active_threads
|
|
||||||
basic = object['basic']
|
basic = object['basic']
|
||||||
items_response = {
|
items_response = {
|
||||||
'layers': [],
|
'layers': [],
|
||||||
@@ -219,26 +213,10 @@ def design_generate_v2(request_data):
|
|||||||
logger.info(response.text)
|
logger.info(response.text)
|
||||||
logger.info(items_response)
|
logger.info(items_response)
|
||||||
|
|
||||||
# update_progress(process_id, total)
|
|
||||||
|
|
||||||
# with lock:
|
|
||||||
# object_response[step] = items_response
|
|
||||||
# active_threads -= 1
|
|
||||||
|
|
||||||
for step, object in enumerate(objects_data):
|
for step, object in enumerate(objects_data):
|
||||||
t = threading.Thread(target=process_object, args=(step, object))
|
t = threading.Thread(target=process_object, args=(step, object))
|
||||||
threads.append(t)
|
threads.append(t)
|
||||||
t.start()
|
t.start()
|
||||||
# with lock:
|
|
||||||
# active_threads += 1
|
|
||||||
|
|
||||||
# for t in threads:
|
|
||||||
# t.join()
|
|
||||||
# final_progress(process_id)
|
|
||||||
# return object_response
|
|
||||||
|
|
||||||
|
|
||||||
import requests
|
|
||||||
|
|
||||||
|
|
||||||
def post_request(url, data=None, json_data=None, headers=None, auth=None, timeout=5):
|
def post_request(url, data=None, json_data=None, headers=None, auth=None, timeout=5):
|
||||||
|
|||||||
Reference in New Issue
Block a user