Invalidate spawn in pre_spawn_hook?

15 views
Skip to first unread message

Tim Harsch

unread,
Jan 19, 2018, 12:06:17 PM1/19/18
to Project Jupyter
Hi all,
Is there a way in the pre_spawn_hook I could invalidate the spawn?   return True/False doesn't work.   I'd like it to ultimately produce a user friendly result to the user if an issue occurs

Thanks,
Tim

Michael Milligan

unread,
Jan 19, 2018, 12:44:34 PM1/19/18
to jup...@googlegroups.com
Hi,

The Spawner's start() function is called unconditionally after pre_spawn_hook() returns, so you're correct that the return value will have no effect. However, if you raise an exception, it will be caught by the app and the associated error message will be logged. There are some cases where exception error messages are displayed to the user. If I'm correctly interpreting the code, in this case a message will be displayed *if* you have a spawner options form set up.

Michael

--
You received this message because you are subscribed to the Google Groups "Project Jupyter" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jupyter+unsubscribe@googlegroups.com.
To post to this group, send email to jup...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jupyter/97c1bbb1-ada9-44b0-ad68-aff8b1181e94%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
Michael Milligan, Ph.D.         | Supercomputing Institute
Assistant Director for          | University of Minnesota
   Application Development      | mill...@umn.edu
www.msi.umn.edu/staff/milligan  | Phone: 612-624-8857

Tim Harsch

unread,
Jan 19, 2018, 1:51:25 PM1/19/18
to Project Jupyter
Thank you Michael, that is very helpful. In this case I am using pre_spawn_hook, in lieu of a spawner options form.   So I think the exceptions are causing havoc to the server.   
I went the route of the pre_spawn_hook because in my case because the user doesn't need to inform the hub of the docker image, it can be done in the hook.   But that's where an issue could arise..  and I'm not sure to handle it gracefully.

Tim


On Friday, January 19, 2018 at 9:44:34 AM UTC-8, Michael Milligan wrote:
Hi,

The Spawner's start() function is called unconditionally after pre_spawn_hook() returns, so you're correct that the return value will have no effect. However, if you raise an exception, it will be caught by the app and the associated error message will be logged. There are some cases where exception error messages are displayed to the user. If I'm correctly interpreting the code, in this case a message will be displayed *if* you have a spawner options form set up.

Michael
On Fri, Jan 19, 2018 at 11:06 AM, Tim Harsch <harsc...@gmail.com> wrote:
Hi all,
Is there a way in the pre_spawn_hook I could invalidate the spawn?   return True/False doesn't work.   I'd like it to ultimately produce a user friendly result to the user if an issue occurs

Thanks,
Tim

--
You received this message because you are subscribed to the Google Groups "Project Jupyter" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jupyter+u...@googlegroups.com.

To post to this group, send email to jup...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jupyter/97c1bbb1-ada9-44b0-ad68-aff8b1181e94%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Michael Milligan

unread,
Jan 20, 2018, 4:41:55 AM1/20/18
to jup...@googlegroups.com
I'm surprised to hear that throwing an exception there causes any havoc; in the code there is a generic exception handler that shouldn't let any uncaught exceptions leak through. There is potential for trouble, though, if you are using a spawner that does some vial initialization during the start() call, such that calling stop() or start_polling() throws an exception if start() was not previously called. If that is what's happening, it would be a bug in the spawner class and you would want to file an issue with the corresponding project.

Michael

To unsubscribe from this group and stop receiving emails from it, send an email to jupyter+unsubscribe@googlegroups.com.

To post to this group, send email to jup...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages