Keep reference to GPU from Task after use
Refs https://gitlab.com/teklia/requests/-/issues/829#note_1355141432
We want to know which GPU was used during a task execution once it finished.
The idea is to use an FK instead of 1-to-1, keep it populated and introduce a constraint on gpu_id + state
So we can update the existing
OneToOneField
to aForeignKey
, which does not require a data migration, and we can add the unique constraint withUNIQUE (gpu_id) WHERE (state IN ('unscheduled', 'pending', 'running'))