Environment
- Covalent version: 0.234.0rc0
- Python version: 3.10.13
- Operating system: Ubuntu
What is happening?
I have built a Python package containing a bunch of pre-made @ct.electron-decorated functions. When using a Jupyter Notebook, however, I get some unfortunate mutability issues, described in greater detail below. This isn't necessarily a bug per se, but I'd love to get your input on how to better address this conundrum.
How can we reproduce the issue?
First, I installed the necessary packages:
pip install --force-reinstall --no-deps https://gitlab.com/ase/ase/-/archive/master/ase-master.zip
pip install quacc[covalent]
covalent start
Then, in a Jupyter Notebook I ran the following in a cell:
import covalent as ct
from ase.build import bulk
from quacc.recipes.emt.core import relax_job
atoms = bulk("Cu")
@ct.lattice(executor="dask")
def workflow(atoms):
return relax_job(atoms)
ct.dispatch(workflow)(atoms)
This will properly use the "dask" executor. However, when I edit executor="dask" to be executor="local" and re-run the same cell, the executor in the GUI still shows as "dask" when it should be "local".
I believe the reason for this comes down to mutability. It seems that doing
relax_job.electron_object.executor
when I run it the first time yields "dask". However, when I rerun with the updated executor, it still shows "dask" even though we are running with "local".
What should happen?
The imported @ct.electron should have its executor dynamically updated.
Any suggestions?
None, but I'm open to suggestions! This seems potentially related to #1889, but I think it may be slightly different. Feel free to close if it's a duplicate.
Environment
What is happening?
I have built a Python package containing a bunch of pre-made
@ct.electron-decorated functions. When using a Jupyter Notebook, however, I get some unfortunate mutability issues, described in greater detail below. This isn't necessarily a bug per se, but I'd love to get your input on how to better address this conundrum.How can we reproduce the issue?
First, I installed the necessary packages:
Then, in a Jupyter Notebook I ran the following in a cell:
This will properly use the "dask" executor. However, when I edit
executor="dask"to beexecutor="local"and re-run the same cell, the executor in the GUI still shows as "dask" when it should be "local".I believe the reason for this comes down to mutability. It seems that doing
when I run it the first time yields "dask". However, when I rerun with the updated
executor, it still shows "dask" even though we are running with "local".What should happen?
The imported
@ct.electronshould have its executor dynamically updated.Any suggestions?
None, but I'm open to suggestions! This seems potentially related to #1889, but I think it may be slightly different. Feel free to close if it's a duplicate.