hazelcast-python-client with python 3.4

303 views
Skip to first unread message

india...@gmail.com

unread,
Mar 25, 2016, 5:17:42 AM3/25/16
to Hazelcast
Hi,

I tried hazelcast-python-client with python 3.4.  I know docs says its ready for 2.7 on my machine I think pip install put it into 3.4.

I tried simple program below and it gave error.

import hazelcast

config = hazelcast.ClientConfig()
# Hazelcast.Address is the hostname or IP address, e.g. 'localhost:5701'
config.network_config.addresses.append('10.135.128.100')
client = hazelcast.HazelcastClient(config)


Traceback (most recent call last):
  File "hz.py", line 1, in <module>
    import hazelcast
  File "/usr/lib/python3.4/site-packages/hazelcast/__init__.py", line 1, in <module>
    from hazelcast.client import HazelcastClient
  File "/usr/lib/python3.4/site-packages/hazelcast/client.py", line 2, in <module>
    from hazelcast.cluster import ClusterService, RandomLoadBalancer
  File "/usr/lib/python3.4/site-packages/hazelcast/cluster.py", line 8, in <module>
    from hazelcast.invocation import ListenerInvocation
  File "/usr/lib/python3.4/site-packages/hazelcast/invocation.py", line 4, in <module>
    from Queue import Queue
ImportError: No module named 'Queue'

india...@gmail.com

unread,
Mar 25, 2016, 6:38:44 AM3/25/16
to Hazelcast, india...@gmail.com
I now installed on python2 and it seems to atleast run but it kind of shows no output.  It complain like "No handlers could be found for logger "Reactor"" and then its stuck.  I cannot even terminate the process.

Asim Arslan

unread,
Mar 25, 2016, 7:23:59 PM3/25/16
to haze...@googlegroups.com, india...@gmail.com
Hi,

Please setup python logging to see why it is not connecting with

logging.basicConfig()
# logging.basicConfig(format='%(asctime)s%(msecs)03d [%(name)s] %(levelname)s: %(message)s', datefmt="%H:%M%:%S,")
logging.getLogger().setLevel(logging.INFO)

config = hazelcast.ClientConfig()
# Hazelcast.Address is the hostname or IP address, e.g. 'localhost:5701'
config.network_config.addresses.append('127.0.0.1:5701')
client = hazelcast.HazelcastClient(config)

And also please configure the ip and port of hazelcast server not just ip.




Asım Arslan
Clients Team Lead 
Mahir İz Cad. No:35, Altunizade, İstanbul 
as...@hazelcast.com
@asimarslan
skype: asimarslan

--
You received this message because you are subscribed to the Google Groups "Hazelcast" group.
To unsubscribe from this group and stop receiving emails from it, send an email to hazelcast+...@googlegroups.com.
To post to this group, send email to haze...@googlegroups.com.
Visit this group at https://groups.google.com/group/hazelcast.
To view this discussion on the web visit https://groups.google.com/d/msgid/hazelcast/5e4ac143-26a7-4346-9d01-93a6b58b7bb6%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

india...@gmail.com

unread,
Mar 28, 2016, 3:01:25 AM3/28/16
to Hazelcast, india...@gmail.com


Hi,

Here are debug logs:

$ python2 hz.py
DEBUG:LifecycleService:New Lifecycle state is STARTING
DEBUG:Reactor:Starting Reactor Thread
INFO:ClusterService:Connecting to Address(host=10.135.128.100, port=5701)
DEBUG:InvocationService:Sending ClientMessage:{length=60, correlationId=1, messageType=2, partitionId=-1, isComplete=False, isRetryable=True, isEvent=False, writeOffset=22} to Connection(address=('10.135.128.100', 5701), id=0)
DEBUG:Connection[0](10.135.128.100:5701):Connected to ('10.135.128.100', 5701)
DEBUG:ConnectionManager:Error opening Connection(address=('10.135.128.100', 5701), id=0)
ERROR:Reactor:Error in Reactor Thread
Traceback (most recent call last):
  File "/usr/lib/python2.7/site-packages/hazelcast_python_client-0.3-py2.7.egg/hazelcast/reactor.py", line 38, in _loop
    self._check_timers()
  File "/usr/lib/python2.7/site-packages/hazelcast_python_client-0.3-py2.7.egg/hazelcast/reactor.py", line 57, in _check_timers
    self._timers.get_nowait()
  File "/usr/lib/python2.7/Queue.py", line 190, in get_nowait
    return self.get(False)
  File "/usr/lib/python2.7/Queue.py", line 165, in get
    raise Empty
