[GRASS-dev] tests failed

Sören Gebbert soerengebbert at googlemail.com
Fri Oct 24 03:56:16 PDT 2014


Hi,

2014-10-24 12:04 GMT+02:00 Pietro <peter.zamb at gmail.com>:
> On Thu, Oct 23, 2014 at 9:25 PM, Martin Landa <landa.martin at gmail.com> wrote:
>> 2014-10-23 21:10 GMT+02:00 Anna Petrášová <kratochanna at gmail.com>:
>>> it seems that
>>>
>>> http://trac.osgeo.org/grass/changeset/62349
>>>
>>> causes a lot failures. Problems are in some temporal modules, pygrass and
>>> gunittests tests.
>>
>> hm, Soeren/Pietro any idea why it fails? Thanks, Martin
>
> yes I think it fails because has broken the "pickability" of the
> Module instance.
> It should be fix in r62374.

Thats an interesting approach, very sophisticated. However, the direct use of
the "get_msgr()" function would solve the problem as well. :)

For explanation: the messenger module creates pipes, locks and
subprocesses and somehow you cant use them when the object that
contains them should be serialized.
The error is that Python lock objects should only be shared between
processes through inheritance.
The problem is IMHO not related to ctypes, since ctypes is used in the
subprocess that communicates via pipes with the messenger (main
process).

>
> However, I would like to revert your change... :-)
>
> Introduce the debug message in the Module class it is a bad idea
> because in this way also Module class is indirectly using ctypes.
> Therefore all the work done to distinguish and isolate pygrass'
> submodules that are using the ctypes is not valid any more.
>
> Finally, I wrote a method decorator to add a debug message, this
> function it is general enough to be used outside pygrass, but again it
> is using ctypes that could be a problem if in a gui etc.
>
> Otherwise we can modify the Messenger class to avoid to use the ctypes.

Ctypes is IMHO not the problem here, since it is used in the messenger
subprocess.
No GRASS library function is called in the main Python process.
This is a principal design of an RPC approach.

>
> I don't know which option of the above is the right choice...

The decorator looks nice, but using get_msgr() that uses a singleton
approach directly should work as well.
It is important that messenger objects are NOT part of objects that
should be serialized.

Hence do not:
self._msgr = get_msgr()
self._msgr.debug(0, "Hello")

Use instead:
 get_msgr().debug(0, "Hello")

Or like this:
from grass.pygrass.messages import get_msgr as msgr
msgr().message("Hallo")


Best regards
Soeren

>
> Pietro
> _______________________________________________
> grass-dev mailing list
> grass-dev at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/grass-dev


More information about the grass-dev mailing list