-
Notifications
You must be signed in to change notification settings - Fork 32
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Tray: Singleton tray #794
Tray: Singleton tray #794
Conversation
Task linked: AY-6113 Singleton tray with API |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall this seemed to work.
- I could not usually launch another tray to the same server
- I was able to launch a dev tray to my dev server, and simultaneously launch one for my production server (both in dev mode)
I did notice that if I run tray very rapidly after each other (e.g. run twice almost at the same time) it gets a bit further, doesn't close down but reaches this error (in console):
Traceback (most recent call last):
File "E:\dev\ayon-core\client\ayon_core\tools\tray\ui\tray.py", line 625, in _on_start_timer
self._tray_widget.initialize_addons()
File "E:\dev\ayon-core\client\ayon_core\tools\tray\ui\tray.py", line 540, in initialize_addons
self._tray_manager.initialize_addons()
File "E:\dev\ayon-core\client\ayon_core\tools\tray\ui\tray.py", line 187, in initialize_addons
set_tray_server_url(
File "E:\dev\ayon-core\client\ayon_core\tools\tray\lib.py", line 182, in set_tray_server_url
raise TrayIsRunningError("Tray is already running.")
ayon_core.tools.tray.lib.TrayIsRunningError: Tray is already running.
Aside of that it visually appears to "keep running" from the UI perspective.
Aside of me seeing from the console that it's shutting down because it already had a tray running I can imagine it's very easy to miss by an artist why it may fail to launch (if they even see that at all). As such, I wonder whether we should add a pop-up that says something like "Shutting down because another Tray process is already running") Or - maybe better yet, have it shut down but send a message to the running tray to show a "tray message/popup" with that message (so it brings to attention the one that is actively running with a tray message - and when the message is clicked (and not dismissed) opens the Launcher for example. So that for the artists running it again it doesn't look like nothing happens, instead they get focused at the one that is already running?
Should be resolved now. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I did notice that if I run tray very rapidly after each other (e.g. run twice almost at the same time) it gets a bit further, doesn't close down but reaches this error (in console):
Should be resolved now.
Correct, works now.
I still think this comment is valid:
Aside of me seeing from the console that it's shutting down because it already had a tray running I can imagine it's very easy to miss by an artist why it may fail to launch (if they even see that at all). As such, I wonder whether we should add a pop-up that says something like "Shutting down because another Tray process is already running") Or - maybe better yet, have it shut down but send a message to the running tray to show a "tray message/popup" with that message (so it brings to attention the one that is actively running with a tray message - and when the message is clicked (and not dismissed) opens the Launcher for example. So that for the artists running it again it doesn't look like nothing happens, instead they get focused at the one that is already running?
But we can leave that to a separate issue and PR.
100% agree, 100% different PR. |
Changelog Description
Tray is now singleton process. Only one tray can be running for AYON url and settings variant (
production
,staging
or dev variants).Additional info
Moved webserver module to tray tool and make it as base functionality of the tool. The webserver is also used to determine if tray is running or not. Tray is storing metadata file containing webserver url, pid and information if initialization finished which is used to determine if is already running.
Added some api functions to be able receive some of these information. The most important are
is_tray_running
andget_tray_server_url
. Theget_tray_server_url
should be used instead ofos.environ["AYON_WEBSERVER_URL"]
.Notes
More features will come in future PRs, based on what we'll need.
Testing notes: