Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable other packages reusing tasks from fractal-tasks-core compound tasks #704

Open
jluethi opened this issue Apr 15, 2024 · 3 comments
Open

Comments

@jluethi
Copy link
Collaborator

jluethi commented Apr 15, 2024

Especially relevant for reusing someone standard init tasks.

Example:
Could a task in my_new_task_package consist of an init-task from fractal-tasks-core & a compute task from my_new_task_package? e.g. use the init for copy-ome-zarr-hcs-plate, but then do a min projection instead of a sum projection
[we could of course put multiple projection algorithms in the core package task, more as an illustration of the use case]

Feedback Tommaso:

At the moment this is not possible.
The quick and dirty workaround at the tasks-level is to have a task of your new package which imports and calls the fractal-tasks-core one.
In the future we may modify the fractal-tasks-core dev tools and task-collection, but we'll need to think it through (how would a task developer declare the association to a task that belongs to a different package? TBD)

Excluded directions: Allow this to happen on the db side, e.g. reuse an existing part of a compound task from another task db object

@jluethi
Copy link
Collaborator Author

jluethi commented Apr 15, 2024

My initial thoughts on:

(how would a task developer declare the association to a task that belongs to a different package? TBD)

A task developer puts in something like this in their task_list:

    CompoundTask(
        name="Minimum Intensity Projection HCS Plate",
        input_types={"is_3D": True},
        executable_init="<fractal-tasks-core package dependeny>.copy_ome_zarr_hcs_plate.py",
        executable="tasks/minimum_intensity_projection.py",
        output_types={"is_3D": False},
    ),

But certainly something to be investigated

@tcompa
Copy link
Collaborator

tcompa commented Apr 15, 2024

The goal is clear, the implementation for the moment is TBD.

My first guess is that we would need to expand the options for what can be written in the manifest, in a way that refers to a different package. Then, we would need to modify the task-collection functions so that they identify this specific branch, and perform custom logic.

For context, current task collection functions transform "executable" strings into absolute-path commands by finding them in the current-package directory. The fractal-tasks-core files are not in the current-package directory, so that we need a way to find the correct package directory (through something like pip show), and reconstruct the correct path.

A similar logic would be needed in the task dev tools, because we would need to find the correct fractal-tasks-core Python modules so that we can recreate manifest entries and their schemas.

@tcompa
Copy link
Collaborator

tcompa commented Apr 15, 2024

A task developer puts in something like this in their task_list:

Agreed: the goal could be this kind of syntax (or maybe something slightly more complex - TBD).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Development

No branches or pull requests

2 participants