Empty
WARNING:ClusterService:Error connecting to Address(host=10.135.128.100, port=5701), attempt 1 of 4, trying again in 3 seconds
Traceback (most recent call last):
  File "/usr/lib/python2.7/site-packages/hazelcast_python_client-0.3-py2.7.egg/hazelcast/cluster.py", line 81, in _connect_to_cluster
    self._connect_to_address(address)
  File "/usr/lib/python2.7/site-packages/hazelcast_python_client-0.3-py2.7.egg/hazelcast/cluster.py", line 111, in _connect_to_address
    connection = self._client.connection_manager.get_or_connect(address, self._authenticate_manager).result()
  File "/usr/lib/python2.7/site-packages/hazelcast_python_client-0.3-py2.7.egg/hazelcast/future.py", line 105, in callback
    future.set_result(continuation_func(f, *args))
  File "/usr/lib/python2.7/site-packages/hazelcast_python_client-0.3-py2.7.egg/hazelcast/future.py", line 105, in callback
    future.set_result(continuation_func(f, *args))
  File "/usr/lib/python2.7/site-packages/hazelcast_python_client-0.3-py2.7.egg/hazelcast/cluster.py", line 99, in callback
    parameters = client_authentication_codec.decode_response(f.result())
  File "/usr/lib/python2.7/site-packages/hazelcast_python_client-0.3-py2.7.egg/hazelcast/future.py", line 42, in result
    raise self._exception, None, self._traceback
TimeoutError: Request timed out after 120 seconds.
INFO:ClusterService:Connecting to Address(host=10.135.128.100, port=5701)
DEBUG:InvocationService:Sending ClientMessage:{length=60, correlationId=2, messageType=2, partitionId=-1, isComplete=False, isRetryable=True, isEvent=False, writeOffset=22} to Connection(address=('10.135.128.100', 5701), id=1)



Here is script where I tried adding group_config but it makes no difference:
import hazelcast
import logging


logging.basicConfig()
logging.getLogger().setLevel(logging.DEBUG)

config = hazelcast.ClientConfig()
# Hazelcast.Address is the hostname or IP address, e.g. 'localhost:5701'
config.network_config.addresses.append('10.135.128.100:5701')
config.group_config.password = "password"
client = hazelcast.HazelcastClient(config)


In the config on Node at 10.135.100.128 there is mention of cluster name and password so I tried to add them.

Asim Arslan

unread,
Mar 28, 2016, 4:48:13 AM3/28/16
to haze...@googlegroups.com, Miten Mehta
Hi Miten,

Can you validate your Hazelcast Cluster runs 3.6 or above. Hazelcast Python client supports Hazelcast 3.6+


Asım Arslan
Clients Team Lead 
Mahir İz Cad. No:35, Altunizade, İstanbul 
as...@hazelcast.com
@asimarslan
skype: asimarslan

india...@gmail.com

unread,
Mar 28, 2016, 6:02:43 AM3/28/16
to Hazelcast, india...@gmail.com
Hi Asim,

We are using 3.5.  I guess that is reason for this observation.  Sorry about not noticing this in first place.

Regards,

Miten.

jma...@gmail.com

unread,
Oct 25, 2016, 9:06:26 AM10/25/16
to Hazelcast, india...@gmail.com
Hi am getting the same error but am using 3.6.4 hazelcast any pointers

Asim Arslan

unread,
Oct 27, 2016, 4:05:23 AM10/27/16
to haze...@googlegroups.com, Miten Mehta
Can you update your client config to point to hazelcast server ip and port (or validate it is correct).




Asım Arslan
Clients Team Lead 
Mahir İz Cad. No:35, Altunizade, İstanbul 
as...@hazelcast.com
@asimarslan
skype: asimarslan

--
You received this message because you are subscribed to the Google Groups "Hazelcast" group.
To unsubscribe from this group and stop receiving emails from it, send an email to hazelcast+unsubscribe@googlegroups.com.

To post to this group, send email to haze...@googlegroups.com.
Visit this group at https://groups.google.com/group/hazelcast.
Reply all
Reply to author
Forward
0 new messages