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

LocalJobs fixes #5648

Merged
merged 3 commits into from
Jan 31, 2024
Merged

LocalJobs fixes #5648

merged 3 commits into from
Jan 31, 2024

Conversation

johnhaddon
Copy link
Member

This fixes a few bugs in the LocalJobs panel that showed up while testing #5636. I'm making a separate PR for these because independent fixes for problems that already exist on main. When deleting the selected jobs, the selection now reverts to empty rather than jumping to some random job. I did wonder if it would be better to move the selection to the job immediately above the old selection, and even did most of the work of implementing that, but I actually don't see it being much use to me so I backed it out. I've got the WIP for that squirreled away though if we do want it.

- Don't store `self.__job`, because that is invalidated by any modification to the path (e.g. `setFromString()`). Instead get it by a JobPool lookup each time it is needed.
- Don't use the `JobPool.jobs()` index as the path, because it is not stable. Deleting a job changes the list index for other jobs, meaning that paths would change what they are referring to. This was particularly noticeable when deleting selected jobs - the selection would jump to some apparently random other job.
- Preserve root and filter in `copy()` and `childNames()`.

This meant adding a new `JobPool.jobsDict()` method to provide stable unique IDs for jobs, which also means that `remove()` is no longer linear in the number of jobs.
This fixes the following error when deleting a job at an inopportune moment in the UI :

```
Instance referenced by WeakMethod GafferDispatch.LocalDispatcher.__messagesChanged() no longer exists
```
The problem we're dealing with here is that selection is retained even when the paths don't exist any more, so when a job is removed we need to do an update (wherein we will realise that the selection doesn't refer to a job).
@johnhaddon johnhaddon self-assigned this Jan 30, 2024
Copy link
Contributor

@murraystevenson murraystevenson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Thanks for addressing these!

I did wonder if it would be better to move the selection to the job immediately above the old selection...

I suppose that is the usual behaviour, though I agree it doesn't seem particularly useful in this context. Let's keep that WIP squirrelled until someone finds a good reason for its existence...

@johnhaddon johnhaddon merged commit a606da4 into GafferHQ:main Jan 31, 2024
5 checks passed
@johnhaddon johnhaddon deleted the localJobsFixesPR branch March 15, 2024 14:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

2 participants