View Issue Details

IDProjectCategoryView StatusLast Update
0002251Slicer4Core: Extensionspublic2012-09-27 05:19
ReporterfedorovAssigned Tojcfr 
PrioritynormalSeverityminorReproducibilityalways
Status closedResolutionfixed 
Product VersionSlicer 4.1.1 
Target VersionSlicer 4.2.0Fixed in VersionSlicer 4.2.0 
Summary0002251: slicer.modules is not initialized when queried from extension
Description

my module relies on getting its logic in init as follows:

logic = slicer.modules.mymodule.logic()

which currently fails

TagsNo tags attached.

Relationships

parent of 0002542 closedjcfr Python error are not reported when widget generic cxx test is associated with ScriptedWidget 
related to 0002269 closedmillerjv many extensions are missing 

Activities

nicole

nicole

2012-07-12 07:57

administrator   ~0005125

I found that if I added this line to the add pyton test line in the Testing directory CMakeLists.txt file:

SLICER_ARGS --additional-module-paths ${CMAKE_BINARY_DIR}/lib/Slicer-4.1/qt-loadable-module

the reporting module would be found and loaded and the logic found for my test. It looks like because the testing automatically ignores the slicerrc file, the extra module path that pointed to the reporting module wasn't being set (I didn't install Reporting as an extension, just built it outside of Slicer and added the additional module path).

nicole

nicole

2012-07-12 09:39

administrator   ~0005127

Last edited: 2012-07-12 09:53

For the generic tests, the Reporting-build/AdditionalLauncherSettings.ini file does have additional paths in it, but the first ones in the library paths reference the cli specific paths that the loadable Reporting module doesn't have, and the path setting doens't include the loadable path at all:

[LibraryPaths]
1\path=/projects/birn/nicole/Slicer4/Reporting-build/lib/Slicer-4.1/cli-modules/.
2\path=/projects/birn/nicole/Slicer4/Reporting-build/lib/Slicer-4.1/qt-loadable-modules/.
size=2

[Paths]
1\path=/projects/birn/nicole/Slicer4/Reporting-build/lib/Slicer-4.1/cli-modules/.
size=1

I tried adding the loadable modules bin dir to SlicerBlockAdditionalLauncherSettings.cmake
but it didn't fix the problem with the generic module tests for the reporting module:
[LibraryPaths]
1\path=/projects/birn/nicole/Slicer4/Reporting-build/lib/Slicer-4.1/cli-modules/.
2\path=/projects/birn/nicole/Slicer4/Reporting-build/lib/Slicer-4.1/qt-loadable-modules/.
size=2

[Paths]
1\path=/projects/birn/nicole/Slicer4/Reporting-build/lib/Slicer-4.1/cli-modules/.
2\path=/projects/birn/nicole/Slicer4/Reporting-build/lib/Slicer-4.1/qt-loadable-modules/.
size=2

fedorov

fedorov

2012-07-12 09:43

developer   ~0005128

Should the cmake macro be modified to always include the paths that can be populated by a module?

In Slicer-build/lib/Slicer-4.1 these are

ITKFactories cli-modules qt-loadable-modules qt-scripted-modules

Should they all be added for an extension in <my-module-build>/lib/Slicer-4.1 ?

jcfr

jcfr

2012-07-26 02:21

administrator   ~0005246

Fixed in r20697

See the following commits:
http://viewvc.slicer.org/viewvc.cgi/Slicer4?view=revision&revision=20697
http://viewvc.slicer.org/viewvc.cgi/Slicer4?view=revision&revision=20696
http://viewvc.slicer.org/viewvc.cgi/Slicer4?view=revision&revision=20695

nicole

nicole

2012-07-26 09:43

administrator   ~0005259

Last edited: 2012-07-26 11:10

The commits haven't fixed the Reporting module py_ReportingRoundTripTest so that it actually runs for me.

