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

Added execute_method_with_priority for data retriever. #64

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions python/shotgun_data/shotgun_data_retriever.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,9 @@ class ShotgunDataRetriever(QtCore.QObject):
# next the priority for any other Shotgun calls (e.g. find, create,
# update, delete, etc.)
_SG_CALL_PRIORITY = 30
# Create has a higher priority to allow for quick creation of a series
# of notes with other shotgun tasks in progress.
_SG_CREATE_CALL_PRIORITY = 31

# Attachment downloads are not necessarily fast (but might be), but unlike
# thumbnails they will be required for functionality in the calling code.
Expand Down Expand Up @@ -413,6 +416,13 @@ def execute_method(self, method, *args, **kwargs):
priority = ShotgunDataRetriever._SG_CALL_PRIORITY,
task_kwargs = task_kwargs)

def execute_method_with_priority(self, method, priority, *args, **kwargs):
task_kwargs = {"method":method, "method_args":args, "method_kwargs":kwargs}
return self._add_task(self._task_execute_method,
priority = priority,
task_kwargs = task_kwargs)


def execute_nav_expand(self, *args, **kwargs):
"""
Executes a Shotgun ``nav_expand`` query asynchronously.
Expand Down
3 changes: 2 additions & 1 deletion python/shotgun_model/note_creator.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,8 @@ def submit(self, data, userdata):

# ask the data retriever to execute an async callback
if self.__sg_data_retriever:
task_id = self.__sg_data_retriever.execute_method(self._async_submit, data)
task_id = self.__sg_data_retriever.execute_method_with_priority(self._async_submit,
ShotgunDataRetriever._SG_CREATE_CALL_PRIORITY, data)
self._processing_ids[task_id] = userdata
if self._outgoing_tasks:
self._outgoing_tasks.add(task_id)
Expand Down