Andrew/issue 383 fix hang#384
Conversation
|
|
@ayjayt The pattern of always emitting a warning but silencing it under some circumstances feels backwards to me. Instead, could the |
|
Yeah in general i'm not 100% sure this is the Best API but the warning is only emited either way when the user is calling Open on an already opened instance or close on an already closed instance As for arguments, yes |
|
Right yes by "always" emit a warning I mean always emit when the server is already running. |
| def safe_start_sync_server(*args, **kwargs): | ||
| """ | ||
| Start a kaleido server which will process all sync generation requests. | ||
|
|
||
| Only one server can be started at a time. | ||
| The kaleido server is a singleton, so it can't be opened twice. This | ||
| function will simply return if the server is already running. | ||
|
|
||
| This wrapper function takes the exact same arguments as kaleido.Kaleido(), | ||
| except one extra, `silence_warnings`. | ||
|
|
||
| Args: | ||
| *args: all arguments `Kaleido()` would take. | ||
| silence_warnings: (bool, default False): If True, emit warning if | ||
| starting an already started server. | ||
| **kwargs: all keyword arguments `Kaleido()` would take. | ||
|
|
||
| This wrapper function takes the exact same arguments as kaleido.Kaleido(). | ||
| """ | ||
| _global_server.open(*args, **kwargs) | ||
| _global_server.ensure_opened(*args, **kwargs) |
There was a problem hiding this comment.
@ayjayt This function can be completely removed now, right? And where is stop_sync_server()?
| _global_server.open(*args, **kwargs) | ||
|
|
||
|
|
||
| __all__ = [ |
There was a problem hiding this comment.
Style nit: this should be at the top
Fixes #383
Adds missing argument that allows python to close without awaiting thread.
Also clarifies that the object is a singleton and it can only be started once. However, adds more functions to silence related warnings.
Also adds the atexit concept from mytien.