Hi,
I have a running mongodb-cluster on Altas which I am trying to set up as a Launchpad for fireworks.
I have created a new (empty) database “my_db”, and my “.fireworks/my_launchpad.yaml” looks like this:
host: cluster0-shard-00-00-xxxxx.mongodb.net:27017,cluster0-shard-00-01-xxxxx.mongodb.net:27017,cluster0-shard-00-02-xxxxx.mongodb.net:27017
logdir: null
name: my_db
password: password
port: 27017
strm_lvl: INFO
username: username
ssl: true
``
When I try to connect with the following code:
from fireworks import LaunchPad
from fireworks.fw_config import LAUNCHPAD_LOC
lpad = LaunchPad.from_file(LAUNCHPAD_LOC)
``
I get the following error:
Traceback (most recent call last):
File “”, line 3, in
lpad = LaunchPad.from_file(LAUNCHPAD_LOC)
File “/home/audun/miniconda3/envs/fireworks/lib/python3.6/site-packages/fireworks/utilities/fw_serializers.py”, line 286, in from_file
return cls.from_format(f.read(), f_format=f_format)
File “/home/audun/miniconda3/envs/fireworks/lib/python3.6/site-packages/fireworks/utilities/fw_serializers.py”, line 254, in from_format
yaml.safe_load(f_str)))
File “/home/audun/miniconda3/envs/fireworks/lib/python3.6/site-packages/fireworks/core/launchpad.py”, line 224, in from_dict
ssl_ca_certs, ssl_certfile, ssl_keyfile, ssl_pem_passphrase)
File “/home/audun/miniconda3/envs/fireworks/lib/python3.6/site-packages/fireworks/core/launchpad.py”, line 155, in init
self.db.authenticate(username, password)
File “/home/audun/miniconda3/envs/fireworks/lib/python3.6/site-packages/pymongo/database.py”, line 1274, in authenticate
connect=True)
File “/home/audun/miniconda3/envs/fireworks/lib/python3.6/site-packages/pymongo/mongo_client.py”, line 614, in _cache_credentials
sock_info.authenticate(credentials)
File “/home/audun/miniconda3/envs/fireworks/lib/python3.6/site-packages/pymongo/pool.py”, line 688, in authenticate
auth.authenticate(credentials, self)
File “/home/audun/miniconda3/envs/fireworks/lib/python3.6/site-packages/pymongo/auth.py”, line 563, in authenticate
auth_func(credentials, sock_info)
File “/home/audun/miniconda3/envs/fireworks/lib/python3.6/site-packages/pymongo/auth.py”, line 540, in _authenticate_default
return _authenticate_scram(credentials, sock_info, ‘SCRAM-SHA-1’)
File “/home/audun/miniconda3/envs/fireworks/lib/python3.6/site-packages/pymongo/auth.py”, line 262, in _authenticate_scram
res = sock_info.command(source, cmd)
File “/home/audun/miniconda3/envs/fireworks/lib/python3.6/site-packages/pymongo/pool.py”, line 579, in command
unacknowledged=unacknowledged)
File “/home/audun/miniconda3/envs/fireworks/lib/python3.6/site-packages/pymongo/network.py”, line 150, in command
parse_write_concern_error=parse_write_concern_error)
File “/home/audun/miniconda3/envs/fireworks/lib/python3.6/site-packages/pymongo/helpers.py”, line 155, in _check_command_response
raise OperationFailure(msg % errmsg, code, response)
OperationFailure: Authentication failed.
``
If I change “name” in my_launchpad.yaml to “admin”, which is the user authentication database on Atlas I am able to connect, however this db has certain restrictions so it can not be used as a fireworks db.
When I run the following code (with “name”=“admin”):
lpad.get_fw_ids()
``
I get the following error:
Traceback (most recent call last):
File “”, line 1, in
lpad.get_fw_ids()
File “/home/audun/miniconda3/envs/fireworks/lib/python3.6/site-packages/fireworks/core/launchpad.py”, line 620, in get_fw_ids
for fw in getattr(self, coll).find(criteria, {“fw_id”: True}, sort=sort).limit(limit):
File “/home/audun/miniconda3/envs/fireworks/lib/python3.6/site-packages/pymongo/cursor.py”, line 1189, in next
if len(self.__data) or self._refresh():
File “/home/audun/miniconda3/envs/fireworks/lib/python3.6/site-packages/pymongo/cursor.py”, line 1104, in _refresh
self.__send_message(q)
File “/home/audun/miniconda3/envs/fireworks/lib/python3.6/site-packages/pymongo/cursor.py”, line 982, in __send_message
helpers._check_command_response(first)
File “/home/audun/miniconda3/envs/fireworks/lib/python3.6/site-packages/pymongo/helpers.py”, line 155, in _check_command_response
raise OperationFailure(msg % errmsg, code, response)
OperationFailure: cannot do raw queries on admin in atlas
``
Everything works fine however if I in the LaunchPad constructor pass username and password directly to the MongoClient constructor instead of the in the subsequent “if username:…” statement:
user_creds = {‘username’: username, ‘password’: password} if username else {}
self.connection = MongoClient(host, port, ssl=self.ssl,
ssl_ca_certs=self.ssl_ca_certs, ssl_certfile=self.ssl_certfile,
ssl_keyfile=self.ssl_keyfile, ssl_pem_passphrase=self.ssl_pem_passphrase,
socketTimeoutMS=MONGO_SOCKET_TIMEOUT_MS, connect=False, **user_creds)
self.db = self.connection[name]
if username:
self.db.authenticate(username, password)
``
I am using fireworks 1.8.0 and pymongo 3.7.2. The Mongodb instance on Atlas is version 3.6
If anyone has successfully used an Atlas mongodb instance with fireworks, please let be know if I am missing out on something. I have used mlab.com without problems earlier. Any help here is much appreciated.
Regards,
Audun