fractal-analytics-platform / fractal-tasks-core

Main tasks for the Fractal analytics platform
https://fractal-analytics-platform.github.io/fractal-tasks-core/
BSD 3-Clause "New" or "Revised" License
14 stars 6 forks source link

Which library provides tasks schemas for `create_schema_for_single_task`? #444

Closed jluethi closed 1 year ago

jluethi commented 1 year ago

At the moment, create_schema_for_single_task only works for package=fractal-tasks-core or if the hard-coded INNER_PYDANTIC_MODELS files are also moved to the new package.

While create_schema_for_single_task function exposes a inner_pydantic_models input variable, that is not used (but instead the global INNER_PYDANTIC_MODELS).

That means this function expects to find lib_channels.py & lib_input_models.py in the source folder of the package (if package is set to something different than fractal-tasks-core, which is necessary to make other parts of the function to work for a different package).


We could just change https://github.com/fractal-analytics-platform/fractal-tasks-core/blob/e2e55991ab740a30bc9f2639f1acf14c650ba77b/fractal_tasks_core/dev/lib_args_schemas.py#L139 to use inner_pydantic_models instead of INNER_PYDANTIC_MODELS, thus using the dictionary provided as input But I think it would also be good to encourage the usage of the pydantic models from fractal-tasks-core in other packages, not having each package define its own pydantic models or copy the models from the core package. Thus, a better solution would be splitting this: Actually loading the INNER_PYDANTIC_MODELS always from fractal-tasks-core (not the specified package) and allowing users to specify extra models.