Generate and store worker run summary

Bastien Abadie
2022-06-16T12:47:31Z

For performance reasons (when listing related worker runs on an element/transcription/...), we need to generate and store a summary of the worker run on the model instances

1. add a non-nullable summary textfield on the WorkerRun

2. add a method build_summary on WorkerRun model using the following algo:

start by describing worker version : "Worker {worker_version.model.name} @ {worker_version.git_refs | worker_version.short_hash}"

when model is set, add: " with model {model_version.model.name} @ {model_version.short_id}"

when configuration is set, add: " using configuration '{config.name}'"

3. make a migration that creates the field as nullable, generates all summaries, then make the field non-nullable

4. add a signal on pre_save that generates the summary automatically

5. add unit tests for different cases