This commit is contained in:
zjf 2025-05-27 14:10:42 +08:00
parent 866870f07d
commit 17a283ec45
3 changed files with 10 additions and 9 deletions

View File

@ -339,9 +339,9 @@ with rpa_image.imports():
res_value = rpa_dict[ulid] # getting a value res_value = rpa_dict[ulid] # getting a value
logger.info(f"Saved result: {res_value}") logger.info(f"Saved result: {res_value}")
rpa_queue.put(ulid) # adding a value # rpa_queue.put(ulid) # adding a value
queue_value = rpa_queue.get() # retrieving a value # queue_value = rpa_queue.get() # retrieving a value
logger.info(f"Queued result: {queue_value}") # logger.info(f"Queued result: {queue_value}")
except IOError as e: except IOError as e:
logger.error(f"Failed to save JSON file: {str(e)}") logger.error(f"Failed to save JSON file: {str(e)}")

View File

@ -1,12 +1,13 @@
from pydantic import BaseModel from pydantic import BaseModel, Field
from typing import List, Optional, Any from typing import List, Optional, Any
class LiveStreamProductWatchRequest(BaseModel): class LiveStreamProductWatchRequest(BaseModel):
""" """
直播流商品观测 直播流商品观测
""" """
live_stream_name: Optional[str] = None live_stream_name: Optional[str] = Field(None, description="直播间推流名称")
"""直播间推流名称""" """直播间推流名称"""
live_stream_start_time: Optional[int] = 0 live_stream_start_time: Optional[int] = 0
"""直播推流开始世界时间(毫秒时间戳)""" """直播推流开始世界时间(毫秒时间戳)"""

View File

@ -36,7 +36,7 @@ async def scalar_html():
) )
@web_app.post("/live_watch/submit") @web_app.post("/live_watch/submit",name="直播观测提交任务",description="监测直播侧发起,观测直播商品&切条")
async def submit_job_endpoint(data: LiveStreamProductWatchRequest) -> Optional[Any]: async def submit_job_endpoint(data: LiveStreamProductWatchRequest) -> Optional[Any]:
process_job = modal.Function.from_name("rpa", "rpa_run") process_job = modal.Function.from_name("rpa", "rpa_run")
@ -44,7 +44,7 @@ async def submit_job_endpoint(data: LiveStreamProductWatchRequest) -> Optional[A
return {"call_id": call.object_id} return {"call_id": call.object_id}
@web_app.get("/live_watch/result/{call_id}") @web_app.get("/live_watch/result/{call_id}",name="查询直播观测任务结果",description="异步查询")
async def get_job_result_endpoint(call_id: str) -> Any: async def get_job_result_endpoint(call_id: str) -> Any:
function_call = modal.FunctionCall.from_id(call_id) function_call = modal.FunctionCall.from_id(call_id)
try: try: