Hi all - I have some human-in-the-loop business pr...
# ask-community
m
Hi all - I have some human-in-the-loop business processes, and I'm finding it hard to support the following use-case: Dagster generates report `x`; If report
x
is very different from the previously actioned report, a human has to action on it, and the latest report becomes the reference-point to future reports. I'd like to find a way to encode this in the Dagster system - e.g. so I can automate sending a reminder to the "human" while the latest report is not actioned on. The code I'm envisioning is:
Copy code
@asset
def needs_action_flag(x, x_last_actioned_on):
   return is_very_different(x, x_last_actioned_on)
The part I'm finding difficult is to have an ad-hoc materialization of
x_last_actioned_on
- the code for
x_last_actioned_on
is just
Copy code
@asset
def x_last_actioned_on(x):
    return x
The challenge comes from only materializing this IF a human has actioned it (this could be manual)
y
so i guess two ways i could think of: 1. while True and wait for the human to be in the loop and then continue, which isn’t great from an orchestrator’s pov 2. split the assets into two jobs and then introduce a sensor in between which checks does the human has actioned. a.
needs_action_flag
asset materializes
flag_a
b.
kick_off_downstream_if_human_did_action_sensor
listens on that
flag_a
asset and checks if the human did anything at the sensor’s evaluation interval (defaults to 30 seconds) c. when the human did the action, the sensor will kick off the downstream run (
x_last_actioned_on
, etc)