Skip to content

Commit 3599a1e

Browse files
[cuegui] Fix ETA calculation type error and UTF-8 decoding in FrameMonitorTree (AcademySoftwareFoundation#2119)
**Link the Issue(s) this Pull Request is related to.** - AcademySoftwareFoundation#2118 **Summarize your change.** - Change __defaultETA from empty string to 0 to fix arithmetic operation error when ETA fallback value is used - Add errors='replace' to log file opens in eta.py to handle non-UTF-8 bytes gracefully instead of raising UnicodeDecodeError
1 parent 2d2ce13 commit 3599a1e

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

cuegui/cuegui/FrameMonitorTree.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -840,7 +840,7 @@ def __init__(self):
840840
self.__currentJob = None
841841
self.__cache = {}
842842

843-
self.__defaultETA = ''
843+
self.__defaultETA = 0
844844

845845
self.__TIME = 0
846846
self.__ETA = 1

cuegui/cuegui/eta.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ def GetFrameEta(self, job, frame):
5555
"""Gets ETA for the given frame."""
5656
self.log = opencue.util.logPath(job, frame)
5757
if os.path.isfile(self.log):
58-
with open(self.log, encoding='utf-8') as fp:
58+
with open(self.log, encoding='utf-8', errors='replace') as fp:
5959
self.log_lines = len(fp.readlines())
6060
self.GetFrameBuildTime(frame)
6161
try:
@@ -121,7 +121,7 @@ def Svea(self, frame):
121121
del frame
122122
if os.path.isfile(self.log):
123123
line = ''
124-
with open(self.log, encoding='utf-8') as fp:
124+
with open(self.log, encoding='utf-8', errors='replace') as fp:
125125
for line in reversed(fp.readlines()):
126126
# Checks log directory for a percentage complete in reverse to limit time in log
127127
if 'Running generator batch' in line:
@@ -188,7 +188,7 @@ def GetFrameStartTime(self, frame):
188188
return self.startTimeCache[key]
189189
# Read the logFile here for time.
190190
result = ''
191-
with open(self.log, encoding='utf-8') as fp:
191+
with open(self.log, encoding='utf-8', errors='replace') as fp:
192192
for line in fp:
193193
if '% done' in line:
194194
result = line
@@ -205,7 +205,7 @@ def GetFrameBuildTime(self, frame):
205205
return self.buildTimeCache[key]
206206
# Read the logFile here for time.
207207
result_line = None
208-
with open(self.log, encoding='utf-8') as fp:
208+
with open(self.log, encoding='utf-8', errors='replace') as fp:
209209
for line in fp:
210210
if 'Building scene done' in line:
211211
result_line = line

0 commit comments

Comments
 (0)