Skip to content

Commit

Permalink
[cuegui] Optimize CueMonitorTree processUpdate API call. (#1077)
Browse files Browse the repository at this point in the history
  • Loading branch information
roulaoregan-spi committed Jan 17, 2022
1 parent 6a91e73 commit 8037f2e
Showing 1 changed file with 16 additions and 10 deletions.
26 changes: 16 additions & 10 deletions cuegui/cuegui/CueJobMonitorTree.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
import opencue
import opencue.compiled_proto.job_pb2
import opencue.wrappers.group
from opencue.wrappers.job import Job

import cuegui.AbstractTreeWidget
import cuegui.AbstractWidgetItem
Expand Down Expand Up @@ -476,16 +477,21 @@ def __processUpdateHandleNested(self, parent, groups):
for nestedGroup in group.data.groups.nested_groups]
self.__processUpdateHandleNested(groupItem, nestedGroups)

for jobId in group.data.jobs:
job = opencue.api.getJob(jobId)
try:
if job.id() in self._items:
self._items[job.id()].update(job, groupItem)
else:
self._items[job.id()] = JobWidgetItem(job, groupItem)
except RuntimeError:
logger.warning(
"Failed to create tree item. RootView might be closed", exc_info=True)
# empty list will return all jobs on the farm
# only search if list has jobs
if group.data.jobs:
jobSeq = opencue.search.JobSearch.byOptions(id=list(group.data.jobs)).jobs
jobsObject = [Job(j) for j in jobSeq.jobs]

for job in jobsObject:
try:
if job.id() in self._items:
self._items[job.id()].update(job, groupItem)
else:
self._items[job.id()] = JobWidgetItem(job, groupItem)
except RuntimeError:
logger.warning(
"Failed to create tree item. RootView might be closed", exc_info=True)

def mouseDoubleClickEvent(self, event):
del event
Expand Down

0 comments on commit 8037f2e

Please sign in to comment.