# AiiDA workchain caching?

**URL:** <https://aiida.discourse.group/t/aiida-workchain-caching/336>\
**Category:** General Usage\
**Tags:** caching\
**Created:** [March 14, 2024, 6:58am UTC](https://aiida.discourse.group/t/aiida-workchain-caching/336 "2024-03-14T06:58:04Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![addman](https://avatars.discourse-cdn.com/v4/letter/a/f1d935/32.png) [@addman](https://aiida.discourse.group/u/addman)\
**Post date:** [March 14, 2024, 6:58am UTC](https://aiida.discourse.group/t/aiida-workchain-caching/336/1 "2024-03-14T06:58:05Z")

</div>

Where there some changes in the way how WorkChain source code is fetched and run?

So after a while start to write myself a new WorkChain. I wrote a first draft and I wanted to run it. I registered a new WorkChain. However ,subsequent changes in the source code does not seams to affect the run of WorkChain. Even when I reinstall the package and remove all caches.

I cannot do a reproducer, it just acts weird. As it remembers first two version of python binary a tries to execute one of those.

---

<div class="post-metadata">

**Author:** ![giovannipizzi](https://yyz2.discourse-cdn.com/free1/user_avatar/aiida.discourse.group/giovannipizzi/32/17_2.png) [@giovannipizzi](https://aiida.discourse.group/u/giovannipizzi)\
**Post date:** [March 14, 2024, 7:20am UTC](https://aiida.discourse.group/t/aiida-workchain-caching/336/2 "2024-03-14T07:20:59Z")

</div>

Hi, when you change the workflow code, you need to restart the daemon with `verdi daemon restart --reset`. This is because python will keep the old code in memory unless you restart the code. You should also make sure that, if your workchain is in an installed package, you installed in editable mode with `pip install -e <folder_name>`.

---

<div class="post-metadata">

**Author:** ![addman](https://avatars.discourse-cdn.com/v4/letter/a/f1d935/32.png) [@addman](https://aiida.discourse.group/u/addman)\
**Post date:** [March 14, 2024, 7:29am UTC](https://aiida.discourse.group/t/aiida-workchain-caching/336/3 "2024-03-14T07:29:38Z")

</div>

Thank you, I guess each daemon has its own cache. I have multiple daemons running and each one remembered a different version of the code. Not having reproducible outcome was very frustrating.

---

<div class="post-metadata">

**Author:** ![sphuber](https://yyz2.discourse-cdn.com/free1/user_avatar/aiida.discourse.group/sphuber/32/6_2.png) [@sphuber](https://aiida.discourse.group/u/sphuber)\
**Post date:** [March 14, 2024, 8:04am UTC](https://aiida.discourse.group/t/aiida-workchain-caching/336/4 "2024-03-14T08:04:23Z")

</div>

It is not really a cache. It is not an AiiDA specific thing, but just a property of Python. The same happens when you are in an interactive shell, like `ipython`, or a Jupyter notebook, for example. If you load a Python module there, and then you change the source code, those changes will not be seen by the interpreter and it will continue running the “old” version. You have to restart the interpreter (kernel) to force it to read the source code again.

---

<div class="post-metadata">

**Author:** ![addman](https://avatars.discourse-cdn.com/v4/letter/a/f1d935/32.png) [@addman](https://aiida.discourse.group/u/addman)\
**Post date:** [March 14, 2024, 9:21am UTC](https://aiida.discourse.group/t/aiida-workchain-caching/336/5 "2024-03-14T09:21:38Z")

</div>

@sphuber Thanks for the clarification

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/free1/uploads/aiida/original/1X/c417197d3750949351575d03ed03f5e2ad32e649.png) [@system](https://aiida.discourse.group/u/system)\
**Post date:** [March 14, 2026, 9:21am UTC](https://aiida.discourse.group/t/aiida-workchain-caching/336/6 "2026-03-14T09:21:46Z")

</div>

This topic was automatically closed 730 days after the last reply. New replies are no longer allowed.
