Skip to content

Commit

Permalink
Fix pubsub latency (#197)
Browse files Browse the repository at this point in the history
* Adjust pubsub latency

* Move publisher instantiation

Test request timeouts

* Update requirements

* Test with different gunicorn worker

* Test work-around

* Test updating requirements

* Update max_latency

* Test different worker class

* test grpc fix

* Address code review comments

* Fix imports
  • Loading branch information
samanehsan authored Dec 4, 2019
1 parent 018eb04 commit 392c320
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
10 changes: 10 additions & 0 deletions lira/lira.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@
This listener API Lira listens for notifications and start workflows.
"""
import os
import gevent
import gevent.socket
import socket
import json
import logging
import connexion
Expand Down Expand Up @@ -64,6 +67,13 @@
'lira_api.yml', resolver=resolver, validate_responses=True, arguments=arguments
)

# Patch GRPC (used by Google PubSub) to be gevent-compatible: https://github.com/grpc/grpc/issues/4629
if socket.socket is gevent.socket.socket:
logger.info("Patching GRPC for use with gevent...")
import grpc.experimental.gevent

grpc.experimental.gevent.init_gevent()


if __name__ == '__main__':
app.run(host=args.host, port=args.port)
6 changes: 3 additions & 3 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
wheel==0.32.3
connexion[swagger-ui]==2.2.0
google-auth==1.5.0
google-auth==1.7.1
google-cloud-storage==1.9.0
flask>=1.0.0
gunicorn==19.9.0
gunicorn==20.0.4
gevent==1.4.0
requests==2.20.0
requests-mock==1.5.0
Expand All @@ -14,5 +14,5 @@ cromwell-tools>=1.1.1, <2
black==19.3b0
flake8==3.7.7
pre-commit==1.14.4
google-cloud-pubsub==0.39.1
google-cloud-pubsub==1.0.2
git+git://github.com/HumanCellAtlas/[email protected]

0 comments on commit 392c320

Please sign in to comment.