Great. Thank you. I went with an awesome pip package called 'resource-pool'.

Kind regards,

Stéphane Thibaud

2019年5月20日(月) 15:44 Ilya Kasnacheev <[email protected]>:

> Hello!
>
> I guess the recommendation here is to create a new client in every thread
> where you need them.
>
> Regards,
> --
> Ilya Kasnacheev
>
>
> вс, 19 мая 2019 г. в 08:39, Stéphane Thibaud <[email protected]>:
>
>> Hello Ignite users,
>>
>> I am wondering whether the pyignite library is thread-safe. I get strange
>> errors when I try to run the below script. I cannot find anything about
>> threads in the docs at
>> https://apache-ignite-binary-protocol-client.readthedocs.io/en/latest/ .
>> Should I use the library in a different way or is multithreading simply
>> not supported?
>>
>> from threading import Thread
>>
>> import pyignite
>>
>> IGNITE_PORT = 10800
>> WEB_HOST = '127.0.0.1'
>> DB_CLIENT = pyignite.Client()
>> DB_CLIENT.connect(WEB_HOST, IGNITE_PORT)
>>
>>
>> test_cache = DB_CLIENT.get_or_create_cache("test_cache")
>> test_cache.put("a", "b")
>> for _ in range(1000):
>>     Thread(target=lambda: print(test_cache.get("a"))).start()
>>
>>
>> Kind regards,
>>
>> Stéphane Thibaud
>>
>

Reply via email to