diff --git a/flamenco_worker/commands.py b/flamenco_worker/commands.py index 0c8fb5ebfad885b9db4ebd81c8b8b482a5286a04..3b94402ccd74249a96396587297efc7b2a68d86a 100644 --- a/flamenco_worker/commands.py +++ b/flamenco_worker/commands.py @@ -608,6 +608,8 @@ class BlenderRenderCommand(AbstractSubprocessCommand): substring_synchronizing = {'| Synchronizing object |', ' | Syncing '} seen_synchronizing_line = False + _last_activity_time: float = 0.0 + def __attrs_post_init__(self): super().__attrs_post_init__() @@ -622,6 +624,8 @@ class BlenderRenderCommand(AbstractSubprocessCommand): self.re_path_not_found = re.compile(r"Warning: Path '.*' not found") self.re_file_saved = re.compile(r"Saved: '(?P<filename>.*)'") + self._last_activity_time = 0.0 + def validate(self, settings: dict): blender_cmd, err = self._setting(settings, 'blender_cmd', True) if err: @@ -737,7 +741,10 @@ class BlenderRenderCommand(AbstractSubprocessCommand): 'the Synchronizing Objects lines)' % 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 # them to update the render progress. # TODO: For now we return this as a string, but at some point we may want diff --git a/flamenco_worker/worker.py b/flamenco_worker/worker.py index 4b60c7eba3e0b2d7b78e3dd3ae3a1555ab3e1602..96b32e17ac7222fc89a09953faba2cdb2dee3990 100644 --- a/flamenco_worker/worker.py +++ b/flamenco_worker/worker.py @@ -667,6 +667,7 @@ class FlamencoWorker: return self.loop.create_task(post) except Exception: self._log.exception('unable to notify Manager') + return None def go_to_state_asleep(self): """Starts polling for wakeup calls."""