Michal Siedlaczek
10/04/2024, 12:24 PM@cache(behavior="ignore") but it still tries to cache it and crashes (it's not a data object, has some stuff that can't be pickled). but if I try "disable", it doesn't cache it. but there's a difference between those, right? my understanding is that ignore will not use it for caching in any way, but also not affect the downstream deps, whereas disable will, is that correct?Thierry Jean
10/04/2024, 12:56 PMso I set it toJust so I understand, addingbut it still tries to cache it and crashes (it's not a data object, has some stuff that can't be pickled).@cache(behavior="ignore")
.with_cache() and then calling .execute() on that node makes execution crash / raise an error? If this is the case, it's an undesirable behavior that we would like to catch. Do you have a small repro or what object type causes the crash?
## concepts
IGNORE vs. DISABLE
The difference between the two is subtle, so I'll reference a part of the docs for context. In the DEFAULT behavior:
1. Before execution: determine thecache_key
2. At execution:
a. if thefinds a match in the metadata store (cache hit), retrieve thecache_keyof thedata_version.result
b. If there’s no match (cache miss), execute the node and store theof thedata_versionin the metadata store.result
• After execution: if we had to execute the node, store theThe intended behavior (I think there's a bug within the result store.result
IGNORE)
• `DISABLE`: does none of the above. It really is equivalent to not having .with_cache()
• `IGNORE`: the goal of ignore is to say "do not consider this node in downstream `cache_key`"
## example
To illustrate, we have a ML training dataflow, where trained_model depends on processed_data and hparam. Our goal is to try the same hparam with the same data.
Setting DISABLE on processed_data means it will never be assigned a data_version nor have its results stored. When creating the cache_key for trained_model it will always be a cache miss because there's no data_version for processed_data (internally, we use a random value)
@cache(behavior="disable")
def processed_data(raw_data: pd.DataFrame) -> pd.DataFrame: ...
def trained_model(processed_data: pd.DataFrame, hparam: int) -> XGBRegressor: ...
Setting IGNORE on processed_data means we shouldn't produce a data_version for it (maybe it's unhashable). When creating the cache_key for trained_model, only the data_version of hparam will be included in dependencies (internally, we use a constant for processed_data)
@cache(behavior="ignore")
def processed_data(raw_data: pd.DataFrame) -> pd.DataFrame: ...
def trained_model(processed_data: pd.DataFrame, hparam: int) -> XGBRegressor: ...Thierry Jean
10/04/2024, 12:57 PMIGNORE tries to compute a data_version somewhereMichal Siedlaczek
10/04/2024, 1:00 PMMichal Siedlaczek
10/04/2024, 1:01 PMThierry Jean
10/04/2024, 1:04 PM