You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Enable callbacks to change the result of a dataset.
This is particularly useful for adding extra logic to the result of ALL implementations of an abstractdataset, like in an interface.
@interface(dispatch=Option("MODE"))
class A:
@abstractdataset(callbacks = my_extra_logic)
def number():
...
@pipeline_step
def my_extra_logic(df):
# do extra logic and return
Callbacks are different from Effects. Callbacks are fixed at the time the dataset is defined and cannot be altered, but they can change the result of the dataset. Effects are not fixed at the time the dataset is defined, so they can be altered later, but they cannot affect the result of the dataset and the chain of evaluation.
The text was updated successfully, but these errors were encountered:
Another issue that a callback would solve is when a user wants to by default tack on additional logic to the end of a dataset (but also have the option to turn off that additional logic).
Currently this is being achieved with overloads using .default, but it is a bit strange to have an overload where the default implementation is to always use the overloaded version.
Added on feature/callback. The argument name is callback and takes a single callback, which can be either a plain callable or something that evaluates to a callable (e.g. a Pipeline or PipelineStep). Callbacks can be run in series by constructing a Pipeline via @dataset(callback=pipeline_step_1 + ... + pipeline_step_n) or @dataset(callback=Pipeline() + plain_step_1 + ... + plain_step_n)
Enable callbacks to change the result of a dataset.
This is particularly useful for adding extra logic to the result of ALL implementations of an
abstractdataset
, like in an interface.Callbacks are different from Effects. Callbacks are fixed at the time the dataset is defined and cannot be altered, but they can change the result of the dataset. Effects are not fixed at the time the dataset is defined, so they can be altered later, but they cannot affect the result of the dataset and the chain of evaluation.
The text was updated successfully, but these errors were encountered: