diff --git a/CHANGELOG.md b/CHANGELOG.md index aa3e56e9..4e360f44 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,7 @@ bugs in actually-released versions. - Job settings: add a description for the `eval` field. This is shown in the tooltip of the 'set to automatic value' button, to make it clear what that button will do. - Database integrity tests. These are always run at startup of Flamenco Manager, and by default run periodically every hour. This can be configured by adding/changing the `database_check_period: 1h` setting in `flamenco-manager.yaml`. Setting it to `0` will disable the periodic check. When a database consistency error is found, Flamenco Manager will immediately shut down. - Workers can be marked as 'restartable' by using the `-restart-exit-code N` commandline option. More info in the [Worker Actions documentation](https://flamenco.blender.org/usage/worker-actions/). +- Worker name can be configured via `flamenco_worker.yaml` via `worker_name = "somename"`. - Upgrade bundled FFmpeg from 5.0 to 5.1. - Rename the add-on download to `flamenco-addon.zip` (it used to be `flamenco3-addon.zip`). It still contains the same files as before, and in Blender the name of the add-on has not changed. - Improve speed of queueing up >100 simultaneous job deletions. diff --git a/internal/worker/config.go b/internal/worker/config.go index ca7867cc..2bd2d33f 100644 --- a/internal/worker/config.go +++ b/internal/worker/config.go @@ -39,6 +39,8 @@ var defaultConfig = WorkerConfig{ // WorkerConfig represents the configuration of a single worker. // It does not include authentication credentials. type WorkerConfig struct { + WorkerName string `yaml:"worker_name"` + // ConfiguredManager is the Manager URL that's in the configuration file. ConfiguredManager string `yaml:"manager_url"` diff --git a/internal/worker/registration.go b/internal/worker/registration.go index e6b15bf9..4d691fe6 100644 --- a/internal/worker/registration.go +++ b/internal/worker/registration.go @@ -92,7 +92,7 @@ func register(ctx context.Context, cfg WorkerConfig, client FlamencoClient) Work secretKey := hex.EncodeToString(secret) req := api.RegisterWorkerJSONRequestBody{ - Name: workerName(), + Name: workerName(cfg), Platform: runtime.GOOS, Secret: secretKey, SupportedTaskTypes: cfg.TaskTypes, @@ -152,7 +152,7 @@ func signOn(ctx context.Context, cfg WorkerConfig, client FlamencoClient) (api.W canRestart := cfg.RestartExitCode != 0 req := api.SignOnJSONRequestBody{ - Name: workerName(), + Name: workerName(cfg), SupportedTaskTypes: cfg.TaskTypes, SoftwareVersion: appinfo.ExtendedVersion(), CanRestart: &canRestart, @@ -189,7 +189,14 @@ func signOn(ctx context.Context, cfg WorkerConfig, client FlamencoClient) (api.W } // workerName returns a suitable name for the worker. Errors are fatal. -func workerName() string { +func workerName(cfg WorkerConfig) string { + name := strings.TrimSpace(cfg.WorkerName) + if name != "" { + log.Info(). + Str("name", name). + Msg("worker name obtained from worker configuration instead of using the hostname") + return name + } name, ok := os.LookupEnv(workerNameEnvVariable) if ok && name != "" { name = strings.TrimSpace(name)