Build WorkerConfiguration model and links
A new model arkindex.dataimport.models.WorkerConfiguration
is needed:
- UUID PK
- string(250)
name
- JsonField
configuration
to store the configuration - string(32)
configuration_hash
to store the MD5 hash of the config - Foreign key
worker
towards aWorker
(related name should beconfigurations
) - usual
created
+updated
fields
Constraints:
- unique together on
worker
+configuration_hash
- unique together on
worker
+name
Signals:
- a
pre_save
signal must always update theconfiguration_hash
from theconfiguration
value
Foreign keys on other models:
- FK
configuration
fromWorkerRun
towardsWorkerConfiguration
(related nameworker_runs
) - FK
configuration
fromWorkerActivity
towardsWorkerConfiguration
(related nameworker_activities
)
Admin:
- add a dedicated
ModelAdmin
for this new model - add an inline to view configurations for a worker
Migration:
-
⚠ Do not migrate existingWorkerRun.config
there, 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