Skip to content

Commit 07d2f10

Browse files
author
Jon Wayne Parrott
committed
Update optional-kubernetes-engine to use new psq
1 parent 5a7a526 commit 07d2f10

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

optional-kubernetes-engine/bookshelf/tasks.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,16 +21,20 @@
2121
import requests
2222

2323

24+
publisher_client = pubsub.PublisherClient()
25+
subscriber_client = pubsub.SubscriberClient()
26+
27+
2428
def get_books_queue():
25-
client = pubsub.Client(
26-
project=current_app.config['PROJECT_ID'])
29+
project = current_app.config['PROJECT_ID']
2730

2831
# Create a queue specifically for processing books and pass in the
2932
# Flask application context. This ensures that tasks will have access
3033
# to any extensions / configuration specified to the app, such as
3134
# models.
3235
return psq.Queue(
33-
client, 'books', extra_context=current_app.app_context)
36+
publisher_client, subscriber_client, project,
37+
'books', extra_context=current_app.app_context)
3438

3539

3640
def process_book(book_id):

optional-kubernetes-engine/requirements.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
Flask==0.12.2
22
google-cloud-datastore==1.4.0
33
google-cloud-storage==1.6.0
4+
google-cloud-logging==1.4.0
5+
google-cloud-error_reporting==0.28.0
46
gunicorn==19.7.1
57
oauth2client==4.1.2
68
mock==2.0.0

0 commit comments

Comments
 (0)