-
Notifications
You must be signed in to change notification settings - Fork 1
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
process all courses' assignments; misc. other cleaning up (iss. #6, #7, #8, #10) #11
process all courses' assignments; misc. other cleaning up (iss. #6, #7, #8, #10) #11
Conversation
Significantly newer Django versions are available, but their support timeline is shorter than the release currently in use. It makes more sense to upgrade to the latest patch version.
…st` default value
Implementing #6 is more complicated than I expected. Trying to save peer reviews for some of the other assignments in the test course is revealing more abnormalities in the Canvas data than expected. |
Trying to switch from look ahead for assessor/submission to handling exception caused by missing ones when the assessment is saved.
This should eliminate problems with saving submissions/assessments/comments associated with the test_student that cause missing user errors.
Skipping untyped submissions seems to be too aggressive. It turns out that some of those submissions DO receive peer reviews. Just because I don't know what the type is doesn't mean that Canvas can't handle it and users successfully interact with it.
Also continue with next assessment when one is missing its assessor or submission.
Replace `try…catch` blocks with calls to `getattr()` instead.
N816 actually highlighted a problem, not to be ignored. Rather than have config export variable that's not a constant, move that variable into a function for checking the rest of the config.
@lsloan, hi, sorry, it's been a busy week. I am off tomorrow. I probably won't be able to finish reviewing this until Monday. I'll get to it as soon as I can. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry for the delay, @lsloan. This is a pretty meaty pull request, and I hadn't really seen this code before, so I basically felt like I was reviewing the whole project.
I'm approving, with some comments for further thought or future work. It would at least be good to see the GitHub Action fixed or removed before you merge. I don't know with a 100 percent certainty that this is working exactly as intended, but it did collect data, and in the poking around I did, things made sense. Thus I think it's okay to merge and work iteratively on improvements. Looks like some type hints could be tightened up, but I understand it's difficult in some cases since canvaspi
doesn't seem to have them.
Couple more general suggestions:
- You may want to add a knob for changing the level of
canvasapi
log messages, since they can be really noisy too like Django's. Something like this should work insettings.py
:
'loggers': {
'django': {
'handlers': ['console'],
'level': os.getenv('LOG_LEVEL', 'INFO').upper(),
'propagate': False
},
'canvasapi': {
'handlers': ['console'],
'level': os.getenv('CANVAS_API_LOG_LEVEL', 'WARN').upper()
}
}
- Part of the difficulty in reviewing this is not knowing how to test the results. To what do I compare the data? What queries ensure that we can do the analysis we need later? I'm not sure what kind of tests this application needs, but selective unit tests and/or the ability to programmatically run certain queries could be useful. Here are some queries I ended up writing to so some of this work (in case they're helpful):
-- Courses, assignments, and submissions
select *
from course c
join assignment a
on a.course_id=c.id
join submission s
on s.assignment_id=a.id;
-- Assessor gave to submitter these comments about their work in this course
select
assessor.login_id as `assessor_login_id`,
submitter.login_id as `submitter_login_id`,
cm.comments,
s.id as `submission_id`
from course c
join assignment a
on a.course_id=c.id
join submission s
on s.assignment_id=a.id
join `user` submitter
on s.user_id=submitter.id
join assessment am
on am.submission_id=s.id
join `user` assessor
on am.assessor_id=assessor.id
join comment cm
on cm.assessment_id=am.id
where c.id='XXXXX';
-- count peer review comments given by each student in a course
select
assessor.login_id as `assessor_login_id`,
count(*)
from course c
join assignment a
on a.course_id=c.id
join submission s
on s.assignment_id=a.id
join `user` as submitter
on s.user_id=submitter.id
join assessment am
on am.submission_id=s.id
join `user` assessor
on am.assessor_id=assessor.id
join comment cm
on cm.assessment_id=am.id
where c.id='XXXXX'
group by assessor.id;
- This process seemed to take about 2 and a half minutes for the large course you suggested we look at. I'm not sure how much we would/will scale this process, but it's possible we reach a point where performance is an issue. Adopting some
async
/await
or doing bulk database actions could improve the time to complete. Maybe theasync
becomes less relevant if we switch to Canvas Data 2 queries, but something like Django'sbulk_create
would drastically reduce the number of database calls currently made.
@ssciolla, thanks for the approval and further comments. I'll review them closely tomorrow morning before merging. |
@ssciolla, thanks again for the thoughtful, thorough code review. I really appreciate it. I understand the delay. Yes, this PR has a lot going on. The earlier PRs were mostly about getting the base application going. Zhen had me pause progress on this project to work on deploying the Longhorn Open peer grading tool. So when I was able to resume work here, I've been trying to get as much done as possible and quickly before something else comes along to interrupt me. Addressing the general suggestions in your top-of-review message:
|
Co-authored-by: Sam Sciolla <35741256+ssciolla@users.noreply.github.com>
Helps with IDE reporting errors about `typing.Self`.
Remove an old and now unneeded function `return`; bring back a `continue` that was removed for testing, but may reduce unnecessary processing; and use `hasattr()` (NOT `getattr()`) as a more readable replacement for `dir()`.
Other code mostly eliminates possibility of the exception being thrown, so instead of catching it and returning `None`, remove the `try…except` block. This also eliminates the need for importing `Optional`.
While removing the apparently unneeded exception handler for errors saving users, realized the function doesn't really need to return the course object, either.
Resolves #6
Resolves #7
Resolves #8
Resolves #10
Test Plan
Follow the steps in
README.md
.When configuring the
.env
file, set it up with Canvas-test and use the following for course IDs:COURSE_IDS_CSV=545451
Uses "ECON 101 200 FA 2022", which contains three peer-reviewed assignments.
COURSE_IDS_CSV=200,545451,461474
Add other courses, which may or may not include peer-reviewed assignments.