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

On Fri, Jan 19, 2018 at 12:51 PM, Tim Harsch <[email protected]> wrote:

> 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 <[email protected]> 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 [email protected].
>>> To post to this group, send email to [email protected].
>>> To view this discussion on the web visit https://groups.google.com/d/ms
>>> gid/jupyter/97c1bbb1-ada9-44b0-ad68-aff8b1181e94%40googlegroups.com
>>> <https://groups.google.com/d/msgid/jupyter/97c1bbb1-ada9-44b0-ad68-aff8b1181e94%40googlegroups.com?utm_medium=email&utm_source=footer>
>>> .
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>
>>
>>
>> --
>> Michael Milligan, Ph.D.         | Supercomputing Institute
>> Assistant Director for          | University of Minnesota
>>    Application Development      | [email protected]
>> www.msi.umn.edu/staff/milligan  | Phone: 612-624-8857 <(612)%20624-8857>
>>
> --
> 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 [email protected].
> To post to this group, send email to [email protected].
> To view this discussion on the web visit https://groups.google.com/d/
> msgid/jupyter/8cece011-11eb-4053-86e0-13ca6a0c8cd6%40googlegroups.com
> <https://groups.google.com/d/msgid/jupyter/8cece011-11eb-4053-86e0-13ca6a0c8cd6%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>
> For more options, visit https://groups.google.com/d/optout.
>



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

-- 
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 [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jupyter/CAPuy8goJNim%3DFRC-u2tGCvO6fmV3YsXzgBUKXDxL2Op_EmsrNA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to