Skip to content

Explore Solutions For Worker Initialization #209

@vigoo

Description

@vigoo

We have gotten some feedback that users are confused about how to initialize workers and find it difficult to do so. Part of this is documentation, but I think there are two underlying issues here:

All inputs to the "initialization" of a worker have to come through environment variables or command like arguments, both of which are untyped.
There is no place for initialization logic for a worker to go. For example, if a worker should write to some remote service that it has started life there is no place to specify that except (1) manually writing an initialize function, calling it, and making sure no one calls the worker before that or (2) maintaining a boolean variable indicating whether a worker has been initialized and checking that at the beginning of every function call.
This could be improved by adopting a protocol such as specifying that any worker that needs to perform initialization should define an initalize function. Golem would then look for that and require that the parameters to that function, if any, be provided when a worker is added. This would also mean that invoking a worker that does not already exist and has an initialization function that takes parameters would no longer be supported.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions