spiceDB streaming API in Gunicorn flask
# spicedb
y
spiceDB streaming API in Gunicorn + flask project doesn't work. I'm working with my http project with python flask framework, and I use Gunicorn to deploy it in a multiprocess way. The issue is that the streaming API doesn’t work in which way. I attached a reproducing project for more information. It provided three API using those 3 spiceDB API each: (1)check_permission (2)read_relationship (3)lookup_resources I found that if i run my project with command
flask --app app:app run --host 0.0.0.0 --port 6789
3 APIs works fine. If I run project with
gunicorn app:app -c gunicorn_config.py
, (1)check_permission does work! but (2)read_relationship (3)lookup_resources can't iterate to get all expected response, unless the expected response contains only one struct(relationship/object). You can get more information in logs added to attachment file. https://cdn.discordapp.com/attachments/844600078948630559/1145205715699519548/reproduce.tar.gz
v
are you using the gRPC API or the HTTP API?
y
gRPC API
the Implementation of those two function is in spicedb.py

https://cdn.discordapp.com/attachments/1145205716030861352/1145330019061727242/AL20QKGbCz.jpg

to run this project: 1. create a venv by
python -m venv venv
, then enter the venv, and finally prompt
pip install -r requirements.txt
to run this project: 1. create a venv by
python -m venv venv
, then enter the venv, and finally prompt
pip install -r requirements.txt
2. but you need to create your own spicedb instance first, and update function as this picture shows. 3. finally run project with
flask --app app:app run --host 0.0.0.0 --port 6789
or
gunicorn app:app -c gunicorn_config.py

https://cdn.discordapp.com/attachments/1145205716030861352/1145535024825896991/image.png

2 Views