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

Overly aggressive caching #57

Closed
erooke opened this issue Aug 17, 2022 · 3 comments
Closed

Overly aggressive caching #57

erooke opened this issue Aug 17, 2022 · 3 comments
Labels
bug Something isn't working

Comments

@erooke
Copy link

erooke commented Aug 17, 2022

If a file fails to run code due to a failed import codebraid will not try to run that code again until the cache is cleared.

If we have the following file test.md

```{.python .cb-nb}
import numpy as np
```

and compile it with the command

codebraid pandoc -f markdown -t markdown -o out.md test.md 

if numpy is not available in the environment we get the following out.md

``` {.python .numberLines startFrom="1"}
import numpy as np
```

``` {.stderr .error}
Traceback (most recent call last):
  File "source.py", line 1, in <module>
    import numpy as np
ModuleNotFoundError: No module named 'numpy'
```

realizing our mistake we install numpy and attempt to recompile

pip install numpy
codebraid pandoc -f markdown -t markdown -o out.md test.md --overwrite

we will get the exact same out.md. Clearing the cache with
rm -rf _codebraid and rerunning corrects the error.

This is very non-obvious behavior to me. I would expect any code block which failed to run to be re-run on the next attempt.

@gpoore
Copy link
Owner

gpoore commented Aug 17, 2022

That's a bug. These sorts of cases are cached so that the output is as complete as possible if code execution is disabled on a subsequent run, but I need to add cache invalidation for these cases whenever code execution is permitted. It looks like just a few small changes should fix this.

gpoore added a commit that referenced this issue Aug 23, 2022
…egardless of whether session code is modified (#57)
@gpoore
Copy link
Owner

gpoore commented Aug 23, 2022

This should be fixed in the dev version on GitHub. A new release including this will be on PyPI soon.

@erooke
Copy link
Author

erooke commented Aug 29, 2022

Thanks! This is fixed on my end using the GitHub version

@erooke erooke closed this as completed Aug 29, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants