Cannot use docker + ipdb with nameko?

I have just started to use Namkeo to build a new app I am working on. It is
very impressive and works well as an RPC client for micro-servicing.

I'm seeming to have quite a specific issue. I have setup my app so each
micro-service is in its own docker container (built via docker-compose). In
the docker-compose run command I am using --service-ports so as to allow
the use of ipdb within the container.

If I just invoke ipdb within python in the container it works and is
interactive as expected. If I run the nameko service in the container that
also works and connects to the other containers via a rabbit network I have
setup.

The issue is that using ipdb WITH nameko (in a docker container) doesn't
work, the ipdb console appears but doesn't let me type anything:

<https://lh3.googleusercontent.com/-T0b3orx1zis/WDwj3_Mb8XI/AAAAAAAAACM/wVrXd32SoHYx20p0_R3eRZbpTi8GrRehwCLcB/s1600/Screen%2BShot%2B2016-11-27%2Bat%2B21.23.59.png>

I have narrowed it down to be because of the eventlet.monkey_patch()
function run within the cli run function. If I don't use eventlet and just
try service_runner.start(), service_runner.wait() my service runs but does
not pick up messages from the rabbit queue.

Any ideas how to get around / fix this issue? Ideally I wouldn't use
eventlets at all and instead have a simple function that runs my service
(like below) but this doesn't seem to work (with or without runner.wait()
at the end):

def run_services(services, cfg=None):
    if not cfg:
        cfg = {'AMQP_URI': 'amqp://guest:guest@rabbitmq:5672'}

    runner = ServiceRunner(config=cfg)

    for service in services:
        runner.add_service(service)

    runner.start()
    runner.wait()

I will very much appreciate help on this, it is blocking my entire
application development! Thank you very much.

Nameko depends on eventlet for all of its core functionality. You cannot
just remove it and expect things to work.

It's entirely possible that eventlet isn't compatible with ipdb. It may be
possible to workaround, but would require some research. A better
workaround (than removing eventlet) is to use a different debugger, like
pdb from the standard library (`import pdb; pdb.set_trace()`)

Personally I also use pdb++ (https://pypi.python.org/pypi/pdbpp/\) which
works fine

Best,
David

···

On Monday, 28 November 2016 12:37:42 UTC, steveb...@gmail.com wrote:

I have just started to use Namkeo to build a new app I am working on. It
is very impressive and works well as an RPC client for micro-servicing.

I'm seeming to have quite a specific issue. I have setup my app so each
micro-service is in its own docker container (built via docker-compose). In
the docker-compose run command I am using --service-ports so as to allow
the use of ipdb within the container.

If I just invoke ipdb within python in the container it works and is
interactive as expected. If I run the nameko service in the container that
also works and connects to the other containers via a rabbit network I have
setup.

The issue is that using ipdb WITH nameko (in a docker container) doesn't
work, the ipdb console appears but doesn't let me type anything:

<https://lh3.googleusercontent.com/-T0b3orx1zis/WDwj3_Mb8XI/AAAAAAAAACM/wVrXd32SoHYx20p0_R3eRZbpTi8GrRehwCLcB/s1600/Screen%2BShot%2B2016-11-27%2Bat%2B21.23.59.png&gt;

I have narrowed it down to be because of the eventlet.monkey_patch()
function run within the cli run function. If I don't use eventlet and just
try service_runner.start(), service_runner.wait() my service runs but does
not pick up messages from the rabbit queue.

Any ideas how to get around / fix this issue? Ideally I wouldn't use
eventlets at all and instead have a simple function that runs my service
(like below) but this doesn't seem to work (with or without runner.wait()
at the end):

def run_services(services, cfg=None):
    if not cfg:
        cfg = {'AMQP_URI': 'amqp://guest:guest@rabbitmq:5672'}

    runner = ServiceRunner(config=cfg)

    for service in services:
        runner.add_service(service)

    runner.start()
    runner.wait()

I will very much appreciate help on this, it is blocking my entire
application development! Thank you very much.

Hi David,

Thank you very much for your prompt response. pdbpp seems to work fine,
looks like I'll be converting to that! :slight_smile:

Kind Regards,
Steve

···

On Monday, November 28, 2016 at 1:19:54 PM UTC, David Szotten wrote:

Nameko depends on eventlet for all of its core functionality. You cannot
just remove it and expect things to work.

It's entirely possible that eventlet isn't compatible with ipdb. It may be
possible to workaround, but would require some research. A better
workaround (than removing eventlet) is to use a different debugger, like
pdb from the standard library (`import pdb; pdb.set_trace()`)

Personally I also use pdb++ (https://pypi.python.org/pypi/pdbpp/\) which
works fine

Best,
David

On Monday, 28 November 2016 12:37:42 UTC, steveb...@gmail.com wrote:

I have just started to use Namkeo to build a new app I am working on. It
is very impressive and works well as an RPC client for micro-servicing.

I'm seeming to have quite a specific issue. I have setup my app so each
micro-service is in its own docker container (built via docker-compose). In
the docker-compose run command I am using --service-ports so as to allow
the use of ipdb within the container.

If I just invoke ipdb within python in the container it works and is
interactive as expected. If I run the nameko service in the container that
also works and connects to the other containers via a rabbit network I have
setup.

The issue is that using ipdb WITH nameko (in a docker container) doesn't
work, the ipdb console appears but doesn't let me type anything:

<https://lh3.googleusercontent.com/-T0b3orx1zis/WDwj3_Mb8XI/AAAAAAAAACM/wVrXd32SoHYx20p0_R3eRZbpTi8GrRehwCLcB/s1600/Screen%2BShot%2B2016-11-27%2Bat%2B21.23.59.png&gt;

I have narrowed it down to be because of the eventlet.monkey_patch()
function run within the cli run function. If I don't use eventlet and just
try service_runner.start(), service_runner.wait() my service runs but does
not pick up messages from the rabbit queue.

Any ideas how to get around / fix this issue? Ideally I wouldn't use
eventlets at all and instead have a simple function that runs my service
(like below) but this doesn't seem to work (with or without runner.wait()
at the end):

def run_services(services, cfg=None):
    if not cfg:
        cfg = {'AMQP_URI': 'amqp://guest:guest@rabbitmq:5672'}

    runner = ServiceRunner(config=cfg)

    for service in services:
        runner.add_service(service)

    runner.start()
    runner.wait()

I will very much appreciate help on this, it is blocking my entire
application development! Thank you very much.