cooperative-computing-lab/cctools — pull request #181 by nfillmore (2013-09-03 01:43:51+00:00)
Title: Add Python 3 support for work_queue library.

Dear CCTools developers,

This pull request is to add Python 3 support for the work_queue library. I have tested this both with one of my own workflows and with the work_queue_example from the documentation.

I know of one flaw with this the Python 3 module built under this pull request:

>>> import work_queue
>>> help(work_queue)
Traceback (most recent call last):
[...]
File "/u/deweylab/sw/python-3.3.2/arch/x86_64-redhat-linux-gnu/lib/python3.3/inspect.py", line 82, in isclass
return isinstance(object, type)
NameError: Unknown C global variable

This seems to be a SWIG bug, and I think it might not show up on all systems. A workaround would be to hide the module members work_queue._work_queue and work_queue.cvar (for example, put them in a submodule), and then perhaps re-expose them using a proxy object. The reason I think this would fix the problem is that the "help" command, via pydoc, runs into the above error while trying to figure out what work_queue._work_queue and work_queue.cvar are instances of - for some reason this is buggy under SWIG. For example:

>>> issubclass(work_queue.cvar, object)
Traceback (most recent call last):
File "", line 1, in
NameError: Unknown C global variable

>>> help(work_queue._work_queue)
Traceback (most recent call last):
[...]
NameError: Unknown C global variable

I am not sure whether it is worth working around the above. It's nice to have the interactive help, but (1) the www documentation is good, (2) individual help commands work, e.g., help(work_queue.WorkQueue) works, and (3) dir(work_queue) also works.

Thanks to all of you for the great tool. So useful!

Nate