Skip to content

Commit

Permalink
View and Edit Subscriptions in full cores. (#644)
Browse files Browse the repository at this point in the history
* Update SubscriptionsWidget.py

Changed the subscriptions display so as to display straight cores instead of cores*100.

* Update MenuActions.py

Changed the "Edit Subscription Size" and "Edit Burst Size" widgets so that they no longer display cores*100 but straight cores.

* Update MenuActions.py and its tests

Updated editSize and editBurst so that they send values in terms of hundredths of a core.
Updated Tests for the same.
  • Loading branch information
ks47 committed Mar 24, 2020
1 parent c3514f4 commit c67a3f7
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 12 deletions.
8 changes: 4 additions & 4 deletions cuegui/cuegui/MenuActions.py
Original file line number Diff line number Diff line change
Expand Up @@ -1138,7 +1138,7 @@ def editSize(self, rpcObjects=None):
"contact the resource department."
minSize = 0
decimalPlaces = 0
(value, choice) = QtWidgets.QInputDialog.getDouble(self._caller, title, body, current,
(value, choice) = QtWidgets.QInputDialog.getDouble(self._caller, title, body, current/100.0,
minSize, cuegui.Constants.QT_MAX_INT,
decimalPlaces)
if choice:
Expand All @@ -1154,7 +1154,7 @@ def editSize(self, rpcObjects=None):
for sub in subs:
self.cuebotCall(sub.setSize,
"Set Size on Subscription %s Failed" % sub.data.name,
int(value))
int(value*100.0))
self._update()

editBurst_info = ["Edit Subscription Burst...", None, "configure"]
Expand All @@ -1167,14 +1167,14 @@ def editBurst(self, rpcObjects=None):
"subscription should be allowed to reach:"
minSize = 0
decimalPlaces = 0
(value, choice) = QtWidgets.QInputDialog.getDouble(self._caller, title, body, current,
(value, choice) = QtWidgets.QInputDialog.getDouble(self._caller, title, body, current/100.0,
minSize, cuegui.Constants.QT_MAX_INT,
decimalPlaces)
if choice:
for sub in subs:
self.cuebotCall(sub.setBurst,
"Set Burst on Subscription %s Failed" % sub.data.name,
int(value))
int(value*100.0))
self._update()

delete_info = ["Delete Subscription", None, "configure"]
Expand Down
12 changes: 6 additions & 6 deletions cuegui/cuegui/SubscriptionsWidget.py
Original file line number Diff line number Diff line change
Expand Up @@ -155,14 +155,14 @@ def __init__(self, parent):
sort=lambda sub: (sub.data.size and
sub.data.reserved_cores / sub.data.size or 0))
self.addColumn("Size", 70, id=3,
data=lambda sub: sub.data.size,
sort=lambda sub: sub.data.size)
data=lambda sub: (sub.data.size/100.0),
sort=lambda sub: (sub.data.size/100.0))
self.addColumn("Burst", 70, id=4,
data=lambda sub: sub.data.burst,
sort=lambda sub: sub.data.burst)
data=lambda sub: (sub.data.burst/100.0),
sort=lambda sub: (sub.data.burst/100.0))
self.addColumn("Used", 70, id=5,
data=lambda sub: ("%.2f" % sub.data.reserved_cores),
sort=lambda sub: sub.data.reserved_cores)
data=lambda sub: ("%.2f" % (sub.data.reserved_cores/100.0)),
sort=lambda sub: (sub.data.reserved_cores/100.0))

cuegui.AbstractTreeWidget.AbstractTreeWidget.__init__(self, parent)

Expand Down
4 changes: 2 additions & 2 deletions cuegui/tests/MenuActions_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -1107,7 +1107,7 @@ def test_editSize(self, getDoubleMock, qMessageBoxMock):

self.subscription_actions.editSize(rpcObjects=[sub])

sub.setSize.assert_called_with(newSize)
sub.setSize.assert_called_with(newSize*100.0)

@mock.patch('PySide2.QtWidgets.QInputDialog.getDouble')
def test_editBurst(self, getDoubleMock):
Expand All @@ -1119,7 +1119,7 @@ def test_editBurst(self, getDoubleMock):

self.subscription_actions.editBurst(rpcObjects=[sub])

sub.setBurst.assert_called_with(newSize)
sub.setBurst.assert_called_with(newSize*100.0)

@mock.patch('cuegui.Utils.questionBoxYesNo', new=mock.Mock(return_value=True))
def test_delete(self):
Expand Down

0 comments on commit c67a3f7

Please sign in to comment.