[ 
https://issues.apache.org/jira/browse/AIRFLOW-3353?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16690421#comment-16690421
 ] 

ASF GitHub Bot commented on AIRFLOW-3353:
-----------------------------------------

r39132 closed pull request #4203: [AIRFLOW-3353] Upgrade redis client.
URL: https://github.com/apache/incubator-airflow/pull/4203
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/airflow/contrib/hooks/redis_hook.py 
b/airflow/contrib/hooks/redis_hook.py
index 650cc9308b..cf684b862f 100644
--- a/airflow/contrib/hooks/redis_hook.py
+++ b/airflow/contrib/hooks/redis_hook.py
@@ -20,7 +20,7 @@
 """
 RedisHook module
 """
-from redis import StrictRedis
+from redis import Redis
 
 from airflow.exceptions import AirflowException
 from airflow.hooks.base_hook import BaseHook
@@ -69,7 +69,7 @@ def get_conn(self):
                 self.redis_conn_id, self.host, self.port, self.db
             )
             try:
-                self.client = StrictRedis(
+                self.client = Redis(
                     host=self.host,
                     port=self.port,
                     password=self.password,
diff --git a/setup.py b/setup.py
index e651f5a66e..70adeb2b2e 100644
--- a/setup.py
+++ b/setup.py
@@ -218,7 +218,7 @@ def write_version(filename=os.path.join(*['airflow',
 postgres = ['psycopg2-binary>=2.7.4']
 qds = ['qds-sdk>=1.9.6']
 rabbitmq = ['librabbitmq>=1.6.1']
-redis = ['redis>=2.10.5,<3.0.0']
+redis = ['redis>=3.0.0,<4.0.0']
 s3 = ['boto3>=1.7.0, <1.8.0']
 salesforce = ['simple-salesforce>=0.72']
 samba = ['pysmbclient>=0.1.3']
diff --git a/tests/contrib/hooks/test_redis_hook.py 
b/tests/contrib/hooks/test_redis_hook.py
index 12c30680e1..74d4b6c2e3 100644
--- a/tests/contrib/hooks/test_redis_hook.py
+++ b/tests/contrib/hooks/test_redis_hook.py
@@ -35,7 +35,7 @@ def test_get_conn(self):
         self.assertEqual(
             repr(hook.get_conn()),
             (
-                'StrictRedis<ConnectionPool'
+                'Redis<ConnectionPool'
                 '<Connection<host=localhost,port=6379,db=0>>>'
             )
         )
diff --git a/tests/contrib/sensors/test_redis_sensor.py 
b/tests/contrib/sensors/test_redis_sensor.py
index 394c8e574b..95cbf67d13 100644
--- a/tests/contrib/sensors/test_redis_sensor.py
+++ b/tests/contrib/sensors/test_redis_sensor.py
@@ -55,7 +55,7 @@ def test_poke(self, key_exists):
         key_exists.return_value = False
         self.assertFalse(self.sensor.poke(None))
 
-    @patch("airflow.contrib.hooks.redis_hook.StrictRedis.exists")
+    @patch("airflow.contrib.hooks.redis_hook.Redis.exists")
     def test_existing_key_called(self, redis_client_exists):
         self.sensor.run(
             start_date=DEFAULT_DATE,


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


> redis-py 3.0.0 dependency breaks celery executor
> ------------------------------------------------
>
>                 Key: AIRFLOW-3353
>                 URL: https://issues.apache.org/jira/browse/AIRFLOW-3353
>             Project: Apache Airflow
>          Issue Type: Bug
>          Components: celery
>    Affects Versions: 1.10.0
>            Reporter: Stefan Seelmann
>            Assignee: Ash Berlin-Taylor
>            Priority: Major
>             Fix For: 2.0.0
>
>
> redis-py 3.0.0 was just released. Airflow 1.10.0 defines redis>=2.10.5 so 
> installs redis-py 3.0.0 now.
> Error in worker below.
> Workaround: Pin redis==2.10.6 (e.g. in constraints.txt)
> {code}
> [2018-11-15 12:06:18,441: CRITICAL/MainProcess] Unrecoverable error: 
> AttributeError("'float' object has no attribute 'items'",)
> Traceback (most recent call last):
>   File "/usr/local/lib/python3.6/site-packages/celery/worker/worker.py", line 
> 205, in start
>     self.blueprint.start(self)
>   File "/usr/local/lib/python3.6/site-packages/celery/bootsteps.py", line 
> 119, in start
>     step.start(parent)
>   File "/usr/local/lib/python3.6/site-packages/celery/bootsteps.py", line 
> 369, in start
>     return self.obj.start()
>   File 
> "/usr/local/lib/python3.6/site-packages/celery/worker/consumer/consumer.py", 
> line 317, in start
>     blueprint.start(self)
>   File "/usr/local/lib/python3.6/site-packages/celery/bootsteps.py", line 
> 119, in start
>     step.start(parent)
>   File 
> "/usr/local/lib/python3.6/site-packages/celery/worker/consumer/consumer.py", 
> line 593, in start
>     c.loop(*c.loop_args())
>   File "/usr/local/lib/python3.6/site-packages/celery/worker/loops.py", line 
> 91, in asynloop
>     next(loop)
>   File "/usr/local/lib/python3.6/site-packages/kombu/asynchronous/hub.py", 
> line 354, in create_loop
>     cb(*cbargs)
>   File "/usr/local/lib/python3.6/site-packages/kombu/transport/redis.py", 
> line 1040, in on_readable
>     self.cycle.on_readable(fileno)
>   File "/usr/local/lib/python3.6/site-packages/kombu/transport/redis.py", 
> line 337, in on_readable
>     chan.handlers[type]()
>   File "/usr/local/lib/python3.6/site-packages/kombu/transport/redis.py", 
> line 724, in _brpop_read
>     self.connection._deliver(loads(bytes_to_str(item)), dest)
>   File 
> "/usr/local/lib/python3.6/site-packages/kombu/transport/virtual/base.py", 
> line 983, in _deliver
>     callback(message)
>   File 
> "/usr/local/lib/python3.6/site-packages/kombu/transport/virtual/base.py", 
> line 632, in _callback
>     self.qos.append(message, message.delivery_tag)
>   File "/usr/local/lib/python3.6/site-packages/kombu/transport/redis.py", 
> line 149, in append
>     pipe.zadd(self.unacked_index_key, time(), delivery_tag) \
>   File "/usr/local/lib/python3.6/site-packages/redis/client.py", line 2263, 
> in zadd
>     for pair in iteritems(mapping):
>   File "/usr/local/lib/python3.6/site-packages/redis/_compat.py", line 123, 
> in iteritems
>     return iter(x.items())
> AttributeError: 'float' object has no attribute 'items'
> {code}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to