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

Server: use rust refresh command #7

Closed
nygrenh opened this issue Oct 6, 2020 · 3 comments
Closed

Server: use rust refresh command #7

nygrenh opened this issue Oct 6, 2020 · 3 comments

Comments

@nygrenh
Copy link
Member

nygrenh commented Oct 6, 2020

  • Runs in background-daemon
  • Saves progress to a database table
  • Progress indication in the UI with a progress bar and the current phase
create_table "course_refreshes"
  t.datetime "created_at"
  t.datetime "updated_at"
  t.integer "course_template_id", null: false
  t.integer "status", null: false, default: 0 # (enum: [:not_started, :in_progress, :complete , :crashed] https://api.rubyonrails.org/v5.2.4.4/classes/ActiveRecord/Enum.html)
  t.integer "creator_id", null: false

create_table "course_refresh_phase_timings" # From tmc-langs-rust coming in as phases complete. Will be used to calculate the length of the progress bar.
  t.integer "course_refresh_id", null: false
  t.string "phase_name:, null: false
  t.integer: "time_ms", null: false
@sebazai
Copy link
Collaborator

sebazai commented Jan 13, 2021

{ "output-kind":"output-data", "status":"finished", "message":"refreshed course test-python-ohpe", "result":"executed-command", "percent-done":1.0, "data": { "new-cache-path":"/path/to_file", "course-options" : any "exercises": [ { name: "osa03-24_monta", checksum: "taman-tehtavan-checksum", points: [ { "name": "3-24.ekapiste", "requires_review": true }, { "name": "3-24.tokapiste", "requires_review": false } ] metadata: "????", } ] } }

When data in this format from tmc-lang-rust, nuke all useless code from course_refresher and do all exercise updates in one for loop and small amount of database queries.

  • Rework UI accordingly
  • Fix specs

@sebazai
Copy link
Collaborator

sebazai commented Jan 25, 2021

TMC-langs data rework started. Rethink Refresh on server.

Possible idea:

  1. Course refresh initialized by teacher/admin/someone with access
  2. Generate DB instance (CourseRefresh), status: not_started
  3. Refresh course page for user with notice: eg. Refresh initialized. Progress reported below, Please wait...
  4. BG: ActionCable report that refresh started -> Disable Refresh button for all teacher users
  5. BG: Background daemon starts course-refresh command
  6. BG: Rust magic in background while reporting progress with ActionCable to all teacher users. (Save phases to CourseRefreshPhaseTimings)
  7. BG: When Rust done, update server database accordingly or report error and rollback.
  8. BG: Generate a (error) report to user to database (CourseRefreshReport)
  9. BG: ActionCable send request to refresh site with parameter of CourseRefresh instance ID
  10. Refresh page with the report for all users that received the websocket data

Problems to think about are:

  • How to implement state that refresh is in progress if someone lands at the page, so that refresh is disabled and he gets live reports of the progress once websocket has connected
  • Could step 3 be done without refresh, so socket doesn't loose connection?

@sebazai
Copy link
Collaborator

sebazai commented Feb 8, 2021

More to-do:
testmycode#514

@sebazai sebazai closed this as completed Mar 9, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants