My always on task is constanly producing the following error
Jun 5 15:50:57 Traceback (most recent call last):
Jun 5 15:50:57 File "/home/influrocket4/.virtualenvs/env/lib/python3.8/site-packages/pymongo/pool.py", line 1278, in _get_socket
Jun 5 15:50:57 sock_info = self.sockets.popleft()
Jun 5 15:50:57 IndexError: pop from an empty deque
Jun 5 15:50:57
Jun 5 15:50:57 During handling of the above exception, another exception occurred:
Jun 5 15:50:57
Jun 5 15:50:57 Traceback (most recent call last):
Jun 5 15:50:57 File "/home/influrocket4/mysite/keyword-api/webflow/cms-manager/haro/queue_manager.py", line 43, in <module>
Jun 5 15:50:57 if intermediate_email_collection.estimated_document_count() != 0:
Jun 5 15:50:57 File "/home/influrocket4/.virtualenvs/env/lib/python3.8/site-packages/pymongo/collection.py", line 1704, in estimated_document_count
Jun 5 15:50:57 return self._count(cmd)
Jun 5 15:50:57 File "/home/influrocket4/.virtualenvs/env/lib/python3.8/site-packages/pymongo/collection.py", line 1664, in _count
Jun 5 15:50:57 return self.__database.client._retryable_read(
Jun 5 15:50:57 File "/home/influrocket4/.virtualenvs/env/lib/python3.8/site-packages/pymongo/mongo_client.py", line 1464, in _retryable_read
Jun 5 15:50:57 with self._slaveok_for_server(read_pref, server, session,
Jun 5 15:50:57 File "/usr/lib/python3.8/contextlib.py", line 113, in __enter__
Jun 5 15:50:57 return next(self.gen)
Jun 5 15:50:57 File "/home/influrocket4/.virtualenvs/env/lib/python3.8/site-packages/pymongo/mongo_client.py", line 1309, in _slaveok_for_server
Jun 5 15:50:57 with self._get_socket(server, session, exhaust=exhaust) as sock_info:
Jun 5 15:50:57 File "/usr/lib/python3.8/contextlib.py", line 113, in __enter__
Jun 5 15:50:57 return next(self.gen)
Jun 5 15:50:57 File "/home/influrocket4/.virtualenvs/env/lib/python3.8/site-packages/pymongo/mongo_client.py", line 1246, in _get_socket
Jun 5 15:50:57 with server.get_socket(
Jun 5 15:50:57 File "/usr/lib/python3.8/contextlib.py", line 113, in __enter__
Jun 5 15:50:57 return next(self.gen)
Jun 5 15:50:57 File "/home/influrocket4/.virtualenvs/env/lib/python3.8/site-packages/pymongo/pool.py", line 1231, in get_socket
Jun 5 15:50:57 sock_info = self._get_socket(all_credentials)
Jun 5 15:50:57 File "/home/influrocket4/.virtualenvs/env/lib/python3.8/site-packages/pymongo/pool.py", line 1281, in _get_socket
Jun 5 15:50:57 sock_info = self.connect(all_credentials)
Jun 5 15:50:57 File "/home/influrocket4/.virtualenvs/env/lib/python3.8/site-packages/pymongo/pool.py", line 1197, in connect
Jun 5 15:50:57 sock_info.check_auth(all_credentials)
Jun 5 15:50:57 File "/home/influrocket4/.virtualenvs/env/lib/python3.8/site-packages/pymongo/pool.py", line 793, in check_auth
Jun 5 15:50:57 self.authenticate(credentials)
Jun 5 15:50:57 File "/home/influrocket4/.virtualenvs/env/lib/python3.8/site-packages/pymongo/pool.py", line 810, in authenticate
Jun 5 15:50:57 auth.authenticate(credentials, self)
Jun 5 15:50:57 File "/home/influrocket4/.virtualenvs/env/lib/python3.8/site-packages/pymongo/auth.py", line 673, in authenticate
Jun 5 15:50:57 auth_func(credentials, sock_info)
Jun 5 15:50:57 File "/home/influrocket4/.virtualenvs/env/lib/python3.8/site-packages/pymongo/auth.py", line 591, in _authenticate_default
Jun 5 15:50:57 return _authenticate_scram(credentials, sock_info, 'SCRAM-SHA-1')
Jun 5 15:50:57 File "/home/influrocket4/.virtualenvs/env/lib/python3.8/site-packages/pymongo/auth.py", line 295, in _authenticate_scram
Jun 5 15:50:57 res = sock_info.command(source, cmd)
Jun 5 15:50:57 File "/home/influrocket4/.virtualenvs/env/lib/python3.8/site-packages/pymongo/pool.py", line 683, in command
Jun 5 15:50:57 return command(self, dbname, spec, slave_ok,
Jun 5 15:50:57 File "/home/influrocket4/.virtualenvs/env/lib/python3.8/site-packages/pymongo/network.py", line 159, in command
Jun 5 15:50:57 helpers._check_command_response(
Jun 5 15:50:57 File "/home/influrocket4/.virtualenvs/env/lib/python3.8/site-packages/pymongo/helpers.py", line 164, in _check_command_response
Jun 5 15:50:57 raise OperationFailure(errmsg, code, response, max_wire_version)
Jun 5 15:50:57 pymongo.errors.OperationFailure: Authentication failed., full error: {'ok': 0, 'errmsg': 'Authentication failed.', 'code': 8000, 'codeName': 'AtlasError'}
I've checked virtual environment and there's no problem there.
Infact when I execute the always on task command in the pythonanywhere bash console my task works just fine without any errors. my task command is
workon env && python /home/influrocket4/mysite/keyword-api/webflow/cms-manager/haro/queue_manager.py
This command works in bash console.
I use the same mongo connector url/method in my web app which is also working. I execute my task on my machine and it's working here too.
Why is my script not working as an always on task?
[edit by admin: formatting]