podman-desktop icon indicating copy to clipboard operation
podman-desktop copied to clipboard

Create (possibly silent) tasks for background jobs

Open deboer-tim opened this issue 1 year ago • 1 comments

Is your enhancement related to a problem? Please describe

Performing long running actions through our UI usually generates a user visible task, but if another part of the code triggers it or an extension calls an API to do the same thing, there is no task.

Describe the solution you'd like

Using our API to trigger background jobs like building or pulling images, creating machines, etc. should create tasks. Code in the main package can do this directly; extensions can use API like withProgess. For instance, triggering a build from an extension UI should end up creating a user-visible task just like going through the renderer's build page. We may need to move some existing tasks from the renderer to main.

The API caller should have options like triggering a 'silent' (or maybe background, or child) tasks. For instance, an extension that needs to create a manifest by creating two build tasks and a third task to create the actual manifest might want all three to be visible, might only want a single parent/composite task to be visible to the user, or hide it completely in other cases.

Describe alternatives you've considered

No response

Additional context

No response

deboer-tim avatar May 31 '24 03:05 deboer-tim

I would wait for https://github.com/containers/podman-desktop/pull/8144 to be merged before going further on this one

axel7083 avatar Aug 06 '24 15:08 axel7083

IMHO the issue description is misleading with how I think it should be achieved and I disagree with the issue and the suggested pattern

For instance, triggering a build from an extension UI should end up creating a user-visible task just like going through the renderer's build page. We may need to move some existing tasks from the renderer to main.

No it should not. It's the extension that is deciding what to expose

benoitf avatar Oct 30 '24 18:10 benoitf

See discussion in #9687 for background.

For most things, exposing API as we have already been doing is good - extensions will create their own tasks, or have a composite task where there are several steps and each API call is just one part of it.

For the few things that extensions may want to trigger directly / standalone, we should use commands. Extensions can trigger the command instead of calling the API directly, and the command would create a task as necessary.

The core use-case this issue was opened was for pulling an image. AFAIK we don't expose a pull image command today, nor provide any way for extensions to find that it exists and what the arguments are. IMHO it would be enough to prove the pattern and close this issue if we expose and document this one command for extensions.

deboer-tim avatar Nov 12 '24 15:11 deboer-tim

closing over https://github.com/podman-desktop/podman-desktop/issues/9989

benoitf avatar Nov 19 '24 20:11 benoitf