Skip to content

Commit

Permalink
Improve view running procs (#1141)
Browse files Browse the repository at this point in the history
* Improve view running procs

This changes the widget to only display info about the selected frame instead of all
the running frames for the job.

* pylint pass

* pylint pass

* Update VERSION.in

Co-authored-by: Brian Cipriano <brian.cipriano@gmail.com>

Co-authored-by: Brian Cipriano <brian.cipriano@gmail.com>
  • Loading branch information
DiegoTavares and bcipriano committed May 27, 2022
1 parent 34c2bde commit 3893b87
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 20 deletions.
5 changes: 3 additions & 2 deletions cuegui/cuegui/FrameMonitorTree.py
Original file line number Diff line number Diff line change
Expand Up @@ -349,7 +349,8 @@ def __itemSingleClickedViewLog(self, item, col):
key=lambda l: int(l.split('rqlog.')[-1]),
reverse=True)
except ValueError:
pass
old_log_files = []

# pylint: disable=no-member
QtGui.qApp.display_log_file_content.emit([current_log_file] + old_log_files)
# pylint: enable=no-member
Expand Down Expand Up @@ -911,4 +912,4 @@ def __init__(self, widget, filterSelectedLayersCallback):
self.__menuActions.frames().addAction(self, "eat")
self.__menuActions.frames().addAction(self, "kill")
self.__menuActions.frames().addAction(self, "eatandmarkdone")
self.__menuActions.frames().addAction(self, "viewRunning")
self.__menuActions.frames().addAction(self, "viewProcesses")
28 changes: 19 additions & 9 deletions cuegui/cuegui/MenuActions.py
Original file line number Diff line number Diff line change
Expand Up @@ -941,17 +941,27 @@ def viewLastLog(self, rpcObjects=None):
else:
cuegui.Utils.popupView(path)

viewRunning_info = ["View Running", None, "viewRunning"]
viewProcesses_info = ["View Processes", None, "viewProcesses"]

def viewRunning(self):
def viewProcesses(self, rpcObjects=None):
""" Display a Proc's child processes Host statistics."""
job = self._getSource()
text = "Displaying host stats for each child process for job:\n%s" % job.name()
title = "View Running Child Proc Host Stats"
procDialog = cuegui.ProcChildren.ProcChildrenDialog(job=job,
text=text,
title=title)
procDialog.exec_()
frames = self._getOnlyFrameObjects(rpcObjects)
hosts = list({frame.data.last_resource.split("/")[0]
for frame in frames if frame.data.last_resource})
if hosts:
layers = self._getSource().getLayers()
layer = [l for l in layers if l.data.name == frames[0].data.layer_name]

if len(layer) > 0:
job = self._getSource()
text = "Displaying host stats for each child process for job:\n%s" % job.name()
title = "View Running Child Proc Host Stats"
procDialog = cuegui.ProcChildren.ProcChildrenDialog(job=job,
layer=layer[0],
hosts=hosts,
text=text,
title=title)
procDialog.exec_()

useLocalCores_info = ["Use local cores...",
"Set a single frame to use the local desktop cores.",
Expand Down
23 changes: 15 additions & 8 deletions cuegui/cuegui/ProcChildren.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,26 +34,27 @@

import cuegui.Utils



class ProcChildren(QtWidgets.QWidget):
"""Widget for displaying Host statistics for a Proc's child processes."""

HEADERS = ["PID", "Name", "Start Time", "Rss (KB)", "VSize (KB)",
"Statm Rss (KB)", "Statm Size (KB)", "Cmd line"]

def __init__(self, job, parent=None):
def __init__(self, job, layer, hosts, parent=None):
"""
Initializes the list of procs for a given job to display
:param job: job Object for this item
:ptype job: opencue.wrappers.job.Job
:param job: job Object for this item (opencue.wrappers.job.Job)
:param layer: job Object for this item (opencue.wrappers.layer.Layer)
:param hosts: list of host Object for this item (List[opencue.wrappers.host.Host])
:param parent: Optional parent for this item
"""
QtWidgets.QWidget.__init__(self, parent)
self._data = {}

self._job = job
self._layer = layer
self._hosts = hosts
self._model = QtGui.QStandardItemModel(self)
self._model.setColumnCount(5)
self._model.setHorizontalHeaderLabels(ProcChildren.HEADERS)
Expand All @@ -74,7 +75,8 @@ def update(self):

try:
procs = opencue.api.getProcs(job=[self._job.name()],
layer=[x.name() for x in self._job.getLayers()])
layer=[self._layer.name()],
host=self._hosts)
for proc in procs:
data['children_processes'] =\
childrenProc.FromString(proc.data.child_processes).children
Expand Down Expand Up @@ -117,11 +119,15 @@ class ProcChildrenDialog(QtWidgets.QDialog):
"""
Dialog for displaying Host statistics for a Proc's child processes
"""
def __init__(self, job, text, title, parent=None):
def __init__(self, job, layer, hosts, text, title, parent=None):
"""
Initializes the data to be displayed
:ptype job: opencue.wrappers.job.Job
:param job: job Object for this item
:ptype layer: opencue.wrappers.layer.Layer
:param layer: layer Object for this item
:ptype hosts: List[opencue.wrappers.host.Host]
:param hosts: list of hosts Object for this item
:ptype text: str
:param text: Description of what is being displayed
:ptype title: str
Expand All @@ -136,7 +142,8 @@ def __init__(self, job, text, title, parent=None):
self.text = text
self.title = title
self.setWindowTitle(self.title)
self._childProcStats = ProcChildren(job=job, parent=parent)
self._childProcStats = ProcChildren(job, layer, hosts, parent=parent)
self.resize(920, 420)

_labelText = QtWidgets.QLabel(text, self)
_labelText.setWordWrap(True)
Expand Down
2 changes: 1 addition & 1 deletion proto/host.proto
Original file line number Diff line number Diff line change
Expand Up @@ -385,7 +385,7 @@ message ProcSearchCriteria {
// An array of job names to match.
repeated string jobs = 2;

// An arra of layer names to match.
// An array of layer names to match.
repeated string layers = 3;

// An array of show names to match.
Expand Down

0 comments on commit 3893b87

Please sign in to comment.