I have setup a celery task which connects to the Sendgrid API to update the contacts. However when the Celery and Celery Flower are running I cannot send tasks and it just repetitively sends error messages related to Kombu connecting. Here is a brief readout:
Apr 3 16:27:39 ip-172-31-5-114 pipenv[7862]: [E 230403 16:27:39 base_events:1753] Future exception was never retrieved
Apr 3 16:27:39 ip-172-31-5-114 pipenv[7862]: future: <Future finished exception=OperationalError('[Errno 111] Connection refused')>
Apr 3 16:27:39 ip-172-31-5-114 pipenv[7862]: Traceback (most recent call last):
Apr 3 16:27:39 ip-172-31-5-114 pipenv[7862]: File "/var/www/cellar/ss/shared/.venv/lib/python3.9/site-packages/kombu/connection.py", line 446, in _reraise_as_library_errors
Apr 3 16:27:39 ip-172-31-5-114 pipenv[7862]: yield
Apr 3 16:27:39 ip-172-31-5-114 pipenv[7862]: File "/var/www/cellar/ss/shared/.venv/lib/python3.9/site-packages/kombu/connection.py", line 433, in _ensure_connection
Apr 3 16:27:39 ip-172-31-5-114 pipenv[7862]: return retry_over_time(
Apr 3 16:27:39 ip-172-31-5-114 pipenv[7862]: File "/var/www/cellar/ss/shared/.venv/lib/python3.9/site-packages/kombu/utils/functional.py", line 312, in retry_over_time
Apr 3 16:27:39 ip-172-31-5-114 pipenv[7862]: return fun(*args, **kwargs)
Apr 3 16:27:39 ip-172-31-5-114 pipenv[7862]: File "/var/www/cellar/ss/shared/.venv/lib/python3.9/site-packages/kombu/connection.py", line 877, in _connection_factory
Apr 3 16:27:39 ip-172-31-5-114 pipenv[7862]: self._connection = self._establish_connection()
Apr 3 16:27:39 ip-172-31-5-114 pipenv[7862]: File "/var/www/cellar/ss/shared/.venv/lib/python3.9/site-packages/kombu/connection.py", line 812, in _establish_connection
Apr 3 16:27:39 ip-172-31-5-114 pipenv[7862]: conn = self.transport.establish_connection()
Apr 3 16:27:39 ip-172-31-5-114 pipenv[7862]: File "/var/www/cellar/ss/shared/.venv/lib/python3.9/site-packages/kombu/transport/pyamqp.py", line 201, in establish_connection
Apr 3 16:27:39 ip-172-31-5-114 pipenv[7862]: conn.connect()
Apr 3 16:27:39 ip-172-31-5-114 pipenv[7862]: File "/var/www/cellar/ss/shared/.venv/lib/python3.9/site-packages/amqp/connection.py", line 323, in connect
Apr 3 16:27:39 ip-172-31-5-114 pipenv[7862]: self.transport.connect()
Apr 3 16:27:39 ip-172-31-5-114 pipenv[7862]: File "/var/www/cellar/ss/shared/.venv/lib/python3.9/site-packages/amqp/transport.py", line 129, in connect
Apr 3 16:27:39 ip-172-31-5-114 pipenv[7862]: self._connect(self.host, self.port, self.connect_timeout)
Apr 3 16:27:39 ip-172-31-5-114 pipenv[7862]: File "/var/www/cellar/ss/shared/.venv/lib/python3.9/site-packages/amqp/transport.py", line 184, in _connect
Apr 3 16:27:39 ip-172-31-5-114 pipenv[7862]: self.sock.connect(sa)
Apr 3 16:27:39 ip-172-31-5-114 pipenv[7862]: ConnectionRefusedError: [Errno 111] Connection refused
Apr 3 16:27:39 ip-172-31-5-114 pipenv[7862]:
Apr 3 16:27:39 ip-172-31-5-114 pipenv[7862]: The above exception was the direct cause of the following exception:
Apr 3 16:27:39 ip-172-31-5-114 pipenv[7862]:
Apr 3 16:27:39 ip-172-31-5-114 pipenv[7862]: Traceback (most recent call last):
Apr 3 16:27:39 ip-172-31-5-114 pipenv[7862]: File "/usr/lib/python3.9/concurrent/futures/thread.py", line 58, in run
Apr 3 16:27:39 ip-172-31-5-114 pipenv[7862]: result = self.fn(*self.args, **self.kwargs)
Apr 3 16:27:39 ip-172-31-5-114 pipenv[7862]: File "/var/www/cellar/ss/shared/.venv/lib/python3.9/site-packages/celery/app/control.py", line 627, in enable_events
Apr 3 16:27:39 ip-172-31-5-114 pipenv[7862]: return self.broadcast(
Apr 3 16:27:39 ip-172-31-5-114 pipenv[7862]: File "/var/www/cellar/ss/shared/.venv/lib/python3.9/site-packages/celery/app/control.py", line 741, in broadcast
Apr 3 16:27:39 ip-172-31-5-114 pipenv[7862]: return self.mailbox(conn)._broadcast(
Apr 3 16:27:39 ip-172-31-5-114 pipenv[7862]: File "/var/www/cellar/ss/shared/.venv/lib/python3.9/site-packages/kombu/pidbox.py", line 328, in _broadcast
Apr 3 16:27:39 ip-172-31-5-114 pipenv[7862]: chan = channel or self.connection.default_channel
Apr 3 16:27:39 ip-172-31-5-114 pipenv[7862]: File "/var/www/cellar/ss/shared/.venv/lib/python3.9/site-packages/kombu/connection.py", line 895, in default_channel
Apr 3 16:27:39 ip-172-31-5-114 pipenv[7862]: self._ensure_connection(**conn_opts)
Apr 3 16:27:39 ip-172-31-5-114 pipenv[7862]: File "/var/www/cellar/ss/shared/.venv/lib/python3.9/site-packages/kombu/connection.py", line 433, in _ensure_connection
Apr 3 16:27:39 ip-172-31-5-114 pipenv[7862]: return retry_over_time(
Apr 3 16:27:39 ip-172-31-5-114 pipenv[7862]: File "/usr/lib/python3.9/contextlib.py", line 137, in __exit__
Apr 3 16:27:39 ip-172-31-5-114 pipenv[7862]: self.gen.throw(typ, value, traceback)
Apr 3 16:27:39 ip-172-31-5-114 pipenv[7862]: File "/var/www/cellar/ss/shared/.venv/lib/python3.9/site-packages/kombu/connection.py", line 450, in _reraise_as_library_errors
Apr 3 16:27:39 ip-172-31-5-114 pipenv[7862]: raise ConnectionError(str(exc)) from exc
Apr 3 16:27:39 ip-172-31-5-114 pipenv[7862]: kombu.exceptions.OperationalError: [Errno 111] Connection refused
I have checking my settings for Redis and Celery and they match up. Have tried reseting the services and deleting the cached Redis to no resolution.
I am thinking that my task should go through and I would see the task ID be printed out in the log. This would be the result I am looking for.
If anyone has had a similar issue or needs more information feel free to reach out. Thank you in advance!