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

Build of the extensions index is blocking due to extension waiting for user input #6912

Closed
jcfr opened this issue Mar 24, 2023 · 23 comments · Fixed by #7145
Closed

Build of the extensions index is blocking due to extension waiting for user input #6912

jcfr opened this issue Mar 24, 2023 · 23 comments · Fixed by #7145
Labels
Type: Bug Something isn't working correctly
Milestone

Comments

@jcfr
Copy link
Member

jcfr commented Mar 24, 2023

Summary

After connecting to the windows factory using VNC, I was able to observe that the ExtraMarkups extension was showing a popup dialog and expecting the user to click.

Steps to reproduce

NA

Expected behavior

No popup should be displayed.

Environment

  • Observed in the context of the Preview build on Windows (overload factory) associated with fbc2ede
@jcfr jcfr added the Type: Bug Something isn't working correctly label Mar 24, 2023
@jcfr
Copy link
Member Author

jcfr commented Mar 24, 2023

@jcfr
Copy link
Member Author

jcfr commented Mar 24, 2023

The function qSlicerStenosisMeasurement3DModuleWidget::installExtensionFromServer should be improved to skip the popup when running test mode.

https://github.com/vmtk/SlicerExtension-VMTK/blob/5c31f18ba995fa97494b302e23f8a8d16cdc4f8d/StenosisMeasurement3D/qSlicerStenosisMeasurement3DModuleWidget.cxx#L416-L466

Ideally, the function should be contributed to Slicer itself.

@jcfr
Copy link
Member Author

jcfr commented Mar 24, 2023

cc: @chir-set @lassoan

@jcfr jcfr added this to the Slicer 5.3 milestone Mar 24, 2023
@jcfr jcfr added the Priority: High Significant problem or regression label Mar 24, 2023
@jcfr
Copy link
Member Author

jcfr commented Mar 24, 2023

@chir-set
Copy link
Contributor

Ideally, the function should be contributed to Slicer itself.

Thank you for showing this issue.

-2. OK, contributing the function to Slicer is not a problem, and will be done secondarily.

-1. Fixing the popup showing itself seems immediately important. Referring to this resolution, would exiting the function at the very beginning by checking

qSlicerApplication::application()->layoutManager() == nullptr

be an acceptable solution ?

@jcfr
Copy link
Member Author

jcfr commented Mar 24, 2023

Instead you could add something like this:

  bool isTestingEnabled = qSlicerApplication::testAttribute(qSlicerCoreApplication::AA_EnableTesting);
  if (isTestingEnabled)
    {
    // Do not block the execution with popup windows if testing mode is enabled.
    return;
    }

@chir-set
Copy link
Contributor

Instead you could add something like this:

OK.

As for 'StenosisMeasurement3D' module in SlicerVMTK, I think we could just remove that function from there to install 'ExtraMarkups', since that extension is now marked as dependency in SlicerVMTK.

Secondarily, I'll request addition of that function, corrected, in Slicer : where in Slicer ? In which generic library ?

@lassoan
Copy link
Contributor

lassoan commented Mar 24, 2023

At build time (and so during all testing performed at build time), extension dependencies are not installed (regardless of you list them in the dependencies or not). Therefore, you must exclude all tests from running automatically during build that require other extensions. See more details in this issue: #6529

chir-set added a commit to chir-set/SlicerExtension-VMTK that referenced this issue Mar 24, 2023
Extension 'ExtraMarkups' is being checked and installed from server if
necessary. This can block the extension index waiting for user input :

See Slicer/Slicer#6912
@lassoan
Copy link
Contributor

lassoan commented Mar 24, 2023

Ideally, the function should be contributed to Slicer itself.

Most extensions are implemented in Python and our recommendation has been to follow the example in the script repository. However, the example does not include the user confirmation popup, so users may forget about making it non-interactive in testing mode.

To allow harmonizing the behavior between C++ and Python and between all extensions, I agree that it would be better to add a helper function to the extensions manager. We could start from the helper function that in VMTK. @chir-set would you like to submit a pull request to Slicer that adds the method you implemented?

@chir-set
Copy link
Contributor

@chir-set would you like to submit a pull request to Slicer that adds the method you implemented?

I can, but it is not a problem at all if it's not me.

Can you check this PR for a final resolution of this issue ?

@lassoan
Copy link
Contributor

lassoan commented Mar 24, 2023

I've realized why this is not needed ever for C++ extensions!

A C++ module is not even loaded if dependent DLLs are not found. Therefore, it cannot install missing extensions. Therefore, the helper function can be kept in Python. No need to add it to the C++ implementation.