Slicer starts up and instantiates the Reporting module, but the test print outs don't show up on the console, nor does the test CTK DICOM database get created. That last is assumed by the fact that, at exit, there's only a message about the Reporting database being still active, nothing about the ReportingTesting database that the test is supposed to create/open.
I currently use a default location of /projects/igtdev/nicole/LocalDCMDB for the module database during regular run (since the slicerrc is ignored and my setting isn't loaded this default value gets used in the test). The test is supposed to create the db in
dbpath = slicer.app.slicerHome + '/Testing/Temporary/TestingDCMDB/ctkDICOM.sql'

Selected output from running the test after updating to 20700:

5: Loading module "Reporting"
5: Warning: In /projects/birn/nicole/Slicer4/Reporting/Logic/vtkSlicerReportingModuleLogic.cxx, line 138
5: vtkSlicerReportingModuleLogic (0x4dec790): InitializeDICOMDatabase: no DatabaseDirectory path found, please update the settings.
5: Using /projects/igtdev/nicole/LocalDCMDB
5:
[...]
5: Loading module "WebGLExport"
5: Loading module "Welcome"
5: Number of loaded modules: 34
5: Uninstantiating: "Welcome"
5: Uninstantiating: "WebGLExport"
[...]
5: Uninstantiating: "Reporting"
[...]
5: Uninstantiating: "CropVolume"
5: QSqlDatabasePrivate::removeDatabase: connection 'Reporting' is still in use, all queries will cease to work.
1/1 Test 0000005: py_ReportingRoundTripTest ........ Passed 16.38 sec

If I take out the passing of additional module paths to the python test (changing the CMakeLists.txt file slicer_add_python_unittest line), it fails to find the logic for the Reporting module:

5: ****
5: Executing string with python code: import slicer.testing; slicer.testing.runUnitTest(['/projects/birn/nicole/Slicer4/Reporting-build/Testing/Python', '/projects/birn/nicole/Slicer4/Reporting/Testing/Python'], 'ReportingRoundTripTest')
5: **
5: runUnitTest, path =
5: ['/projects/birn/nicole/Slicer4/Reporting-build/Testing/Python', '/projects/birn/nicole/Slicer4/Reporting/Testing/Python']
5: testname = ReportingRoundTripTest
5: -------------------------------------------
5: path: ['/projects/birn/nicole/Slicer4/Reporting-build/Testing/Python', '/projects/birn/nicole/Slicer4/Reporting/Testing/Python']
5: testname: ReportingRoundTripTest
5: -------------------------------------------
5: test_RoundTrip (ReportingRoundTripTest.ReportingTesting) ... ERROR
5:
5: ======================================================================
5: ERROR: test_RoundTrip (ReportingRoundTripTest.ReportingTesting)
5: ----------------------------------------------------------------------
5: Traceback (most recent call last):
5: File "/projects/birn/nicole/Slicer4/Reporting/Testing/Python/ReportingRoundTripTest.py", line 27, in test_RoundTrip
5: l = slicer.modules.reporting.logic()
5: AttributeError: 'module' object has no attribute 'reporting'
5:
5: ----------------------------------------------------------------------
5: Ran 1 test in 0.012s
5:
5: FAILED (errors=1)
5: Traceback (most recent call last):
5: File "<string>", line 1, in <module>
5: File "/projects/birn/nicole/Slicer4/S4-SuperBuild/Slicer-build/bin/Python/slicer/testing.py", line 26, in runUnitTest
5: exitFailure()
5: File "/projects/birn/nicole/Slicer4/S4-SuperBuild/Slicer-build/bin/Python/slicer/testing.py", line 10, in exitFailure
5: raise Exception(message)
5: Exception

I checked in the change in the Reporting/Testing/Python/CMakeLists.txt that will make the test fail more obviously.

fedorov

fedorov

2012-07-27 15:33

developer   ~0005301

See the dashboard build with the test failing to find slicer.modules.reporting.logic() here:

http://slicer.cdash.org/testDetails.php?test=2534885&build=30461

jcfr

jcfr

2012-07-27 19:21

administrator   ~0005432

Fixed in topic "22-fix-ReportingRoundTripTest"
See https://github.com/fedorov/Reporting/issues/22
and https://github.com/jcfr/Reporting/compare/22-fix-ReportingRoundTripTest

jcfr

jcfr

2012-07-27 19:26

administrator   ~0005433

I also created the corresponding issue on the ExtensionsIndex. See https://github.com/Slicer/ExtensionsIndex/issues/42

jcfr

jcfr

2012-07-28 00:05

administrator   ~0005435

Commit r20710 will resolve the related issue described here:

https://github.com/fedorov/Reporting/issues/22#issuecomment-7331259

See http://viewvc.slicer.org/viewvc.cgi/Slicer4?view=revision&revision=20710

fedorov

fedorov

2012-08-05 18:17

developer   ~0005499

It is not clear how to pass additional module paths to generic unti tests, is this possible?

My python module needs to load Editor module, if I specify the module path explicitly in a test macro, it works, but I can only do this for non-generic tests.

Also, the generic tests cannot load Editor module, give errors and should be failing, but instead they pass when I run ctest.

fedorov

fedorov

2012-08-05 18:27

developer   ~0005500

Here's example output (Reporting extension from this commit https://github.com/fedorov/Reporting/commit/58aa91405883ab3820f9fcfc6f1d02a1373eff8d):

1: Test command: /Users/fedorov/github/Slicer-Superbuild-Debug-Qt-Debug/Slicer-build/Slicer "--launcher-no-splash" "--launcher-additional-settings" "/Users/fedorov/github/Reporting-build-Release-Qt-Debug/AdditionalLauncherSettings.ini" "--launch" "/Users/fedorov/github/Reporting-build-Release-Qt-Debug/Testing/Cxx/qSlicerReportingModuleCxxTests" "qSlicerReportingModuleGenericTest"
1: Test timeout computed to be: 1500
1: [Reporting 08/05/2012 22:24:10]: WARNING: DICOM Database is not accessible.
1: PythonQt: QObject::connect() signal 'mrmlSceneChanged(vtkMRMLScene)' does not exist on qMRMLNodeComboBox
1: PythonQt: QObject::connect() signal 'mrmlSceneChanged(vtkMRMLScene
)' does not exist on qMRMLNodeComboBox
1: PythonQt: QObject::connect() signal 'destroyed(QObject)' does not exist on QFrame
1: ERROR: In /Users/fedorov/github/Reporting/Logic/vtkSlicerReportingModuleLogic.cxx, line 1681
1: vtkSlicerReportingModuleLogic (0x115ab0320): GetActiveReportHierarchyID: no parameter reportID on node with id vtkMRMLScriptedModuleNode1
1:
1:
1: PythonQt: QObject::connect() signal 'destroyed(QObject)' does not exist on QFrame
1: Traceback (most recent call last):
1: File "/Users/fedorov/github/Reporting-build-Release-Qt-Debug/lib/Slicer-4.1/qt-loadable-modules/Python/qSlicerReportingModuleWidget.py", line 189, in setup
1: self.__editorWidget.setup()
1: File "/Users/fedorov/github/Slicer-Superbuild-Debug-Qt-Debug/Slicer-build/lib/Slicer-4.1/qt-scripted-modules/Editor.py", line 213, in setup
1: self.helper.mergeValidCommand = self.updateLabelFrame
1: AttributeError: 'NoneType' object has no attribute 'mergeValidCommand'
1/2 Test 0000001: qSlicerReportingModuleGenericTest ......... Passed 5.76 sec

