rage / tmc-server

Test My Code server
GNU General Public License v2.0
0 stars 0 forks source link

Server: use rust refresh command #7

Closed nygrenh closed 3 years ago

nygrenh commented 3 years ago
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 commented 3 years ago

{ "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.

sebazai commented 3 years ago

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

Possible idea:

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

Problems to think about are:

sebazai commented 3 years ago

More to-do: https://github.com/testmycode/tmc-server/pull/514