Skip to content

Commit 3cabcf9

Browse files
authored
[cuegui] Fix local booking deeding issue (#1780)
When a user has previously deeded a host and trying to local-book on a new host, the deed button is not available.
1 parent 6d8a565 commit 3cabcf9

File tree

1 file changed

+14
-4
lines changed

1 file changed

+14
-4
lines changed

cuegui/cuegui/LocalBooking.py

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -60,17 +60,22 @@ def __init__(self, target, parent=None):
6060
self.__select_host = QtWidgets.QComboBox(self)
6161
self.__lba_group = QtWidgets.QGroupBox("Settings", self)
6262

63+
user_hosts = []
6364
try:
6465
owner = opencue.api.getOwner(os.environ["USER"])
6566
for host in owner.getHosts():
6667
if host.lockState() != opencue.api.host_pb2.OPEN:
68+
user_hosts.append(host.data.name)
6769
self.__select_host.addItem(host.data.name)
6870
except opencue.exception.CueException:
6971
pass
7072

7173
self.__deed_button = None
7274
self.__msg_widget = None
73-
if self.__select_host.count() == 0:
75+
76+
hostname = gethostname().rsplit(".",2)[0]
77+
78+
if self.__select_host.count() == 0 or hostname not in user_hosts:
7479
self.__deed_button = QtWidgets.QPushButton("Deed This Machine", self)
7580
msg = "You have not deeded any hosts or they are not NIMBY locked."
7681
self.__msg_widget = QtWidgets.QLabel(msg, self)
@@ -234,11 +239,16 @@ def hostAvailable(self):
234239
"""Gets whether the host has cores available."""
235240
return self.__select_host.count() > 0
236241

237-
def __host_changed(self, hostname):
238-
hostname = str(hostname)
242+
def __host_changed(self, hostname_or_index):
243+
if isinstance(hostname_or_index, int):
244+
hostname = self.__select_host.itemText(hostname_or_index)
245+
else:
246+
hostname = str(hostname_or_index)
247+
239248
if not hostname:
240249
return
241-
host = opencue.api.findHost(str(hostname))
250+
251+
host = opencue.api.findHost(hostname)
242252
try:
243253
rp = [r for r in host.getRenderPartitions() if r.data.job == self.jobName]
244254

0 commit comments

Comments
 (0)