Skip to content

Django command to update worker versions that provide features

https://redmine.teklia.com/issues/8011

Requires !2423 (merged)

A new arkindex update_system_workers command must be added. It acts as a WorkerVersion.feature steamroller: no matter how broken your worker versions get, it makes sure you have a known good set of worker versions for each feature with the correct docker_image_iid.

For each feature:

  • If a version exists for this feature:
    • If it has the correct Docker image, and the worker isn't archived:
      • A database check constraint ensures that the version's state is already available, so no need to check that
      • Make sure the worker is public
      • Move on to the next feature
    • Otherwise, unassign it from the feature and continue
  • Get or create a system worker type
  • If a worker named after the feature exists with this type:
    • Make sure the worker is not archived
    • Make sure the worker is public
  • Otherwise, create one.
  • If a version already exists on the worker with the correct Docker image:
    • Make sure it is available
    • Assign it to the feature
  • Otherwise, create one.