From 4947712becc6c0d159cbdea1521b9a7c5852ddf7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sybren=20A=2E=20St=C3=BCvel?= Date: Fri, 29 Jul 2022 09:48:56 +0200 Subject: [PATCH] Worker: also log found Blender at startup Similar to the logging of the found FFmpeg, log the version of Blender at Worker startup. --- cmd/flamenco-worker/find_exes.go | 22 ++++++++++++++++++++++ cmd/flamenco-worker/main.go | 1 + 2 files changed, 23 insertions(+) diff --git a/cmd/flamenco-worker/find_exes.go b/cmd/flamenco-worker/find_exes.go index e8de3f95..e3c91b97 100644 --- a/cmd/flamenco-worker/find_exes.go +++ b/cmd/flamenco-worker/find_exes.go @@ -1,11 +1,14 @@ package main import ( + "context" "errors" "io/fs" + "time" "github.com/rs/zerolog/log" + "git.blender.org/flamenco/internal/find_blender" "git.blender.org/flamenco/internal/find_ffmpeg" ) @@ -21,3 +24,22 @@ func findFFmpeg() { log.Info().Str("path", result.Path).Str("version", result.Version).Msg("FFmpeg found on this system") } } + +// findBlender tries to find Blender, in order to show its version (if found) or a message (if not). +func findBlender() { + ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second) + defer cancel() + + result, err := find_blender.Find(ctx) + switch { + case errors.Is(err, fs.ErrNotExist): + log.Warn().Msg("Blender could not be found, Flamenco Manager will have to supply a full path") + case err != nil: + log.Warn().Err(err).Msg("there was an unexpected error finding Blender on this system, Flamenco Manager will have to supply a full path") + default: + log.Info(). + Str("path", result.FoundLocation). + Str("version", result.BlenderVersion). + Msg("Blender found on this system, it will be used unless Flamenco Manager specifies a path to a different Blender") + } +} diff --git a/cmd/flamenco-worker/main.go b/cmd/flamenco-worker/main.go index a0c981d8..243a493a 100644 --- a/cmd/flamenco-worker/main.go +++ b/cmd/flamenco-worker/main.go @@ -95,6 +95,7 @@ func main() { configWrangler.SetManagerURL(url) } + findBlender() findFFmpeg() // Give the auto-discovery some time to find a Manager.