golem icon indicating copy to clipboard operation
golem copied to clipboard

Updating environment of an existing worker

Open vigoo opened this issue 1 year ago • 5 comments

A worker's environment (environment variables and command-line arguments) can only be set once when the worker is created. This is intentional as modifying them can lead to divergence as the worker's code can depend on them.

However, as we support updating workers, it is possible that an update introduces the need for a new environment variable and it is not possible to add it currently.

The following proposal would solve this:

  • Add optional parameters to the worker update command (on all layers) to accept an updated list of environment variables / args.
  • This should be made convenient on the user interface level, for example being able to list "additional env vars" without touching the existing ones, etc.
  • The worker update command must allow updating to the same version if the user only wants to update the configuration
  • Even if the version does not change but the environment does, worker executor must go through the usual process of attempting an update with the updated environment, which potentially can lead to divergence and fail.

vigoo avatar Sep 01 '24 08:09 vigoo

Just to make sure i understand: does this only allow adding env vars and not modifying existing ones, or both possible but with different flags?

noise64 avatar Sep 02 '24 07:09 noise64

Note also that some auto-generated environment variables may already change during the lifetime of a worker (at least the component version). And during replay, this needs to be handled properly.

vigoo avatar Dec 06 '24 09:12 vigoo

Now that we have per-component environment variables that can be applied to workers by updating them, I think it makes sense to support changing the per-worker environment variables too at the same time (by worker update).

I'm including this in milestone 1.3 as part of the "compositional initial state" epic.

vigoo avatar May 18 '25 16:05 vigoo

@mschuwalow you've done this right?

vigoo avatar Jul 30 '25 07:07 vigoo

Only the component-level environment variables can be updated currently. The initial environment variables a worker is started with cannot be updated currently

mschuwalow avatar Aug 05 '25 17:08 mschuwalow