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

mrun failure with 'dict' object has no attribute 'connect' #316

Closed
rkingsbury opened this issue Oct 28, 2020 · 2 comments
Closed

mrun failure with 'dict' object has no attribute 'connect' #316

rkingsbury opened this issue Oct 28, 2020 · 2 comments

Comments

@rkingsbury
Copy link
Collaborator

Using mrun as described in the docs can fail if the Builder is not serialized first.

If I instantiate a Builder inside a jupyter notebook and assign it to the __builder__ variable:

__builder__ = MaterialsBuilder(my_store, target_store, query={"tags":"my_favorite_tag"})

and then execute mrun test_builder.ipynb, I get

Traceback (most recent call last):
  File "/Users/ryan/miniconda3/envs/mp2/bin/mrun", line 8, in <module>
    sys.exit(run())
  File "/Users/ryan/miniconda3/envs/mp2/lib/python3.8/site-packages/click/core.py", line 829, in __call__
    return self.main(*args, **kwargs)
  File "/Users/ryan/miniconda3/envs/mp2/lib/python3.8/site-packages/click/core.py", line 782, in main
    rv = self.invoke(ctx)
  File "/Users/ryan/miniconda3/envs/mp2/lib/python3.8/site-packages/click/core.py", line 1066, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/Users/ryan/miniconda3/envs/mp2/lib/python3.8/site-packages/click/core.py", line 610, in invoke
    return callback(*args, **kwargs)
  File "/Users/ryan/miniconda3/envs/mp2/lib/python3.8/site-packages/maggma/cli/__init__.py", line 80, in run
    asyncio.run(multi(builder, num_workers))
  File "/Users/ryan/miniconda3/envs/mp2/lib/python3.8/asyncio/runners.py", line 43, in run
    return loop.run_until_complete(main)
  File "/Users/ryan/miniconda3/envs/mp2/lib/python3.8/asyncio/base_events.py", line 612, in run_until_complete
    return future.result()
  File "/Users/ryan/miniconda3/envs/mp2/lib/python3.8/site-packages/maggma/cli/multiprocessing.py", line 158, in multi
    builder.connect()
AttributeError: 'dict' object has no attribute 'connect'

However, if I serialize the builder first:

dumpfn(__builder__, 'builder_test.json')

and then run mrun builder_test.json, all works as expected.

Expected behavior

mrun should work when called on a python file or jupyter notebook directly, even if the builder defined in that file has not been serialized.

@shyamd
Copy link
Contributor

shyamd commented Nov 2, 2020

So I wasn't able to get it to fail in the same way, although it did fail for me. I had to remove the matplotlib lines otherwise it kept trying to initialize some weird GUI elements. Can you try that and see what happens?

@rkingsbury
Copy link
Collaborator Author

Solved by reinstalling the latest version. Closing.

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