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

Reduce tool form building frequency #18969

Open
wants to merge 3 commits into
base: dev
Choose a base branch
from

Conversation

davelopez
Copy link
Contributor

Mitigates #18848

When we have multiple data inputs in a tool, the ToolForm will request a tool rebuild for each data input in rapid succession (see #18848 (comment)).

This will ensure that only the last request with all the updated data is sent.

Before

image

After

image

How to test the changes?

  • I've included appropriate automated tests.
  • This is a refactoring of components with existing test coverage.
  • Instructions for manual testing are as follows:
    1. [add testing steps and prerequisites here if you didn't write automated tests covering all your changes]

License

  • I agree to license these and all my past contributions to the core galaxy codebase under the MIT license.

@@ -284,7 +285,7 @@ export default {
this.onUpdate();
}
},
onUpdate() {
onUpdate: debounce(function (e) {
Copy link
Member

Choose a reason for hiding this comment

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

This doesn't look quite right as a fix. If we've got those datasets in the initial form build we really don't need to fire onUpdate in the first place.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It is hard to track where the change is coming from. So many components firing change events are involved here, that is the best solution I could come up with without having intimate knowledge about the tool form and tool build process 😞

Maybe @guerler or someone else more familiar with the tool form can have a closer look?

Copy link
Contributor

Choose a reason for hiding this comment

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

Thanks for looking into this. There was a LastQueue mechanism specifically built to avoid multiple redundant requests to the API. I would consider a regression in that mechanism to be a bug, it could prevent users from effectively using certain tools due to a large number of possibly slow requests.

Copy link
Member

Choose a reason for hiding this comment

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

This is a workaround though, not a fix. If we come in with a defined set of inputs, there's no reason to fire off any requests.

@mvdbeek
Copy link
Member

mvdbeek commented Oct 10, 2024

Nothing's really broken here, I would target dev since I could see this having subtle side-effects that we're notoriously bad at testing.

@davelopez davelopez changed the base branch from release_24.1 to dev October 10, 2024 09:28
@davelopez davelopez changed the title [24.1] Reduce tool form building frequency Reduce tool form building frequency Oct 10, 2024
@davelopez davelopez modified the milestones: 24.1, 24.2 Oct 10, 2024
@davelopez
Copy link
Contributor Author

davelopez commented Oct 10, 2024

Nothing's really broken here, I would target dev since I could see this having subtle side-effects that we're notoriously bad at testing.

Good point! Done!

@davelopez davelopez force-pushed the 24.1_fix_tool_form_building_frequency branch from 6fb172b to ec7db4a Compare November 12, 2024 16:15
@davelopez davelopez marked this pull request as draft November 13, 2024 10:36
@davelopez davelopez force-pushed the 24.1_fix_tool_form_building_frequency branch from c129e57 to e9b7abf Compare November 13, 2024 14:59
@davelopez davelopez marked this pull request as ready for review November 13, 2024 15:00
Copy link
Member

@mvdbeek mvdbeek left a comment

Choose a reason for hiding this comment

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

I don't think request volume / debounce tradeoff is worth it.

@mvdbeek
Copy link
Member

mvdbeek commented Nov 15, 2024

We cannot use this.onChange here because on initial load there would be no
change in the formData and the onChange event would not be triggered.

Isn't this is a good thing ? What made you decide to revert this ?

@mvdbeek mvdbeek removed this from the 24.2 milestone Nov 15, 2024
@davelopez davelopez force-pushed the 24.1_fix_tool_form_building_frequency branch from e9b7abf to 2b5d16a Compare November 15, 2024 13:06
@davelopez
Copy link
Contributor Author

Isn't this is a good thing ? What made you decide to revert this ?

That change was breaking this test:

def test_insert_input_handling(self):

Unfortunately, the test results are gone after the rebase. For some reason, the event must be fired on creation for this test to pass (maybe the problem is with the test?). In addition, after intensive debugging, the change didn't seem to make any significant difference in reducing the form rebuilding as far as I could tell, so I decided to revert it. I will restore it and we can investigate the test further.

I don't think request volume / debounce tradeoff is worth it.

Why not, we want the most up-to-date request anyway, no? 🤔

Sorry, I'm afraid I don't know how to improve the situation 😞 I know this is just a palliative measure and the real issue is the complex event interaction in these components.

On the other hand, I could keep debugging and investigating with more time since this is no longer scheduled for this release.

This reverts commit 2b5d16a.

As `request volume` / `debounce` tradeoff is not worth it.
@mvdbeek
Copy link
Member

mvdbeek commented Nov 15, 2024

Why not, we want the most up-to-date request anyway, no? 🤔

500ms delay is a lot of delay and a high price to pay.

the change didn't seem to make any significant difference in reducing the form rebuilding as far as I could tell, so I decided to revert it.

This is weird, see #18848 (comment).

I could keep debugging and investigating with more time since this is no longer scheduled for this release.

👍 maybe this is a good moment to see if we want to change how data is passed up and down the component hierarchy.

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

Successfully merging this pull request may close these issues.

3 participants