As the scheduler api usage starts to grow, we need a way to generically create a task for a given type.
Each task type (listing, loading, cooking, checking...) has a different way of being called, creating multiple combinations.
This is difficult to track every form of them as this is currently dispatched among different modules.
That could be a pain to maintain in the long run.
As of today, this is "hard-coded" in:
- swh-web (in progress) ~> will be multiple loading types (svn, hg, git, maybe more)
- swh-updater (ghtorrent) ~> only 1 type so far (loading)
- swh-deposit ~> only 2 types so far (checking, loading)
- swh-vault ~> only 1 type so far (cooking)
- swh-lister ~> loading types
I think that ideally, the client of the scheduler api should not be concerned by those...
Just call the creation api to schedule a task of a given tool_type (lister, loader, checker, cooker, ...), for a given origin type (git, svn, hg, tar, deposit, dir, ...), possibly a supplementary extra nature information (i see incremental and full so far, don't really know how to call this one).
I see one possible way of implementing this as this is somewhat already the case in the task_type table of the scheduler.
Reworking slighly the task_type table to have those new column should do it:
- tool_type: lister, loader, checker, cooker, ...
- origin_type: git, svn, hg, tar, deposit, dir, ...
- tool_type_extra: incremental, full, none ...
- template_arguments: json like structure for each type
The last one being the important one permitting the task creation templating without bothering the scheduler api client.
Or something.