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

Keep single execute expression job in the queue #9077

Merged

Conversation

4e6
Copy link
Contributor

@4e6 4e6 commented Feb 15, 2024

Pull Request Description

close #8965

Changelog:

  • update: keep a single ExecuteExpressionJob in the queue
  • update: make ExecuteExpressionCommand synchronous to preserve the order of commands
  • refactor: separate data structures for Visualization and OneshotExpression to simplify the logic

Important Notes

Checklist

Please ensure that the following checklist has been satisfied before submitting the PR:

  • The documentation has been updated, if necessary.
  • All code follows the
    Scala,
    Java,
    and
    Rust
    style guides. In case you are using a language not listed above, follow the Rust style guide.
  • All code has been tested:
    • Unit tests have been written where possible.
    • If GUI codebase was changed, the GUI was tested when built using ./run ide build.

@4e6 4e6 added the CI: No changelog needed Do not require a changelog entry for this PR. label Feb 15, 2024
@4e6 4e6 self-assigned this Feb 15, 2024
@4e6
Copy link
Contributor Author

4e6 commented Feb 15, 2024

Tested manually. A fully async test would introduce a race without being able to synchronize the test with the program execution.

Copy link
Member

@JaroslavTulach JaroslavTulach left a comment

Choose a reason for hiding this comment

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

I am surprised there can only be at most one oneshotVisualization. That doesn't seem correct to me, but I don't see all the nuances of the implementation.


@Override
public boolean equalsTo(UniqueJob<?> that) {
return that instanceof ExecuteExpressionJob;
Copy link
Member

Choose a reason for hiding this comment

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

Equality based on class of the job? E.g. only one job may be present regardless of the actual oneShotExpression?

It seems to me that the engine is trying to handle cancellation without understanding what is being cancelled. I think only the IDE can say that a oneShotExpression and its ExecuteExpressionJob shall be cancelled - the engine cannot decide on that.

): Unit =
synchronized {
val state = contexts(contextId)
state.visualizations.setOneshotExpression(oneshotExpression)
Copy link
Member

Choose a reason for hiding this comment

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

Can there be only one oneshotExpression? That seems suspicious to me.

Especially when (one shot) executions requests are co-leased the oneshotExpressions can accumulate - one the (last) execution finishes, all the oneshotExpressions need to be evaluated and the results delivered to the IDE, I think.

@4e6
Copy link
Contributor Author

4e6 commented Feb 16, 2024

As discussed on the call. One expression per execution context should work in the current use case

@4e6 4e6 added the CI: Ready to merge This PR is eligible for automatic merge label Feb 19, 2024
@mergify mergify bot merged commit a25d716 into develop Feb 19, 2024
27 of 29 checks passed
@mergify mergify bot deleted the wip/db/8965-introduce-backoff-to-executing-expressions branch February 19, 2024 09:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CI: No changelog needed Do not require a changelog entry for this PR. CI: Ready to merge This PR is eligible for automatic merge
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Introduce backoff to executing expressions
2 participants