Skip to content

Commit

Permalink
Cy2024 (#1416)
Browse files Browse the repository at this point in the history
* Remove python < 3.7 requirements

* Update pylint to 2.17.7

* Adjust pylintrc's and ignore consider-using-f-string

* Ignore the proto modules globally for linting

* Change pylint version to 2.15.10

* Fix pylint errors on pycue, pyoutline and cueadmin

* Pylint fixed for cuegui part 1

* Fix some of the items conversions

* Pylint fixed for cuegui part 2

* Remove python2 unit tests

* Pylint fixed for cuegui part 3

* Pylint fixed for cuegui part 4

* Pylint fixed for cuesubmit

* Add more ignored proto modules

* Pylint fixed for rqd

* Add more ignored proto modules

* Pylint fixes for rqd

* Update actions/checkout to v3 to keep in line with other tests

* Revert change for FrameMonitorTree.py

* Revert some of the "consider-using-dict-items" changes that somehow seems to crash under tests (just to be safe, for now)

* Revert some of the "consider-using-dict-items" changes that somehow seems to crash under tests (just to be safe, for now)

* Remove some redundant conditions

* Update psutil

* Add CY2024 tests

* Remove dependency for PySide2 specifically in setup.py and rely on qtpy and requirements_gui.txt

* Fix check for search case sensitivity in log viewer

* Disable the LogViewerWidget._set_scrollbar_value since it's causing the search buttons to only search within visible text. Also it doesn't really seem to do anything.

* Fix logging to file, it shouldn't open the file since it's already open.

* Ignore non-ascii characters and don't add the extra newline.

* Disabled connecting the _set_scrollbar_value since it's causing the
search buttons to only search within visible text.
Also it doesn't really seem to do anything.
  • Loading branch information
lithorus authored Jul 23, 2024
1 parent 688425c commit e0ffd63
Show file tree
Hide file tree
Showing 67 changed files with 307 additions and 289 deletions.
22 changes: 16 additions & 6 deletions .github/workflows/testing-pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,23 +53,33 @@ jobs:
chown -R aswfuser:aswfgroup .
su -c "cd cuebot && ./gradlew build --stacktrace --info" aswfuser
test_python2:
name: Run Python Unit Tests using Python2
test_python_2024:
name: Run Python Unit Tests (CY2024)
runs-on: ubuntu-latest
container: aswf/ci-opencue:2019
env:
ACTIONS_ALLOW_USE_UNSECURE_NODE_VERSION: true
container: aswf/ci-opencue:2024
steps:
- uses: actions/checkout@v3
- name: Run Python Tests
run: ci/run_python_tests.sh

test_cuebot_2024:
name: Build Cuebot and Run Unit Tests (CY2024)
runs-on: ubuntu-latest
container:
image: aswf/ci-opencue:2024
steps:
- uses: actions/checkout@v3
- name: Build with Gradle
run: |
chown -R aswfuser:aswfgroup .
su -c "cd cuebot && ./gradlew build --stacktrace --info" aswfuser
test_pyside6:
name: Run CueGUI Tests using PySide6
runs-on: ubuntu-latest
container: almalinux:9
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Run CueGUI Tests
run: ci/test_pyside6.sh

Expand Down
14 changes: 10 additions & 4 deletions ci/pylintrc_main
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,8 @@ disable=c-extension-no-member,
too-many-public-methods,
too-many-return-statements,
too-many-statements,
useless-object-inheritance
useless-object-inheritance,
consider-using-f-string

# Enable the message, report, category or checker with the given id(s). You can
# either give multiple identifier separated by comma (,) or put this option
Expand Down Expand Up @@ -202,7 +203,12 @@ ignored-classes=optparse.Values,thread._local,_thread._local
# (useful for modules/projects where namespaces are manipulated during runtime
# and thus existing member attributes cannot be deduced by static analysis). It
# supports qualified module names, as well as Unix pattern matching.
ignored-modules=
ignored-modules=opencue.compiled_proto,
opencue.compiled_proto.filter_pb2,
opencue.compiled_proto.host_pb2,
rqd.compiled_proto.rqd_pb2,
rqd.compiled_proto.host_pb2,
rqd.compiled_proto.report_pb2

# Show a hint with possible names when a member name was not found. The aspect
# of finding the hint is based on edit distance.
Expand Down Expand Up @@ -523,5 +529,5 @@ min-public-methods=2

# Exceptions that will emit a warning when being caught. Defaults to
# "BaseException, Exception".
overgeneral-exceptions=BaseException,
Exception
overgeneral-exceptions=builtins.BaseException,
builtins.Exception
14 changes: 10 additions & 4 deletions ci/pylintrc_test
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,8 @@ disable=arguments-differ,
too-many-statements,
unused-argument,
unused-variable,
useless-object-inheritance
useless-object-inheritance,
consider-using-f-string

# Enable the message, report, category or checker with the given id(s). You can
# either give multiple identifier separated by comma (,) or put this option
Expand Down Expand Up @@ -202,7 +203,12 @@ ignored-classes=optparse.Values,thread._local,_thread._local
# (useful for modules/projects where namespaces are manipulated during runtime
# and thus existing member attributes cannot be deduced by static analysis). It
# supports qualified module names, as well as Unix pattern matching.
ignored-modules=
ignored-modules=opencue.compiled_proto,
opencue.compiled_proto.filter_pb2,
opencue.compiled_proto.host_pb2,
rqd.compiled_proto.rqd_pb2,
rqd.compiled_proto.host_pb2,
rqd.compiled_proto.report_pb2

# Show a hint with possible names when a member name was not found. The aspect
# of finding the hint is based on edit distance.
Expand Down Expand Up @@ -523,5 +529,5 @@ min-public-methods=2

# Exceptions that will emit a warning when being caught. Defaults to
# "BaseException, Exception".
overgeneral-exceptions=BaseException,
Exception
overgeneral-exceptions=builtins.BaseException,
builtins.Exception
2 changes: 2 additions & 0 deletions cueadmin/cueadmin/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -289,6 +289,7 @@ def _convert(val):
else:
result = opencue.api.criterion_pb2.GreaterThanFloatSearchCriterion(
value=_convert(mixed))
# pylint: disable=use-a-generator
elif any([isinstance(mixed.__class__, crit_cls) for crit_cls in criterions]):
result = mixed
elif not mixed:
Expand Down Expand Up @@ -336,6 +337,7 @@ def _convert(val):
else:
result = opencue.api.criterion_pb2.GreaterThanIntegerSearchCriterion(
value=_convert(mixed))
# pylint: disable=use-a-generator
elif any([isinstance(mixed.__class__, crit_cls) for crit_cls in criterions]):
result = mixed
elif not mixed:
Expand Down
7 changes: 6 additions & 1 deletion cuegui/cuegui/AbstractTreeWidget.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,16 @@
COLUMN_TOOLTIP = 5
COLUMN_INFO_LENGTH = 6

DEFAULT_LAMBDA = lambda s: ""
DEFAULT_NAME = ""
DEFAULT_WIDTH = 0


# pylint: disable=unused-argument
def DEFAULT_LAMBDA(s):
"""Dummy function to return something"""
return ""


class AbstractTreeWidget(QtWidgets.QTreeWidget):
"""Base class for CueGUI tree widgets.
Expand Down
1 change: 1 addition & 0 deletions cuegui/cuegui/Comments.py
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,7 @@ def refreshComments(self):
comments[source.data.name] = source.getComments()
self.__treeSubjects.clear()
comments_length = 0
# pylint: disable=consider-using-dict-items
for source in comments:
heading = CommentSource(source)
heading.setSizeHint(0, QtCore.QSize(500, 1))
Expand Down
6 changes: 3 additions & 3 deletions cuegui/cuegui/Constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ def __getLogger():

def __loadConfigFromFile():
logger = __getLogger()
with open(__DEFAULT_CONFIG_FILE) as fp:
with open(__DEFAULT_CONFIG_FILE, encoding='utf-8') as fp:
config = yaml.load(fp, Loader=yaml.SafeLoader)

user_config_file = None
Expand All @@ -73,7 +73,7 @@ def __loadConfigFromFile():

if user_config_file:
logger.info('Loading cuegui config from %s', user_config_file)
with open(user_config_file, 'r') as fp:
with open(user_config_file, 'r', encoding='utf-8') as fp:
config.update(yaml.load(fp, Loader=yaml.SafeLoader))

return config
Expand All @@ -83,7 +83,7 @@ def __packaged_version():
possible_version_path = os.path.join(
os.path.abspath(os.path.join(__file__, "../../..")), 'VERSION.in')
if os.path.exists(possible_version_path):
with open(possible_version_path) as fp:
with open(possible_version_path, encoding='utf-8') as fp:
default_version = fp.read().strip()
return default_version
return "1.3.0"
Expand Down
1 change: 1 addition & 0 deletions cuegui/cuegui/CreateShowDialog.py
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,7 @@ def __validateNoDuplicateShow(self):

return False

# pylint: disable=inconsistent-return-statements
def tryCreateShow(self):
"""Try to create the show in OpenCue
Expand Down
4 changes: 2 additions & 2 deletions cuegui/cuegui/CueStateBarWidget.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ def paintEvent(self, event):
@type event: QEvent
@param event: The draw event"""
del event
assert threading.currentThread().getName() == "MainThread"
assert threading.current_thread().name == "MainThread"
self.__colorsLock.lockForWrite()
try:
if not self.__colors:
Expand Down Expand Up @@ -136,7 +136,7 @@ def __updateBackgroundPixmap(self, colors):
@param colors: List of job background colors"""
# Could draw it the max size and allow the resize on drawPixmap
# that way the same buffer is always used
assert threading.currentThread().getName() == "MainThread"
assert threading.current_thread().name == "MainThread"
buffer = QtGui.QPixmap(self.contentsRect().size())
buffer.fill(self.__baseColor)

Expand Down
3 changes: 2 additions & 1 deletion cuegui/cuegui/DarkPalette.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,8 @@ def init():

def setDarkStyleSheet():
"""Sets the stylesheet."""
cuegui.app().setStyleSheet(open(cuegui.Constants.DARK_STYLE_SHEET).read())
with open(cuegui.Constants.DARK_STYLE_SHEET, encoding='utf-8') as fp:
cuegui.app().setStyleSheet(fp.read())


def DarkPalette():
Expand Down
2 changes: 2 additions & 0 deletions cuegui/cuegui/DependWizard.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ def __init__(self, parent, jobs, layers=None, frames=None):
self.__pages[PAGE_CONFIRMATION] = PageConfirmation(self, jobs, layers, frames)

# Add the pages to the wizard
# pylint: disable=consider-using-dict-items
for key in self.__pages :
self.setPage(key, self.__pages[key])

Expand Down Expand Up @@ -389,6 +390,7 @@ def initializePage(self):
self.wizard().setMinimumSize(500, 500)

def validatePage(self):
# pylint: disable=consider-using-dict-items
for option in self.__options:
if self.__options[option].isChecked():
self.wizard().dependType = option
Expand Down
1 change: 1 addition & 0 deletions cuegui/cuegui/EmailDialog.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ class EmailWidget(QtWidgets.QWidget):
def __init__(self, jobs, parent=None):
QtWidgets.QWidget.__init__(self, parent=parent)

# pylint: disable=unused-private-member
self.__jobs = jobs

# Temporary workaround when pwd library is not available (i.e. Windows).
Expand Down
2 changes: 2 additions & 0 deletions cuegui/cuegui/FilterDialog.py
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,7 @@ def _createItem(self, filter_object):
def _processUpdate(self, work, rpcObjects):
"""Adds the feature of forcing the items to be sorted by the first
column"""
# pylint: disable=protected-access
cuegui.AbstractTreeWidget.AbstractTreeWidget._processUpdate(self, work, rpcObjects)

def _getUpdate(self):
Expand Down Expand Up @@ -224,6 +225,7 @@ def __init__(self, parent_filter, parent):
cuegui.AbstractTreeWidget.AbstractTreeWidget.__init__(self, parent)

# Used to build right click context menus
# pylint: disable=unused-private-member
self.__menuActions = cuegui.MenuActions.MenuActions(
self, self.updateSoon, self.selectedObjects)
self._timer.stop()
Expand Down
8 changes: 6 additions & 2 deletions cuegui/cuegui/FrameMonitorTree.py
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,7 @@ def getFrameStateOverride(frame):
cuegui.AbstractTreeWidget.AbstractTreeWidget.__init__(self, parent)

# Used to build right click context menus
# pylint: disable=unused-private-member
self.__menuActions = cuegui.MenuActions.MenuActions(
self, self.updateSoon, self.selectedObjects, self.getJob)
self.__sortByColumnCache = {}
Expand Down Expand Up @@ -619,11 +620,13 @@ def __init__(self, rpcObject, parent, job):
self.__class__.__alignCenter = QtCore.Qt.AlignCenter
self.__class__.__alignRight = QtCore.Qt.AlignRight
self.__class__.__rgbFrameState = {}
# pylint: disable=consider-using-dict-items
for key in cuegui.Constants.RGB_FRAME_STATE:
self.__class__.__rgbFrameState[key] = cuegui.Constants.RGB_FRAME_STATE[key]
self.__class__.__type = cuegui.Constants.TYPE_FRAME
cuegui.AbstractWidgetItem.AbstractWidgetItem.__init__(
self, cuegui.Constants.TYPE_FRAME, rpcObject, parent, job)
# pylint: disable=unused-private-member
self.__show = job.data.show

def data(self, col, role):
Expand Down Expand Up @@ -712,6 +715,7 @@ def __init__(self):
self.__LINE = 2
self.__LLU = 3

# pylint: disable=inconsistent-return-statements
def getLastLineData(self, job, frame):
"""Returns the last line and LLU of the log file or queues a request to update
it"""
Expand Down Expand Up @@ -784,7 +788,7 @@ def __saveWork(self, work, results):
__cached[self.__TIME] = time.time()
__cached[self.__LINE] = results[1]
__cached[self.__LLU] = results[2]
except KeyError as e:
except KeyError:
# Could happen while switching jobs with work in the queue
pass
except Exception as e:
Expand Down Expand Up @@ -871,7 +875,7 @@ def __saveWork(self, work, results):
__cached = self.__cache[results[0]]
__cached[self.__TIME] = time.time()
__cached[self.__ETA] = results[1]
except KeyError as e:
except KeyError:
# Could happen while switching jobs with work in the queue
pass
except Exception as e:
Expand Down
2 changes: 1 addition & 1 deletion cuegui/cuegui/HostMonitor.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ def __filterByHostNameSetup(self, layout):
QtCore.QObject.connect(btn,
QtCore.SIGNAL('clicked()'),
self.__filterByHostNameClear)

# pylint: disable=unused-private-member
self.__filterByHostNameClearBtn = btn

def __filterByHostNameHandle(self):
Expand Down
1 change: 1 addition & 0 deletions cuegui/cuegui/ItemDelegate.py
Original file line number Diff line number Diff line change
Expand Up @@ -419,6 +419,7 @@ def paint(self, painter, option, index):
points = QtGui.QPolygon(len(hostItem.coresHistory) + 2)
points.setPoint(0, option.rect.bottomLeft())
num = 1
# pylint: disable=consider-using-enumerate
for i in range(len(hostItem.coresHistory)):
points.setPoint(
num, option.rect.x() + stepWidth * i,
Expand Down
4 changes: 3 additions & 1 deletion cuegui/cuegui/JobMonitorTree.py
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@ def addJob(self, job, timestamp=None, loading_from_config=False):
else:
# We'll only add the new job if it's not already listed
# as a dependent on another job
if jobKey not in self.__reverseDependents.keys():
if jobKey not in self.__reverseDependents:
self.__load[jobKey] = newJobObj

# when we are adding jobs manually, we want to calculate
Expand Down Expand Up @@ -337,12 +337,14 @@ def _removeItem(self, item):
@param item: A tree widget item
@type item: AbstractTreeWidgetItem"""
self.app.unmonitor.emit(item.rpcObject)
# pylint: disable=protected-access
cuegui.AbstractTreeWidget.AbstractTreeWidget._removeItem(self, item)
self.__jobTimeLoaded.pop(item.rpcObject, "")
try:
jobKey = cuegui.Utils.getObjectKey(item)
# Remove the item from the main _items dictionary as well as the
# __dependentJobs and the reverseDependent dictionaries
# pylint: disable=protected-access
cuegui.AbstractTreeWidget.AbstractTreeWidget._removeItem(self, item)
dependent_jobs = self.__dependentJobs.get(jobKey, [])
for djob in dependent_jobs:
Expand Down
3 changes: 3 additions & 0 deletions cuegui/cuegui/LayerDialog.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ class LayerPropertiesItem(QtWidgets.QWidget):
"""An key/value widget for populating a dialog box."""
def __init__(self, label, widget, stretch=True, help_widget=None, parent=None):
QtWidgets.QWidget.__init__(self, parent)
# pylint: disable=unused-private-member
self.__label = label
self.__widget = widget

Expand Down Expand Up @@ -357,6 +358,7 @@ def getMaxMemory(self):

def getMaxGpuMemory(self):
"""Gets the layer max GPU memory."""
# pylint: disable=consider-using-generator
return max([layer.data.min_gpu_memory // self.gpu_mem_tick_kb for layer in self.__layers])

def getMinCores(self):
Expand Down Expand Up @@ -524,6 +526,7 @@ def __init__(self, layers, parent=None):
QtWidgets.QDialog.__init__(self, parent)
self._tags_widget = LayerTagsWidget(layers=layers,
parent=parent)
# pylint: disable=unused-private-member
self.__warning = QtWidgets.QLabel(
'Warning: Changing these tags may cause your job to not run any frames')
self.__buttons = QtWidgets.QDialogButtonBox(
Expand Down
1 change: 0 additions & 1 deletion cuegui/cuegui/LimitsWidget.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,6 @@ def _createItem(self, rpcObject):
item = LimitWidgetItem(rpcObject, self)
return item

# pylint: disable=no-self-use
def _getUpdate(self):
"""Returns the proper data from the cuebot"""
try:
Expand Down
2 changes: 1 addition & 1 deletion cuegui/cuegui/LocalBooking.py
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ def deedLocalhost(self):
user = os.environ["USER"]
try:
owner = opencue.api.getOwner(user)
except opencue.EntityNotFoundException as e:
except opencue.EntityNotFoundException:
# Owner does not exist
owner = _show.createOwner(user)

Expand Down
Loading

0 comments on commit e0ffd63

Please sign in to comment.