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

Editing the @ct.lattice executor in a Jupyter Notebook is not always reflected if importing a @ct.electron #1942

Open
Andrew-S-Rosen opened this issue Mar 12, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@Andrew-S-Rosen
Copy link
Contributor

Andrew-S-Rosen commented Mar 12, 2024

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.

@Andrew-S-Rosen Andrew-S-Rosen added the bug Something isn't working label Mar 12, 2024
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

1 participant