Krzysztof Nawara
10/09/2020, 7:26 PMall_inputs
cache validator is meant to work.
Cache validator receives 3 arguments, but only 2 of those are relevant here:
- state (State): a `Success` state from the last successful Task run that contains the cache
- inputs (dict): a `dict` of inputs that were available on the last successful run of the cached Task
Now my current understanding (almost certainly incorrect) is that they come from the same run. But then the logic of the validator wouldn't make any sense:
elif getattr(state, "hashed_inputs", None) is not None:
if state.hashed_inputs == {key: tokenize(val) for key, val in inputs.items()}:
return True
else:
return False
elif {key: res.value for key, res in state.cached_inputs.items()} == inputs:
return True
It just compares inputs passed directly to validator to inputs extracted from the state.
So it's pretty clear those 2 arguments can come from different runs, but I don't understand how is that possible. If someone could provide an explenation I'd be very grateful 🙂Spencer
10/09/2020, 7:39 PMKrzysztof Nawara
10/09/2020, 7:43 PMthe last successful Task run that contains the cache
- so this would be the run that generated the value that is in the cache, correct? because all runs that read from cache don't overwrite it
last successful run of the cached Task
- but this is the same, isn't it? last successful run -> run that wrote the cache