DrQueueIPython icon indicating copy to clipboard operation
DrQueueIPython copied to clipboard

"--no-ssh" not working ?!?

Open jedie opened this issue 10 years ago • 7 comments

I start the client on windows with: python.exe Scripts\drqueue --verbose --no-ssh slave

i see the message "Waiting for SSH tunnel to start up . . ."

So: https://github.com/kaazoo/DrQueueIPython/blob/3b08a0a9ce0231a70c5f93f0017089fb99792169/bin/drqueue#L1015-L1020 is running?!?

jedie avatar Jul 31 '15 14:07 jedie

The line in https://github.com/kaazoo/DrQueueIPython/blob/3b08a0a9ce0231a70c5f93f0017089fb99792169/bin/drqueue#L242 is responsible.

It should only the SSH tunnel if '--no-ssh' was not requested AND you are running the master AND you are connecting to localhost.

Please provide full verbose output.

kaazoo avatar Aug 03 '15 20:08 kaazoo

I tried it out on my machine and did some changes in f7f6f61.

If you start the master via drqueue master -v --no-ssh, it won't fill out the 'ssh' line in IPYTHONDIR/profile_default/security/ipcontroller-engine.json . This will make the slave started via drqueue slave -v not open a SSH tunnel (for both MongoDB and registration to the ipcontroller process inside the master).

If you start the master via drqueue master -v, it will fill out the 'ssh' line with 'user@host'. The slave started by drqueue slave -v will not open a SSH tunnel (for both MongoDB and registration to the ipcontroller process inside the master) when it realizes that it's running on the same machine.

If you want to force the slave to start without SSH, you can also use drqueue slave -v --no-ssh.

Please test with my changes.

kaazoo avatar Aug 04 '15 06:08 kaazoo

First: I don't want to skip "ssh", really... But it seems just to be a simpler way to start the windows/linux variant. Setup sshfs on windows seems to be not easy. https://ssl.drqueue.org/redmine/projects/drqueueipython/wiki/SetupAndConfiguration#Windows-7-Python-27 says i have to install four different packages for this...

If you start the master via drqueue master -v --no-ssh, it won't fill out the 'ssh' line in IPYTHONDIR/profile_default/security/ipcontroller-engine.json . This will make the slave started via drqueue slave -v not open a SSH tunnel (for both MongoDB and registration to the ipcontroller process inside the master).

This seems not to work here. I start master with "--no-ssh" but it adds the "ssh" key to "ipcontroller-engine.json" :(

...some minutes later...

I found the problem in parsing the augments! I add some debug prints:

    print('DEBUG: sys.argv:', sys.argv)
    print('DEBUG: args:', args)

and the output is:

+ drqueue -v --no-ssh master
DEBUG: sys.argv: ['/home/jens/DrQueue_env/bin/drqueue', '-v', '--no-ssh', 'master']
DEBUG: args: Namespace(func=<function master_daemon at 0xb652daac>, no_ssh=False, verbose=False)

So, it can't work. But why are the cmd aguments not parsed?!?

btw. i would suggest to use "click": http://click.pocoo.org/ for the cli! Really nice solution!

EDIT: Found the problem: I started with: drqueue -v --no-ssh master but i have to start with: drqueue master -v --no-ssh ! e.g.:

+ drqueue master -v --no-ssh
DEBUG: sys.argv: ['/home/jens/DrQueue_env/bin/drqueue', 'master', '-v', '--no-ssh']
DEBUG: args: Namespace(func=<function master_daemon at 0xb653daac>, no_ssh=True, verbose=True)

That's bad, isn't it?

jedie avatar Aug 04 '15 08:08 jedie

OK, after change the cli args with https://github.com/jedie/DrQueueHelperFiles/commit/02c53658898240ef3e4981c4e5e9f383cf3ad94e i see some connection activity on master:

==> ipcontroller.log <==
2015-08-04 11:16:05.953 [IPControllerApp] client::client '3b58c1a1-40ab-4f18-b3c9-8c6b0e33c9a4' requested u'registration_request'
2015-08-04 11:16:06.078 [IPControllerApp] WARNING | iopub::IOPub message lacks parent: {'parent_header': {}, 'msg_type': u'status', 'msg_id': u'b39cb24e-91fb-4dee-bd9e-1f3bbfcfb5fb', 'content': {u'execution_state': u'starting'}, 'header': {u'date': datetime.datetime(2015, 8, 4, 11, 16, 7, 557000), u'username': u'username', u'session': u'3b58c1a1-40ab-4f18-b3c9-8c6b0e33c9a4', u'msg_id': u'b39cb24e-91fb-4dee-bd9e-1f3bbfcfb5fb', u'msg_type': u'status'}, 'buffers': [], 'metadata': {}}
2015-08-04 11:16:10.572 [IPControllerApp] registration::finished registering engine 0:3b58c1a1-40ab-4f18-b3c9-8c6b0e33c9a4
2015-08-04 11:16:10.574 [IPControllerApp] engine::Engine Connected: 0

But slave raise immediately a traceback:

ipengine -s c:\users\jens\appdata\roaming\drqueue_env\src\drqueueipython\EGG-INFO\scripts\get_slave_information.py --ssh=
IPython engine started with PID 2656. Logging to Q:\logs\ipengine_192.168.7.12.log.
Traceback (most recent call last):
  File "Scripts\drqueue", line 6, in <module>
    exec(compile(open(__file__).read(), __file__, 'exec'))
  File "C:\Users\jens\AppData\Roaming\DrQueue_env\src\drqueueipython\bin\drqueue", line 1047, in <module>
    main()
  File "C:\Users\jens\AppData\Roaming\DrQueue_env\src\drqueueipython\bin\drqueue", line 272, in main
    args.func(args)
  File "C:\Users\jens\AppData\Roaming\DrQueue_env\src\drqueueipython\bin\drqueue", line 971, in slave_daemon
    os.waitpid(IPENGINE_PID, 0)
OSError: [Errno 10] No child processes

jedie avatar Aug 04 '15 09:08 jedie

Please have a look in get_slave_information.py for any Windows-incompatible stuff.

kaazoo avatar Aug 04 '15 16:08 kaazoo

os.waitpid(IPENGINE_PID, 0) OSError: [Errno 10] No child processes

Is fixed with: https://github.com/jedie/DrQueueIPython/commit/69cbb6148ff988b963e5f02f034847584a33d753

jedie avatar Aug 04 '15 17:08 jedie

I added your changes: e686d09e0e9be8d86f6a9229dc177542676a1887 However, os.waitpid() is also used a couple of times in the signal handlers of master and slave.

kaazoo avatar Aug 16 '15 19:08 kaazoo