Skip to content

Commit

Permalink
Re #7327 Restrict age of completed jobs
Browse files Browse the repository at this point in the history
  • Loading branch information
mdoucet committed Jun 21, 2013
1 parent 2eb2609 commit cc5cfd3
Show file tree
Hide file tree
Showing 3 changed files with 54 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import ui.ui_cluster_status

import mantid.simpleapi as api
from mantid.kernel import ConfigService
from mantid.kernel import ConfigService, DateAndTime
from mantid.api import AlgorithmManager

from reduction_gui.reduction.scripter import BaseScriptElement
Expand Down Expand Up @@ -48,6 +48,9 @@ def initialize_content(self):
self.connect(self._content.job_table, QtCore.SIGNAL("customContextMenuRequested(QPoint)"), self.tableWidgetContext)

self.connect(self._content.refresh_button, QtCore.SIGNAL("clicked()"), self._update_content)

# Set the time of the oldest displayed job to 2 days ago
self._content.date_time_edit.setDateTime(QtCore.QDateTime().currentDateTime().addDays(-2))

compute_resources = ConfigService.Instance().getFacility().computeResources()
self._content.resource_combo.clear()
Expand Down Expand Up @@ -158,6 +161,13 @@ def _update_content(self):
self._content.job_table.setRowCount(len(job_list))

for i in range(len(job_list)):

# Make sure that only recent jobs are displayed
oldest = DateAndTime(self._content.date_time_edit.dateTime().toString(QtCore.Qt.ISODate))
this_job = DateAndTime(str(job_list[i][4]))
if this_job<oldest:
continue

# Job ID
item = QtGui.QTableWidgetItem(str(job_list[i][0]))
item.setFlags(QtCore.Qt.ItemIsSelectable |QtCore.Qt.ItemIsEnabled )
Expand All @@ -174,7 +184,7 @@ def _update_content(self):
self._content.job_table.setItem(i, 2, item)

# Start time
item = QtGui.QTableWidgetItem(str(job_list[i][3]))
item = QtGui.QTableWidgetItem(str(job_list[i][3]).replace('T', ' '))
item.setFlags(QtCore.Qt.ItemIsSelectable |QtCore.Qt.ItemIsEnabled )
self._content.job_table.setItem(i, 3, item)

Expand Down
27 changes: 27 additions & 0 deletions Code/Mantid/scripts/Interface/ui/cluster_status.ui
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,33 @@
</property>
</spacer>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<widget class="QLabel" name="label_4">
<property name="text">
<string>Show items after:</string>
</property>
</widget>
</item>
<item>
<widget class="QDateTimeEdit" name="date_time_edit"/>
</item>
<item>
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="refresh_button">
<property name="sizePolicy">
Expand Down
18 changes: 15 additions & 3 deletions Code/Mantid/scripts/Interface/ui/ui_cluster_status.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

# Form implementation generated from reading ui file 'ui/cluster_status.ui'
#
# Created: Thu Jun 20 11:14:07 2013
# Created: Fri Jun 21 13:16:42 2013
# by: PyQt4 UI code generator 4.7.4
#
# WARNING! All changes made in this file will be lost!
Expand Down Expand Up @@ -62,15 +62,26 @@ def setupUi(self, Frame):
self.horizontalLayout.addWidget(self.password_edit)
spacerItem = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
self.horizontalLayout.addItem(spacerItem)
self.verticalLayout.addLayout(self.horizontalLayout)
self.horizontalLayout_2 = QtGui.QHBoxLayout()
self.horizontalLayout_2.setObjectName("horizontalLayout_2")
self.label_4 = QtGui.QLabel(Frame)
self.label_4.setObjectName("label_4")
self.horizontalLayout_2.addWidget(self.label_4)
self.date_time_edit = QtGui.QDateTimeEdit(Frame)
self.date_time_edit.setObjectName("date_time_edit")
self.horizontalLayout_2.addWidget(self.date_time_edit)
spacerItem1 = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
self.horizontalLayout_2.addItem(spacerItem1)
self.refresh_button = QtGui.QPushButton(Frame)
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Fixed)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(self.refresh_button.sizePolicy().hasHeightForWidth())
self.refresh_button.setSizePolicy(sizePolicy)
self.refresh_button.setObjectName("refresh_button")
self.horizontalLayout.addWidget(self.refresh_button)
self.verticalLayout.addLayout(self.horizontalLayout)
self.horizontalLayout_2.addWidget(self.refresh_button)
self.verticalLayout.addLayout(self.horizontalLayout_2)

self.retranslateUi(Frame)
QtCore.QMetaObject.connectSlotsByName(Frame)
Expand All @@ -82,6 +93,7 @@ def retranslateUi(self, Frame):
self.username_edit.setToolTip(QtGui.QApplication.translate("Frame", "Enter compute resource username", None, QtGui.QApplication.UnicodeUTF8))
self.label_2.setText(QtGui.QApplication.translate("Frame", "Password:", None, QtGui.QApplication.UnicodeUTF8))
self.password_edit.setToolTip(QtGui.QApplication.translate("Frame", "Enter compute resource password", None, QtGui.QApplication.UnicodeUTF8))
self.label_4.setText(QtGui.QApplication.translate("Frame", "Show items after:", None, QtGui.QApplication.UnicodeUTF8))
self.refresh_button.setToolTip(QtGui.QApplication.translate("Frame", "Click to refresh the job list", None, QtGui.QApplication.UnicodeUTF8))
self.refresh_button.setText(QtGui.QApplication.translate("Frame", "Refresh", None, QtGui.QApplication.UnicodeUTF8))

0 comments on commit cc5cfd3

Please sign in to comment.