[PR] Use memo
for arbitrary per-resource payload during operator lifetime
#234
Labels
memo
for arbitrary per-resource payload during operator lifetime
#234
Description
Since the per-resource in-memory runtime-only containers are already present in the core for internal purposes, it is easy to expose
memo
kwarg to the handlers, so that the can store arbitrary information or objects about resources.Same as for the internal use, this should be the objects that are scoped to the operator life time, fully lost on restarts, i.e. not persistent. E.g. threads, tasks, locks, events. Maybe some regular scalars, if their meaning is also scoped to the operator process.
Example:
In this example,
create_fn_1
raises AttributeError on the 1st attempt, then goes tocreate_fn_2
, and then retriescreate_fn_1
in 10 seconds with the.xyz
field already set.Both dictionary and object interfaces are supported.
The documentation is intentionally limited — let's first see how it will be used, and what can be the examples.
Types of Changes
Review
List of tasks the reviewer must do to review the PR
The text was updated successfully, but these errors were encountered: