-
Notifications
You must be signed in to change notification settings - Fork 39
Feature/finished/iia 2027 resolve create semantic and fixes #478
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
Feature/finished/iia 2027 resolve create semantic and fixes #478
Conversation
dukke
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@carldea Just had a quick look as it's a bit late here :) Added 1 comment from that very brief look.
kview/src/main/java/dev/ikm/komet/kview/controls/skin/KLComponentControlSkin.java
Show resolved
Hide resolved
| ObjectProperty<EntityFacade> refComponent = genEditingViewModel.getObjectProperty(REF_COMPONENT); | ||
| //Enable edit fields button if refComponent is NOT null else disable it. | ||
| editFieldsButton.setDisable(refComponent == null); | ||
| editFieldsButton.setDisable(refComponent.isNull().get()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can do a bind here:
editFieldsButton.disableProperty().bind(refComponent.isNull());
And then I think we won't need to manually update it anymore below.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good call! We should create another ticket since this is merged already.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@carldea yes, a ticket is a good idea! Do you want me to create it?
There are a bunch of places perhaps we should clean up.. including my code (for instance KLComponentSet control is still in the repo but we don't need it anymore).
Perhaps we could take some time after the demo to reduce some of our technical debt?
| editFieldsButton.setDisable(refComponent.isNull().get()); | ||
| //Enable reference component edit button if refComponent is NULL else disable it. | ||
| addReferenceButton.setDisable(refComponent != null); | ||
| addReferenceButton.setDisable(refComponent.isNotNull().get()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can do a bind here:
addReferenceButton.disableProperty().bind(refComponent.isNotNull());
And then I think we won't need to manually update it anymore below.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added some more comments.
I appreciate the commented out text saying we would get the database objects out of this control later. We share the same concerns. I understand that there's a time pressure to get this done before the demo. I hope we have time to do it later :)
| if (parentMenu != null) { | ||
| parentMenu.getItems().clear(); | ||
| TinkExecutor.threadPool().execute(TaskWrapper.make(new ViewMenuTask(viewCalculator, observableView), | ||
| (List<MenuItem> result) -> parentMenu.getItems().addAll(result))); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this menu already attached to a Scene? If so we'd want to use Platform.runLater to execute the code that changes the UI in the UI thread
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@carldea are we okay with editing this since it is shared code for the classic Komet's edit coordinate window in addition to the "read only for demo" one we generate for the Concept window...???
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am late getting these messages. It's too late in the game. But next time small stuff like this feel free to fix as a shared branch.
I agree with @dholubek this is read only for the demo and not to be invoked (trigger actions). But I believe the code was really lifted from classic Komet. Ideally when using a thread pool it provides activity information in the Activities tab for long running loads (building many menu options).
I think @dukke is correct that the parent (context menu) is attached to a Scene, and when adding to it (parentmenu) should be done on the JavaFX thread.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@carldea sounds good. Do you want me to add this to the ticket we mentioned?
|
|
||
| try { | ||
| // EntityService.get().endLoadPhase(); | ||
| createSemanticVersionTransactionTask(transaction).get(); // get() will block until transaction is finished (will refresh view calculator caches) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We are inside the UI thread and we are blocked until get() returns, this will block the UI thread until the task is complete, and the UI will become unresponsive.
We could spawn a new thread. Inside that thread we run this code and after we have the results call all the code that updates the UI inside Platfrom.runLater
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@dukke This is what we want, we would want the thread to complete before we send response. This is why we are getting the exception on create.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pedro is correct in that we should never block like this, but while fixing this issue we needed it to block in order to know diagnose why/when a transaction is finished creating a semantic. Swaroop was half/correct (from yesterday), but because of the fix in tinkar core we'd need to put the async code back in (surrounding the code above).
Let me explain.
Using a small dataset, the response time is negligible(fast), however if you use the snomed data, the creation code takes a very long time. Yesterday we found out the issue was code in the database code was asynchronous and we couldn't predict when the transaction was actually complete and the left side would query too soon and retrieve data from a stale cache.
Once we fixed that issue hence tinkar-core 1.103.0. I forgot to add the Completable futures code back in to not freeze the GUI. :(
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@carldea Yeah now that you mentioned it, I do remember that in the code you posted on Teams in our group chat you were indeed creating a new thread and calling this code inside that thread.
I did a small test where I simulated a long running call to the database (using thread sleep and having the code be the same as in this PR) and indeed the UI completely froze.
I have a quick fix idea for this if you'd like me to share it.
We could change the createSemanticVersionTransactionTask method to have an additional parameter that would be a callback that is called when the transactions is finished. Something like this:
private Future<Void> createSemanticVersionTransactionTask(Transaction transaction, Runnable runAfterTransaction) {
CommitTransactionTask commitTransactionTask = new CommitTransactionTask(transaction);
return TinkExecutor.threadPool().submit(new Callable<Void>() {
@Override
public Void call() throws Exception {
commitTransactionTask.call();
runAfterTransaction.run();
return null;
}
});
}Notice the runAfterTransaction runnable callback.
| editFieldsButton.disableProperty().bind(newRefComponentProp.isNull()); | ||
| addReferenceButton.disableProperty().bind(newRefComponentProp.isNotNull()); | ||
| editFieldsButton.setDisable(newRefComponentProp.isNull().get()); | ||
| addReferenceButton.setDisable(newRefComponentProp.isNotNull().get()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if we use binding above we won't need to update the disable property of the buttons again here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was discussed and Carl specifically wanted to not have bind here. He has done this intentionally.
| // Existing checks for next gen search navigator items to drag. | ||
| boolean nextGenSearchDnD = isADragAndDropInfo(dragEvent); | ||
|
|
||
| return classicConceptNavigatorDnD || classicSearchDnD || nextGenConceptNavigatorDnD || nextGenSearchDnD; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@carldea this is fixing what we can drop into a component, which is good, but it has a broad scope because the component is used by the Semantic window and the Pattern window in several places. So the permutations of testing all this is broad with classic Komet and next gen search against those two window types and all the places inside them that use the component also during edit and create modes... are we sure we want to introduce that much extra scope this late? Do we want to just stick to the transaction related fix on the Semantic?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@dholubek @carldea I was thinking the same thing as Doug and I have to agree with him. :)
This is a valuable effort and it's good to have but I also think it's risky to introduce these new features at this stage (new drag and drop support).
We already post-poned 4 code line PRs that fixed bugs for the demo because we didn't want to risk it. This new drag and drop support introduces more than that and hence more risk and might not even be necessarily needed for the demo.
Would sticking to the semantic creation bug fix be better?
dholubek
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
approved... I made a few comments wrt to allowing both classic and next gen concepts into drag and drop and how that to me is a bit risky to add that scope this late... that is a concern of mine.
swaroopsalvi
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pros:
- Fixing create semantic issue (Exception thrown during creation fixed).
- Support for classic komet navigator drag and dorp and search -> Unit tested and ready.
- Integration tinkar-core 1.103.0 -> performance related fix in tinkar-core.
- Unblocks current sprint stories for updateVersion and semantic.
Cons:
- This is a last min change and will need some additional testing.
- It will freeze the UI while the save is in progress. (Side effect of the solution done.) -> Can be fixed.
- One of JavaFx rules to have Platform.runLater() to be used to update the UI code.
This branch contains.