@chir-set
Copy link
Contributor

In fine, what should I do for this issue ?

@lassoan
Copy link
Contributor

lassoan commented Mar 24, 2023

All you need to do is to remove qSlicerStenosisMeasurement3DModuleWidget::installExtensionFromServer from your module.

We can later consider adding a Python function to harmonize how extensions are installed in Python.

@chir-set
Copy link
Contributor

remove qSlicerStenosisMeasurement3DModuleWidget::installExtensionFromServer

Yes, simplest solution.

@jcfr
Copy link
Member Author

jcfr commented Mar 24, 2023

re: install from c++

If functionality provided by an extension at runtime (e.g markups, dicom plugin,..) are relevant for a workflow.

Installing them at runtime without a hard requirement at build time is sensible.

While it doesn't have to happen to address this specific issue, I still think we should add the function to the extension manager, it will be useful when adding a metadata like runtime_depends

chir-set added a commit to chir-set/SlicerExtension-VMTK that referenced this issue Mar 24, 2023
Extension 'ExtraMarkups' is being checked and installed from server if
necessary. This can block the extension index waiting for user input :

See Slicer/Slicer#6912

'ExtraMarkups' is now a dependency of SlicerVMTK and is installed altogether in the GUI.
@lassoan
Copy link
Contributor

lassoan commented Mar 24, 2023

Until now the need for installing an extension in C++ has not come up, but I agree that in theory such use cases are possible (for example, a C++ module using a module implemented in Python).

chir-set added a commit to vmtk/SlicerExtension-VMTK that referenced this issue Mar 24, 2023
Extension 'ExtraMarkups' is being checked and installed from server if
necessary. This can block the extension index waiting for user input :

See Slicer/Slicer#6912

'ExtraMarkups' is now a dependency of SlicerVMTK and is installed altogether in the GUI.
chir-set added a commit to chir-set/SlicerExtension-VMTK that referenced this issue Mar 27, 2023
Extension 'ExtraMarkups' is being checked and installed from server if
necessary. This can block the extension index waiting for user input :

See Slicer/Slicer#6912

'ExtraMarkups' is now a dependency of SlicerVMTK and is installed altogether in the GUI.
@jcfr
Copy link
Member Author

jcfr commented Jun 20, 2023

Update documentation to mention that extensions should not be installed as part of the tests.

This means that dialog asking user to install extensions should be conditional implementing
code like the following:

  bool isTestingEnabled = qSlicerApplication::testAttribute(qSlicerCoreApplication::AA_EnableTesting);
  if (isTestingEnabled)
    {
    // Do not block the execution with popup windows if testing mode is enabled.
    return;
    }

@chir-set
Copy link
Contributor

Update documentation to mention that extensions should not be installed as part of the tests.

This means that dialog asking user to install extensions should be conditional implementing code like the following:

  bool isTestingEnabled = qSlicerApplication::testAttribute(qSlicerCoreApplication::AA_EnableTesting);
  if (isTestingEnabled)
    {
    //...

Hi @jcfr,

I'm abroad right now without any PC. I'll look into that in 2 weeks. cdash doesn't report a build failure for SlicerVMTK nor ExtraMarkups AFAIU.

@chir-set
Copy link
Contributor

chir-set commented Jul 9, 2023

This means that dialog asking user to install extensions should be conditional implementing code like the following:

  bool isTestingEnabled = qSlicerApplication::testAttribute(qSlicerCoreApplication::AA_EnableTesting);

Ideally, the function should be contributed to Slicer itself.

Hi @jcfr ,

Is this patch what you meant ?

Regards.

@lassoan
Copy link
Contributor

lassoan commented Jul 9, 2023

The application should not work very differently in testing mode. Skipping display of an information/confirmation popup is a minor behavior change, which should be fine. However, silently not installing dependencies of an extension would be a major behavior change, which should not be done just because we are in testing mode.

@chir-set
Copy link
Contributor

chir-set commented Jul 9, 2023

silently not installing dependencies of an extension... should not be done

The patch now shows dialog boxes when not in testing mode, and always installs a requested extension.

@lassoan lassoan removed the Priority: High Significant problem or regression label Jul 26, 2023
@jcfr jcfr modified the milestones: Slicer 5.3, Slicer 5.5 Aug 1, 2023
@jcfr
Copy link
Member Author

jcfr commented Aug 1, 2023

Can you check this PR for a final resolution of this issue ?

@chir-set Thanks for creating the branch, the corresponding changes have been reviewed and contributed in a dedicated pull request:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Bug Something isn't working correctly
Development

Successfully merging a pull request may close this issue.

3 participants