design design batch
This commit is contained in:
@@ -108,7 +108,7 @@ def batch_design(objects_data, tasks_id, json_name):
|
||||
|
||||
with lock:
|
||||
object_response.append(items_response)
|
||||
logger.info(items_response)
|
||||
# logger.info(items_response)
|
||||
publish_status(tasks_id, step + 1, items_response)
|
||||
active_threads -= 1
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@ from app.service.design_batch.utils.MQ import publish_status
|
||||
|
||||
|
||||
async def start_design_batch_generate(data, file):
|
||||
generate_clothes_task = batch_design.delay(json.loads(file.decode())['objects'], data.total, data.file_name)
|
||||
generate_clothes_task = batch_design(json.loads(file.decode())['objects'], data.total, data.file_name)
|
||||
print(generate_clothes_task)
|
||||
publish_status(data.tasks_id, "0/100", "")
|
||||
return {"task_id": data.tasks_id}
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import io
|
||||
import json
|
||||
import logging
|
||||
import os
|
||||
@@ -14,6 +15,7 @@ def oss_upload_json(oss_client, json_data, object_name):
|
||||
file_path = os.path.join(save_dir, object_name)
|
||||
with open(file_path, 'w') as file:
|
||||
json.dump(json_data, file, indent=4)
|
||||
oss_client.fput_object("test", object_name, file_path)
|
||||
json_bytes = json.dumps(json_data).encode('utf-8')
|
||||
oss_client.put_object("test", object_name, io.BytesIO(json_bytes), length=len(json_bytes), content_type="application/json")
|
||||
except Exception as e:
|
||||
logger.warning(str(e))
|
||||
|
||||
Reference in New Issue
Block a user