Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Krashanoff/websockets #65

Merged
merged 11 commits into from
Mar 2, 2022
Merged

Krashanoff/websockets #65

merged 11 commits into from
Mar 2, 2022

Conversation

krashanoff
Copy link
Collaborator

@krashanoff krashanoff commented Mar 2, 2022

Continuation of #63. Begins implementation of a websocket handler and most of the grading runner subsystem. Right now, it looks a little something like this:

sequenceDiagram
  actor User
  User->>Handler: Upload work
  activate Handler
  Handler->>Runner: Run a job
  activate Runner
  Handler-->>User: OK
  deactivate Handler
  User->>Handler: Get live results
  activate Handler
  Handler->>Runner: Subscribe to job
  loop for each test case
    Runner-->>Handler: Result
    Handler-->>User: Test case info
  end
  Runner->>DB: Writeback all results
  activate DB
  DB-->>Runner: Complete
  deactivate DB
  Runner-->>Handler: Final score
  deactivate Runner
  Handler-->>User: Terminate connection
  deactivate Handler
Loading

Basically, SPMC parallelism over websockets. There's the issue of the server terminating before writing back results, right now, but I think that as long as this is well-documented, we can come back to it in the near future, before much more is built on the runner. The hierarchy looks like:

classDiagram
  Runner
  JobManager
  Handler
  Handler "1" o-- "1" Context
  Context "*" o-- "1" Runner
  Runner "1" o-- "*" JobManager
Loading

@krashanoff krashanoff added backend Concerning the backend documentation Concerning documentation labels Mar 2, 2022
@krashanoff krashanoff marked this pull request as draft March 2, 2022 01:53
@1strangequark
Copy link
Collaborator

I looked this over and did not see any immediate issues with it. It looks good, I think.

@krashanoff krashanoff force-pushed the krashanoff/websockets branch from b0a7700 to a8b86aa Compare March 2, 2022 14:32
@krashanoff krashanoff marked this pull request as ready for review March 2, 2022 17:25
@krashanoff
Copy link
Collaborator Author

It's going to complain about how I'm not checking for nil in my job spawning loop but I think this is fine to merge now contingent on #68 to work out any kinks.

@krashanoff krashanoff force-pushed the krashanoff/websockets branch from e1c57da to 6daf550 Compare March 2, 2022 23:55
@krashanoff
Copy link
Collaborator Author

Rebased on main. Basic functionality for websockets is there. Now just have to bind it to our frontend.

@krashanoff krashanoff merged commit c7562dc into main Mar 2, 2022
@krashanoff krashanoff deleted the krashanoff/websockets branch March 2, 2022 23:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backend Concerning the backend documentation Concerning documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants