Skip to content
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

SG-36162 Refactor __launch_app_proxy_for_project in a QThread #187

Open
wants to merge 9 commits into
base: master
Choose a base branch
from

Conversation

carlos-villavicencio-adsk
Copy link
Contributor

@carlos-villavicencio-adsk carlos-villavicencio-adsk commented Jan 27, 2025

Move the logic for phase 1 (update last accessed timestamp in SG) when launching of the app proxy for a project in a QThread Background Task Manager so it doesn't block the UI.

@carlos-villavicencio-adsk carlos-villavicencio-adsk marked this pull request as ready for review January 27, 2025 22:00
@carlos-villavicencio-adsk carlos-villavicencio-adsk requested a review from a team January 27, 2025 22:01
python/tk_desktop/desktop_window.py Outdated Show resolved Hide resolved
python/tk_desktop/desktop_window.py Outdated Show resolved Hide resolved
Copy link
Contributor

@barbara-darkshot barbara-darkshot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looking good!
just requesting minor changes but happy to discuss

@@ -157,7 +156,7 @@ class DesktopWindow(SystrayWindow):
_CHROME_SUPPORT_URL = "https://developer.shotgridsoftware.com/95518180"
_FIREFOX_SUPPORT_URL = "https://developer.shotgridsoftware.com/d4936105"

def __init__(self, console, parent=None):
def __init__(self, console, task_manager, parent=None):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

very small detail, it would be better to call this argument bg_task_manager rather than task_manager (easier to identify + this is usually how it is called)

python/tk_desktop/desktop_window.py Show resolved Hide resolved
# trigger an update to the model to track this project access
self.__set_project_just_accessed(project)
QtGui.QApplication.instance().processEvents()
def __launch_app_proxy_for_project_follow_up(self):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unlike @julien-lang , I don't think this method name is the best.. looking at the code, it's all about pipeline configuration and I find the "new name" kind of confusing. I'd prefer something like __load_pipeline_configuration() (+ add comments to the method/arguments to explain what this is about, especially is the method name is not descriptive :))

if task_id != self.__set_project_just_accessed_task:
return

log.error(f"Launching app proxy for project failed. Message: {msg}")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you also need to clear self.__set_project_just_accessed_task if the task has failed
maybe you can also change the error message to have a better reflection of what has failed by replacing Launching app proxy for project failed by Error happened when loading pipeline configuration: {msg}
(tbh, as a user/artist, I don't know what is the app proxy :D )
also wondering if we could use self.project_overlay.show_error_message(message) to display the error message to the user as well?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've refactored the error handling on the callback and cleared the task. Good catch!

Copy link
Contributor

@barbara-darkshot barbara-darkshot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants