Repository navigation
Asynchronous student import for Google Classroom integration - #1133
Conversation
Extract existing code to the rspec config. The ensure isn't needed as exceptions from specs are rescued (it would only help if we expect errors in the `around` itself)
Test coverage94.18% line coverage reported by SimpleCov. |
This is lower level behaviour needed for importing students
7ce95f4 to
e71a318
Compare
ApprovabilityVerdict: Needs Human Approval Macroscope's review found this PR requires human approval — The opt-in import adds background student creation and progress reporting while preserving synchronous imports. Human confirmation is needed that GoodJob storage and retention appropriately protect the student details and caller token now persisted as job arguments. Needs human approval because:
Adjust the Minimum Blocking Severity for this repo — including turning it Off — in Settings. You can add or adjust custom eligibility rules. Learn more. |
Currently profile can take more than 15s to create students. I don't like using the users token in an async job- as well as creating a copy of it, it might expire before the job runs, but there's not really an alternative at the moment.
I want to avoid overloading profile. It might be possible to up this concurrency in the future as the code in editor shouldn't prevent it running in parallel.
Since this might take a minute or longer, I wanted to see if we could report progress to the frontend so people can see that it's in progress and not got stuck.
e71a318 to
20495c7
Compare
cocomarine
left a comment
There was a problem hiding this comment.
LGTM!
A question: there is no retry on the new CreateAndAssignStudentsJob so a failed group of students will be skipped and the bacth still shows as finished. Is this intentional so that we don't call create_school_students_sso for the failed ones again or something?
Not really - I think I had assumed we retry all jobs by default which looks like it's not the case. I'll add a retry in as it may mean we can recover from temporary network issues and the job should be able to run multiple times for the same effect. |
This is to catch any temporary network errors. I've chosen not to do a polynomial wait as a user is waiting for this to complete. I'm not sure why we would want a raise here as we're already reporting an error to sentry.
d20e655 to
c5bfe6f
Compare
Status
Points for consideration:
SchoolImportJob.What's changed?
We currently create student accounts (in profile) and student roles and class memberships (in editor-api) for the Google Classroom integration.
The profile API accepts up to 200 students, however we've found that it can timeout and cause errors in profile for ~100 students.
This keeps the class creation synchronous, but moves the student creation to a batched async method.
I've added progress reporting to the batch job so that we might be able to show progress on the frontend.
Steps to perform after deploying to production
Switch the frontend to use the new async option.