Can't authenticate to MongoDB with Atomate 0.8.9

53 views
Skip to first unread message

Steven Hartman

unread,
May 13, 2019, 7:39:17 PM5/13/19
to atomate
Hello,
After updating to Atomate 0.8.9, I can no longer connect to my MongoDB by using

atomate_db = VaspCalcDb.from_db_file(PATH_TO_MY_DB_JSON)

as shown in the band structure workflow tutorial.  The traceback is

Traceback (most recent call last):
  File "/work/04391/tg836903/stampede2/atomate/atomate_env/lib/python3.6/site-packages/atomate/utils/database.py", line 45, in __init__
    self.db.authenticate(self.user, self.password)
  File "/work/04391/tg836903/stampede2/atomate/atomate_env/lib/python3.6/site-packages/pymongo/database.py", line 1346, in authenticate
    connect=True)
  File "/work/04391/tg836903/stampede2/atomate/atomate_env/lib/python3.6/site-packages/pymongo/mongo_client.py", line 646, in _cache_credentials
    with server.get_socket(all_credentials) as sock_info:
  File "/opt/apps/intel17/python3/3.6.3/lib/python3.6/contextlib.py", line 81, in __enter__
    return next(self.gen)
  File "/work/04391/tg836903/stampede2/atomate/atomate_env/lib/python3.6/site-packages/pymongo/pool.py", line 1011, in get_socket
    sock_info.check_auth(all_credentials)
  File "/work/04391/tg836903/stampede2/atomate/atomate_env/lib/python3.6/site-packages/pymongo/pool.py", line 682, in check_auth
    auth.authenticate(credentials, self)
  File "/work/04391/tg836903/stampede2/atomate/atomate_env/lib/python3.6/site-packages/pymongo/auth.py", line 565, in authenticate
    auth_func(credentials, sock_info)
  File "/work/04391/tg836903/stampede2/atomate/atomate_env/lib/python3.6/site-packages/pymongo/auth.py", line 542, in _authenticate_default
    return _authenticate_scram(credentials, sock_info, 'SCRAM-SHA-1')
  File "/work/04391/tg836903/stampede2/atomate/atomate_env/lib/python3.6/site-packages/pymongo/auth.py", line 264, in _authenticate_scram
    res = sock_info.command(source, cmd)
  File "/work/04391/tg836903/stampede2/atomate/atomate_env/lib/python3.6/site-packages/pymongo/pool.py", line 584, in command
    user_fields=user_fields)
  File "/work/04391/tg836903/stampede2/atomate/atomate_env/lib/python3.6/site-packages/pymongo/network.py", line 158, in command
    parse_write_concern_error=parse_write_concern_error)
  File "/work/04391/tg836903/stampede2/atomate/atomate_env/lib/python3.6/site-packages/pymongo/helpers.py", line 155, in _check_command_response
    raise OperationFailure(msg % errmsg, code, response)
pymongo.errors.OperationFailure: Authentication failed.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "plot_band.py", line 9, in <module>
    atomate_db = VaspCalcDb.from_db_file(PATH_TO_MY_DB_JSON)
  File "/work/04391/tg836903/stampede2/atomate/atomate_env/lib/python3.6/site-packages/atomate/utils/database.py", line 133, in from_db_file
    user, password, **kwargs)
  File "/work/04391/tg836903/stampede2/atomate/atomate_env/lib/python3.6/site-packages/atomate/vasp/database.py", line 39, in __init__
    password, **kwargs)
  File "/work/04391/tg836903/stampede2/atomate/atomate_env/lib/python3.6/site-packages/atomate/utils/database.py", line 48, in __init__
    raise ValueError
ValueError

I've tried updating Pymatgen, Fireworks, and Pymongo to the latest versions also.  I haven't made any other changes since it last worked, such as a change to my db.json file. 
Is there a newer method I should be using to connect to my database, or has something just gone wrong with the old one?

Thanks

Anubhav Jain

unread,
May 14, 2019, 11:25:00 AM5/14/19
to Steven Hartman, atomate
Hi Steven

I made some changes to the database connection code and probably messed something up. For now I suggest going back to v0.88, hopefully I can fix it in the next few days

One way to see what's new / updated in the latest code is to check the changelog:

e.g., in v0.8.9 there is "allow “authsource” parameter in db.json files (A. Jain)".

It can help you identify if an update might have affected your work

--
You received this message because you are subscribed to the Google Groups "atomate" group.
To unsubscribe from this group and stop receiving emails from it, send an email to atomate+u...@googlegroups.com.
To post to this group, send email to ato...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/atomate/f23a478e-267a-4d23-b7ed-d9100b4bd3a2%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


--
Best,
Anubhav

martin...@berkeley.edu

unread,
Jun 4, 2019, 12:54:47 PM6/4/19
to atomate
I had the same problem, when I added "authsource":"my database name" in my db.json file it seem to fix it:

This patch should be able to help!

Martin
To unsubscribe from this group and stop receiving emails from it, send an email to ato...@googlegroups.com.

To post to this group, send email to ato...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/atomate/f23a478e-267a-4d23-b7ed-d9100b4bd3a2%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


--
Best,
Anubhav

Anubhav Jain

unread,
Jun 4, 2019, 1:15:07 PM6/4/19
to martin...@berkeley.edu, atomate
Hi all

Sorry for the delay in addressing this.

Martin - thanks for the fix! This is indeed the desired solution.

I created a PR from it and merged it into master atomate. It will show up in the next release as well which I hope to do soon.

Best,
Anubhav


To unsubscribe from this group and stop receiving emails from it, send an email to atomate+u...@googlegroups.com.

To post to this group, send email to ato...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.


--
Best,
Anubhav
Reply all
Reply to author
Forward
0 new messages