Skip to content
Snippets Groups Projects
Commit 55d0ce87 authored by Sybren A. Stüvel's avatar Sybren A. Stüvel
Browse files

Only send render status updates every 30 seconds

Previously it was done for every line of Blender output that contained
render time info, which was way too often.
parent 6acbc2cc
Branches
Tags
No related merge requests found
...@@ -608,6 +608,8 @@ class BlenderRenderCommand(AbstractSubprocessCommand): ...@@ -608,6 +608,8 @@ class BlenderRenderCommand(AbstractSubprocessCommand):
substring_synchronizing = {'| Synchronizing object |', ' | Syncing '} substring_synchronizing = {'| Synchronizing object |', ' | Syncing '}
seen_synchronizing_line = False seen_synchronizing_line = False
_last_activity_time: float = 0.0
def __attrs_post_init__(self): def __attrs_post_init__(self):
super().__attrs_post_init__() super().__attrs_post_init__()
...@@ -622,6 +624,8 @@ class BlenderRenderCommand(AbstractSubprocessCommand): ...@@ -622,6 +624,8 @@ class BlenderRenderCommand(AbstractSubprocessCommand):
self.re_path_not_found = re.compile(r"Warning: Path '.*' not found") self.re_path_not_found = re.compile(r"Warning: Path '.*' not found")
self.re_file_saved = re.compile(r"Saved: '(?P<filename>.*)'") self.re_file_saved = re.compile(r"Saved: '(?P<filename>.*)'")
self._last_activity_time = 0.0
def validate(self, settings: dict): def validate(self, settings: dict):
blender_cmd, err = self._setting(settings, 'blender_cmd', True) blender_cmd, err = self._setting(settings, 'blender_cmd', True)
if err: if err:
...@@ -737,7 +741,10 @@ class BlenderRenderCommand(AbstractSubprocessCommand): ...@@ -737,7 +741,10 @@ class BlenderRenderCommand(AbstractSubprocessCommand):
'the Synchronizing Objects lines)' % line 'the Synchronizing Objects lines)' % line
render_info = self.parse_render_line(line) render_info = self.parse_render_line(line)
if render_info: now = time.time()
# Only update render info every this many seconds, and not for every line Blender produces.
if render_info and now - self._last_activity_time < 30:
self._last_activity_time = now
# Render progress. Not interesting to log all of them, but we do use # Render progress. Not interesting to log all of them, but we do use
# them to update the render progress. # them to update the render progress.
# TODO: For now we return this as a string, but at some point we may want # TODO: For now we return this as a string, but at some point we may want
......
...@@ -667,6 +667,7 @@ class FlamencoWorker: ...@@ -667,6 +667,7 @@ class FlamencoWorker:
return self.loop.create_task(post) return self.loop.create_task(post)
except Exception: except Exception:
self._log.exception('unable to notify Manager') self._log.exception('unable to notify Manager')
return None
def go_to_state_asleep(self): def go_to_state_asleep(self):
"""Starts polling for wakeup calls.""" """Starts polling for wakeup calls."""
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment