This PR fixes the Video.DoesNotExist error that we're getting in the celery delete_video_from_cloud task. The error is happening because the delete video task is running after the video object has been deleted, but then the code inside the task is trying to reference the deleted video object. The video object is being referenced in order to figure out which AWS bucket to delete the video from. So instead of looking for that information inside the task code, we can pass it in as an argument when the task is first set up.
Implementation notes:
When jsPsych studies are added, we will have 3 possibilities for video storage buckets. Thus the current "pipe or not pipe" logic for the delete_video_from_cloud task will need to change. We could either change the recording_method_is_pipe argument to a non-boolean that can be 1 of 3 values that indicate which bucket to delete from, or we could add a separate argument for something like study_type_is_jspsych.
As mentioned in #1430, another way to solve this problem would be to delete the video object at the same time as the S3 video. However, since we're going for the soft delete option for the raw video, we'd have to also keep the video object in the DB for that same period. The problems with this approach are that (1) currently the video deletion cascades from the response deletion, so we would need to set up a delay for the video object deletion separate from the response deletion (or delay response deletion), and (2) the site will continue to pick up video objects that exist in the DB even if they've been set up for future deletion, so it will appear to users as if the delete action didn't work. Instead, we want to delete the video from the DB immediately so that users can see the effect.
Testing:
The to-be-deleted video exists in the DB but not in S3
Fixes #1430
This PR fixes the Video.DoesNotExist error that we're getting in the celery
delete_video_from_cloud
task. The error is happening because the delete video task is running after the video object has been deleted, but then the code inside the task is trying to reference the deleted video object. The video object is being referenced in order to figure out which AWS bucket to delete the video from. So instead of looking for that information inside the task code, we can pass it in as an argument when the task is first set up.Implementation notes:
delete_video_from_cloud
task will need to change. We could either change therecording_method_is_pipe
argument to a non-boolean that can be 1 of 3 values that indicate which bucket to delete from, or we could add a separate argument for something likestudy_type_is_jspsych
.Testing: