Can't authenticate to MongoDB with Atomate 0.8.9

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
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

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:

https://atomate.org/changelog.html

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

···

Best,
Anubhav

I had the same problem, when I added “authsource”:“my database name” in my db.json file it seem to fix it:
https://github.com/hackingmaterials/atomate/compare/master…mhsiron:patch-1

This patch should be able to help!

Martin

···

On Tuesday, May 14, 2019 at 8:25:00 AM UTC-7, Anubhav Jain wrote:

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:

https://atomate.org/changelog.html

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

On Mon, May 13, 2019 at 4:39 PM Steven Hartman [email protected] wrote:

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
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

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 [email protected].

To post to this group, send email to [email protected].

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

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

···

Best,
Anubhav