提交状态设计 #2

Closed
opened 2023-07-16 16:41:40 +08:00 by Paul · 1 comment
Owner

目前用户提交代码后,没有任何手段查询当前执行情况。需要在提交后返回一个ID,可用于查询题目当前判题状态

现有的设计:提交后将任务发送给RunnerRunner在完成所有工作后返回给Server,此时向数据库插入最终结果。整个流程缺乏对“已提交”/“正在判题”的感知

可能的解决方法:

Sol 1:

  1. asynq队列不自动销毁任务
  2. 接口返回asynq任务ID
  3. Server根据ID确定是否正在判题,若判题完成则插叙status
  4. redis重启后,ID丢失如何处理?

Sol 2:

  1. 提交后插入status状态,标记为pending
  2. 接口返回status.ID
  3. status.ID跟着任务一起发送到队列
  4. 判题结束后更新status
  5. 是否存在并发竞争情况?
目前用户提交代码后,没有任何手段查询当前执行情况。需要在提交后返回一个`ID`,可用于查询题目当前判题状态 现有的设计:提交后将任务发送给`Runner`,`Runner`在完成所有工作后返回给`Server`,此时向数据库插入最终结果。整个流程缺乏对“已提交”/“正在判题”的感知 可能的解决方法: Sol 1: 1. `asynq`队列不自动销毁任务 2. 接口返回`asynq`任务`ID` 3. `Server`根据`ID`确定是否正在判题,若判题完成则插叙`status` 4. **当`redis`重启后,`ID`丢失如何处理?** Sol 2: 1. 提交后插入`status`状态,标记为`pending` 2. 接口返回`status.ID` 3. `status.ID`跟着任务一起发送到队列 4. 判题结束后更新`status` 5. **是否存在并发竞争情况?**
Paul added the
enhancement
label 2023-07-16 16:41:40 +08:00
Paul added this to the (deleted) project 2023-07-16 16:41:41 +08:00
Paul added this to the 1.2.0 milestone 2023-07-16 16:42:35 +08:00
Author
Owner

现有设计难以实现,暂不处理

现有设计难以实现,暂不处理
Paul closed this issue 2023-12-21 17:14:10 +08:00
Sign in to join this conversation.
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: woj/woj-server#2
No description provided.