[ 
https://issues.apache.org/jira/browse/MESOS-1750?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14120175#comment-14120175
 ] 

Till Toenshoff edited comment on MESOS-1750 at 9/3/14 7:13 PM:
---------------------------------------------------------------

So the following does the job...
{noformat}
python/interface/src/mesos/interface/containerizer_pb2.py:                      
\
                $(CONTAINERIZER_PROTO)
        $(MKDIR_P) $(@D)
        $(PROTOC) -I$(top_srcdir)/include/mesos/containerizer           \
                $(PROTOCFLAGS)                                                  
                \
                --python_out=python/interface/src/mesos/interface $^
                sed -i '' -e 's/mesos\.mesos_pb2/mesos_pb2/' $^
{noformat}

However, I still feel that this is not really *correct* and that we should 
possibly take a step back for finding a proper solution.

Another solution would be adapting the {{mesos/interface}} structure towards a 
non flat hierachy:
{noformat}
mesos/mesos_pb2.py
mesos/containerizer/containerizer_pb2.py
{noformat}

Resulting into rather verbose looking python imports like:
{noformat}
from mesos.interface.mesos.containerizer import containerizer_pb2
from mesos.interface.mesos import mesos_pb2
{noformat}

The above maintains the exact namespace structure we are using for all other 
bindings (but adds {{mesos.interface}} as a prefix). 

I do not see any other options right now and I really would like to ask for 
comments on this.



was (Author: tillt):
So the following does the job...
{noformat}
python/interface/src/mesos/interface/containerizer_pb2.py:                      
\
                $(CONTAINERIZER_PROTO)
        $(MKDIR_P) $(@D)
        $(PROTOC) -I$(top_srcdir)/include/mesos/containerizer           \
                $(PROTOCFLAGS)                                                  
                \
                --python_out=python/interface/src/mesos/interface $^
                sed -i -e 's/mesos\.mesos_pb2/mesos_pb2/' $^
{noformat}

However, I still feel that this is not really *correct* and that we should 
possibly take a step back for finding a proper solution.

Another solution would be adapting the {{mesos/interface}} structure towards a 
non flat hierachy:
{noformat}
mesos/mesos_pb2.py
mesos/containerizer/containerizer_pb2.py
{noformat}

Resulting into rather verbose looking python imports like:
{noformat}
from mesos.interface.mesos.containerizer import containerizer_pb2
from mesos.interface.mesos import mesos_pb2
{noformat}

The above maintains the exact namespace structure we are using for all other 
bindings (but adds {{mesos.interface}} as a prefix). 

I do not see any other options right now and I really would like to ask for 
comments on this.


> ImportError in containerizer_pb2.py
> -----------------------------------
>
>                 Key: MESOS-1750
>                 URL: https://issues.apache.org/jira/browse/MESOS-1750
>             Project: Mesos
>          Issue Type: Bug
>          Components: python api
>            Reporter: Till Toenshoff
>              Labels: mesos.interface, python-egg
>
> It appears as if the split of the Python egg (native/interface/protocol) has 
> introduced a new issue.
> Whenever I am trying to use {{from mesos.interface import 
> containerizer_pb2}}, I am receiving an {{ImportError: No module named 
> mesos_pb2}}.
> For replicating this issue, try running 
> {{"build/src/examples/python/test-containerizer"}}.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to