This should NOT Pass!

jcfr

jcfr

2012-09-25 14:24

administrator   ~0006213

Fixed in r21046
See http://viewvc.slicer.org/viewvc.cgi/Slicer4?view=revision&revision=21046

Consider also topic associated with Reporting module. See https://github.com/jcfr/Reporting/compare/12-fix-testing-for-out-of-slicer-source-build

fedorov

fedorov

2012-09-26 18:43

developer   ~0006233

JC, I updated the trunk and merged your fixes to Reporting, but when I run RoundTripTest, there is no evidence the test actually runs -- no print() statements show up, and the test passes:

https://github.com/fedorov/Reporting/blob/master/Testing/Python/ReportingRoundTripTest.py

So I do not know if the issue with uninitialized logic() is fixed, because I do not know if the test is running.

jcfr

jcfr

2012-09-26 20:44

administrator   ~0006236

Fixed in r21066
See http://viewvc.slicer.org/viewvc.cgi/Slicer4?view=revision&revision=21066

Consider also the following commit to fix the Reporting module. See https://github.com/jcfr/Reporting/commit/ae2cfdf52138a606df4045d4154931599c68e6ea

fedorov

fedorov

2012-09-27 05:19

developer   ~0006237

Thank you

Issue History

Date Modified Username Field Change
2012-06-22 07:22 fedorov New Issue
2012-06-22 07:22 fedorov Status new => assigned
2012-06-22 07:22 fedorov Assigned To => jcfr
2012-06-27 11:09 fedorov Relationship added related to 0002269
2012-07-12 07:57 nicole Note Added: 0005125
2012-07-12 09:39 nicole Note Added: 0005127
2012-07-12 09:43 fedorov Note Added: 0005128
2012-07-12 09:52 nicole Note Edited: 0005127
2012-07-12 09:53 nicole Note Edited: 0005127
2012-07-26 02:21 jcfr Note Added: 0005246
2012-07-26 02:21 jcfr Status assigned => resolved
2012-07-26 02:21 jcfr Fixed in Version => Slicer 4.2.0 - October 1st 2012
2012-07-26 02:21 jcfr Resolution open => fixed
2012-07-26 06:06 fedorov Status resolved => closed
2012-07-26 09:43 nicole Note Added: 0005259
2012-07-26 09:44 nicole Status closed => assigned
2012-07-26 09:44 nicole Resolution fixed => reopened
2012-07-26 11:10 nicole Note Edited: 0005259
2012-07-27 15:33 fedorov Note Added: 0005301
2012-07-27 19:21 jcfr Note Added: 0005432
2012-07-27 19:21 jcfr Status assigned => resolved
2012-07-27 19:21 jcfr Resolution reopened => fixed
2012-07-27 19:21 jcfr Target Version => Slicer 4.2.0 - October 1st 2012
2012-07-27 19:26 jcfr Note Added: 0005433
2012-07-28 00:05 jcfr Note Added: 0005435
2012-07-28 21:41 fedorov Status resolved => closed
2012-07-28 21:41 fedorov Fixed in Version Slicer 4.2.0 - October 1st 2012 => Slicer 4.1.2 - August
2012-08-05 18:17 fedorov Note Added: 0005499
2012-08-05 18:17 fedorov Status closed => feedback
2012-08-05 18:17 fedorov Resolution fixed => reopened
2012-08-05 18:27 fedorov Note Added: 0005500
2012-08-28 01:47 jcfr Fixed in Version Slicer 4.1.2 - August => Slicer 4.2.0 - Feature freeze Sept 1st 2012
2012-09-21 10:54 jcfr Relationship added parent of 0002542
2012-09-25 14:24 jcfr Note Added: 0006213
2012-09-25 14:24 jcfr Status feedback => resolved
2012-09-25 14:24 jcfr Resolution reopened => fixed
2012-09-26 18:43 fedorov Note Added: 0006233
2012-09-26 18:43 fedorov Status resolved => feedback
2012-09-26 18:43 fedorov Resolution fixed => reopened
2012-09-26 20:44 jcfr Note Added: 0006236
2012-09-26 20:44 jcfr Status feedback => resolved
2012-09-26 20:44 jcfr Resolution reopened => fixed
2012-09-27 05:19 fedorov Note Added: 0006237
2012-09-27 05:19 fedorov Status resolved => closed