Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

prefect caching misleading #57

Open
siligam opened this issue Nov 8, 2024 · 2 comments
Open

prefect caching misleading #57

siligam opened this issue Nov 8, 2024 · 2 comments
Assignees

Comments

@siligam
Copy link
Contributor

siligam commented Nov 8, 2024

The following error is misleading and potentially a side effect of prefect caching. 'thetao' units in both model and tables are 'degC'. The units set on rule for this variable is indeed 'degC' (rule.data_request_variable.unit) but in the error message some other units appear. Those units are for 'fgco2' variable. I guess prefect caching is unable to differentiate rules.

ValueError("Cannot convert variables:\n    incompatible units for variable 'thetao': Cannot convert from 'degree_Celsius' ([temperature]) to 'kilogram / meter ** 2 / second' ([mass] / [length] ** 2 / [time])")))

To reproduce this error:
use examples/sample.yaml
branch: feat/dimensionless-units

@siligam
Copy link
Contributor Author

siligam commented Nov 8, 2024

Every thing works fine after turning off cache.

diff --git a/src/pymorize/pipeline.py b/src/pymorize/pipeline.py
index 879be8d..1fa25f8 100644
--- a/src/pymorize/pipeline.py
+++ b/src/pymorize/pipeline.py
@@ -65,8 +65,8 @@ class Pipeline:
                 Task(
                     fn=step,
                     # cache_key_fn=generate_cache_key,
-                    cache_expiration=self._cache_expiration,
-                    cache_policy=TASK_SOURCE + INPUTS,
+                    # cache_expiration=self._cache_expiration,
+                    # cache_policy=TASK_SOURCE + INPUTS,
                 )
             )

The log file shows:

grep Converting slurm-13789839.out
Converting units: (thetao -> thetao) degC -> degC
Converting units: (CO2f -> fgco2) mmolC/m2/d -> kg m-2 s-1
Converting units: (so -> so) psu -> g/kg (0.001)

@pgierz
Copy link
Member

pgierz commented Nov 11, 2024

Hmm...The cache_policy takes care of looking at the inputs, and each step gets one of the Rule objects as an input, so I am unsure why the cache is not unambiguously set up for each one separately.

I'll have a look. @siligam, you can focus on #55 for right now.

@pgierz pgierz self-assigned this Nov 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants