stanfordnmbl / opencap-core

Main OpenCap processing pipeline
Apache License 2.0
144 stars 112 forks source link

Support for reprocessing trials with missing videos #171

Closed antoinefalisse closed 2 months ago

antoinefalisse commented 2 months ago

This PR adds support for reprocessing trials that do not have all videos uploaded. There are two ways this can happen: 1) the camera disconnected before hitting start recording. In that case, you have only 2 videos in db. 2) the camera disconnected while the trial was being recorded or during upload. In that case, you cancel upload (or it times out) and you have an entry in the db with video: null. In both cases, the trials are error-ed, but using different mechanisms.

In this PR, I adjusted a flag passed to main camerastouse that is ['all'] by default, but that can now be set to ['all_available']. When that's the case, then a trial can be processed, even if not all videos are available. To be able to reprocess trials on server using that flag, I added the possibility to add that variable to the metadata. Also, I removed a check in app.py that was checking if all video entries actually had a video file. This is now implemented in main. This allows a trial with missing videos to "pass app.py". Note that a trial that has missing videos is not dequeued directly, but after 15 minutes, which is fine.

All is all, it should not change anything to current user experience: A trial with missing videos will be error-ed out. However, if you add the variable to the metadata and kick back the trials to the server, then they will be processed. I tested and it is working all fine. You also see in the main_settings yaml which cameras were used.