QGIS project import runs off the window, with progress and Cancel

Open
#2,476 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
5/5
Estimated time
Over a week
Newbie friendliness
38/100
Issue type
Feature
Clarity
Clearly specified
Activity status
Active
Tech stack
rust
Domain
backend, desktop

Research direction

Start by reading the import command and the existing background execution paths, especially workflows::ahead_on_copy, reads::prepare, and service.add / layer.addData. Compare the proposed read-ahead and session-copy approaches, then add the import to long_commands in crates/engine/src/tests/cancellation.rs and extend the cancellation tests. Done means import progress and Cancel work without holding the window, cancellation leaves the session unchanged, and the cancellation tests cover the command.

Written by the indexing model from the issue text.

Description

project.importQgis runs on the UI thread. It adds a project's layers one after another, each through the command that adds its kind, and no step looks at Cancel. Since #2471 a QGIS project's web service layers come in from their services: each asks for the service's capabilities, then a WFS, OGC API or feature service layer's features (page by page, within the read limits) or a WCS coverage. A project with several such layers, or a slow service, holds the window until every service has answered. Before #2471 only file reads and a WMS layer's capabilities did this.

What's wanted (AGENTS.md, "Never hold the window"): the import runs off the window, with progress (layers done of layers in the project) and Cancel. Cancelling leaves the project as it was, as other cancelled commands do.

Why it isn't a small change:

  • The import changes the session as it goes. Later layers, groups and relations read the layers added before them, and tile layers that land on the same tiles are merged.
  • There is no background path yet for a command that runs other commands on the session. Models and scripts run on a copy (workflows::ahead_on_copy), whose results are then taken. Read-ahead commands (reads::prepare) read one source before they run.

Possible approaches:

  • Read ahead. Collect every file and service read the import will make: each layer's source is known from the project text before anything is added. Read them all off the window with progress and Cancel, then add the layers from what was read, as service.add and layer.addData already take fetched documents and files.
  • Run on a copy. Run the import on a copy of the session, as models and scripts do, and take its result.

The import would then also go in long_commands (crates/engine/src/tests/cancellation.rs), and the cancellation tests would cover it.

Related: #882 (piece 10b, #2471).

Dominant language
Rust
Stars
1.9k
Forks
268
Avg merge
11h 1m
Merged PRs (30d)
942

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from opengeos/RustGIS

All issues in opengeos/RustGIS

Similar issues

More Rust issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.