Build WorkerConfiguration model and links
A new model arkindex.dataimport.models.WorkerConfiguration is needed:
- UUID PK
- string(250)
name - JsonField
configurationto store the configuration - string(32)
configuration_hashto store the MD5 hash of the config - Foreign key
workertowards aWorker(related name should beconfigurations) - usual
created+updatedfields
Constraints:
- unique together on
worker+configuration_hash - unique together on
worker+name
Signals:
- a
pre_savesignal must always update theconfiguration_hashfrom theconfigurationvalue
Foreign keys on other models:
- FK
configurationfromWorkerRuntowardsWorkerConfiguration(related nameworker_runs) - FK
configurationfromWorkerActivitytowardsWorkerConfiguration(related nameworker_activities)
Admin:
- add a dedicated
ModelAdminfor this new model - add an inline to view configurations for a worker
Migration:
-
⚠ Do not migrate existingWorkerRun.configthere, it will take time to build the other features
Expected database structure
classDiagram
WorkerRun --> DataImport
WorkerRun --> WorkerVersion
WorkerRun --> WorkerConfiguration
WorkerConfiguration <-- WorkerActivity
WorkerConfiguration --> Worker
WorkerVersion --> Worker
WorkerActivity --> WorkerVersion
WorkerActivity ..> DataImport
WorkerActivity
class WorkerActivity {
+WorkerConfiguration config
+State state
}
class WorkerConfiguration {
+ID_numeric pk
+MD5 hash_of_config
+string name
+Worker worker
+JSONFIeld config
- unique(ID)
- unique(hash_of_config, worker)
- unique(name, worker)
}
Edited by Bastien Abadie