Celery extractor tasks imported with two namespaces
They are listed with both openrem.remapp.extractors.x
and remapp.extractors.x
See https://groups.google.com/d/topic/openrem/U6ngf_Cp_-Q/discussion
Comments (28)
-
reporter -
So commenting out the imports removes the issue but then causes the extractors to stop working. What I had to do was to stop the celery service, comment out the code in __init__.py, restart the celery service (at this point is must discover which tasks are available), then uncomment __init__.py to enable the extractors to function.
(As a side note I left
from rdsr_toshiba_ct_from_dose_images import rdsr_toshiba_ct_from_dose_images
commented out as this was causing errors as it requires JAVA_EXE etc to be in local_settings.py which I didn't have installed. Maybe it should handle the case where rdsr from toshiba is not required/avaliable? Or will the new install docs go about getting these applications installed?)
-
Hi Ben,
You should be able to set
JAVA_EXE
to a dummy string inlocal_settings.py
, as well as some other variables. Defaults are included inlocal_settings.py
in the develop branch:# Locations of various tools for DICOM RDSR creation from CT images DCMTK_PATH = 'C:\\Users\\David\\Apps\\dcmtk-3.6.0-win32-i386\\bin' DCMCONV = os.path.join(DCMTK_PATH, 'dcmconv.exe') DCMMKDIR = os.path.join(DCMTK_PATH, 'dcmmkdir.exe') JAVA_EXE = 'C:\\Users\\David\\Apps\\doseUtility\\windows\\jre\\bin\\java.exe' JAVA_OPTIONS = '-Xms256m -Xmx512m -Xss1m -cp' PIXELMED_JAR = 'C:\\Users\\David\\Apps\\doseUtility\\pixelmed.jar' PIXELMED_JAR_OPTIONS = '-Djava.awt.headless=true com.pixelmed.doseocr.OCR -'
-
Ah ok sorry, I didn't add them in as I wasn't using them, like you say it works fine as long as the dummy settings are there. Thanks!
-
Uncommenting those lines in __init__.py and restarting celery didn't work for me...
-
Are you running a daemonised service out of interest? (Not that it should make much difference I guess).
-
Yes I am, under ubuntu.
-
reporter Explicitly named celery tasks to prevent dual namespace errors. Hopefully. Refs
#567→ <<cset 6f770df2d01b>>
-
reporter Explicitly named celery tasks to prevent dual namespace errors. Hopefully. Refs
#567This time with all the files selected!→ <<cset 0854ad7a2608>>
-
reporter @bearner, @tcdewit - Can you try using the issue567celeryimportnamespace branch to see if everything starts to work?
It differs from the develop branch in the following ways:
- All the shared tasks that are imported in
extractors/__init__.py
are now explicitly named without theopenrem.
prefix - The
tasks.py
imports are slightly re-ordered - I don't expect this to make any difference - The
ptsizecsv2db.py
function has had a little reformatting - I don't expect this to make any difference
- All the shared tasks that are imported in
-
reporter @tcdewit - now that you have fixed the log file permission issue, does this branch give you a sensible list of (working) tasks?
(See comments against 0854ad7a2608)
-
Yes, it’s working now!
-
reporter @bearner if you are able to try this, I'll merge it in if you agree it works. I'll create a PR.
-
I'm still getting the doubling (see my comments on the commit).
@tcdewit when you run:
celery inspect registered
Do you see doubling of tasks? Celery does work for me though.
-
reporter Using
celery multi
start on my development laptop with this branch, thencelery inspect registered
I get the following:* openremproject.celery.debug_task * remapp.exports.ct_export.ct_csv * remapp.exports.ct_export.ctxlsx * remapp.exports.dx_export.dxxlsx * remapp.exports.dx_export.exportDX2excel * remapp.exports.mg_csv_nhsbsp.mg_csv_nhsbsp * remapp.exports.mg_export.exportMG2excel * remapp.exports.rf_export.exportFL2excel * remapp.exports.rf_export.rfopenskin * remapp.exports.rf_export.rfxlsx * remapp.extractors.ct_philips.ct_philips * remapp.extractors.dx.dx * remapp.extractors.mam.mam * remapp.extractors.ptsizecsv2db.websizeimport * remapp.extractors.rdsr.rdsr * remapp.extractors.rdsr_toshiba_ct_from_dose_images.rdsr_toshiba_ct_from_dose_images * remapp.netdicom.keepalive.keep_alive * remapp.netdicom.qrscu.movescu * remapp.netdicom.qrscu.qrscu * remapp.tools.make_skin_map
-
reporter Added ref
#567to changes→ <<cset 5d7529d0cb2c>>
-
reporter - changed status to resolved
-
reporter - changed status to open
Problems found with calling functions from scripts. See https://groups.google.com/d/topic/openrem/Vz6S6UNxz5Q/discussion
-
reporter Explicitly importing extractor functions in import scripts, rather than relying on the
__init__.py
file. Refs#567→ <<cset 8c790c39e46c>>
-
reporter @tcdewit can you take a look at this branch and see if everything starts to work again please?
-
Just did and after some minor adjustments it's indeed working again!
For some reason on my (ubuntu) system the scripts starting with the line
# This Python file uses the following encoding: utf-8
could not be executed. I had to put the interpreter-line on top.
Currently the interpreter is:
#!/usr/local/bin/python
which didn't exist on my system. I had to change it to /usr/bin/python. -
reporter Thanks Tim. See issue
#581 -
reporter And the interpreter line is rewritten when the package is installed by pip to match the current python
-
reporter Changed the scripts so that the interpreter line is first, and the encoding information is on the second line. Refs
#567and#581→ <<cset 8f08a2ed1c8f>>
-
reporter Attending to a couple of trailing white space issues identified by Codacy. Refs
#567→ <<cset db80676b7df2>>
-
reporter - changed status to resolved
Merged in issue567scriptsnotworking (pull request #148)
Fixes
#567(again) and fixes#581→ <<cset bd8559b8b5a9>>
-
reporter Log file was being created because the configuration hadn't been added to my local_settings.py. Added line in release docs. Refs
#579. Added dummy locations for the Toshiba import tools so it doesn't fail if it isn't in local_settings.py and isn't being used. Removed imports in extractors/int.py as they are no longer used due to rewriting the scripts (refs#567)→ <<cset f60a7da98829>>
-
reporter Adding imports in
extractors/__int__.py
back in as they are used by the test functions. Refs#567→ <<cset 8d76cdae52b6>>
- Log in to comment
Source of issue identified by @bearner in the google group thread (thanks Ben!):
I think I might have found the issue. In https://bitbucket.org/openrem/openrem/src/5bfe8f63aa74ec8686cc66de204b586a9277463f/openrem/remapp/extractors/init.py?at=develop&fileviewer=file-view-default
The extractor stuff is getting imported, which doubles them up in the task list like you said. If I comment these lines out then the netdicom imports suddenly appear on the celery tasks list. Not sure I understand why that has that effect but seems to be the cause...
Ben