File tree 7 files changed +21
-18
lines changed
7 files changed +21
-18
lines changed Original file line number Diff line number Diff line change @@ -113,7 +113,7 @@ Module | Topic | Video | Codelab | START here | FINISH here
113
113
14|Migrate service between projects| _ TBD_ | _ TBD_ | _ TBD_ | _ TBD_
114
114
15|Add App Engine ` blobstore ` | _ TBD_ | [ link] ( https://codelabs.developers.google.com/codelabs/cloud-gae-python-migrate-15-blobstore?utm_source=codelabs&utm_medium=et&utm_campaign=CDR_wes_aap-serverless_mgrblobstore_sms_202029&utm_content=- ) | Module 0 [ code] ( /mod0-baseline ) (2.x) | Module 15 [ code] ( /mod15-blobstore ) (2.x)
115
115
16|Migrate to Cloud Storage| _ TBD_ | [ link] ( https://codelabs.developers.google.com/codelabs/cloud-gae-python-migrate-16-cloudstorage?utm_source=codelabs&utm_medium=et&utm_campaign=CDR_wes_aap-serverless_mgrcloudstorage_sms_202029&utm_content=- ) | Module 15 [ code] ( /mod15-blobstore ) (2.x) | Module 16 [ code] ( /mod16-cloudstorage ) (2.x & 3.x)
116
- 17|Migrate to Python 3 bundled services| _ TBD_ | _ TBD _ | Module 1 [ code] ( /mod1-flask ) (2.x) | Module 1 [ code] ( /mod1b-flask ) (3.x)
116
+ 17|Migrate to Python 3 bundled services| _ TBD_ | [ link ] ( http://codelabs.developers.google.com/codelabs/cloud-gae-python-migrate-17-bundled?utm_source=codelabs&utm_medium=et&utm_campaign=CDR_wes_aap-serverless_mgrwormhole_sms_202002&utm_content=- ) | Module 1 [ code] ( /mod1-flask ) (2.x) | Module 1 [ code] ( /mod1b-flask ) (3.x)
117
117
18|Add App Engine ` taskqueue ` pull tasks| _ TBD_ | _ TBD_ | Module 1 [ code] ( /mod1-flask ) (2.x) | Module 18 [ code] ( /mod18-gaepull ) (2.x)
118
118
19|Migrate to Cloud Pub/Sub| _ TBD_ | _ TBD_ | Module 18 [ code] ( /mod18-gaepull ) (2.x) | Module 19 [ code] ( /mod9-pubsub ) (3.x)
119
119
Original file line number Diff line number Diff line change @@ -22,9 +22,9 @@ handlers:
22
22
23
23
libraries :
24
24
- name : grpcio
25
- version : 1.0.0
25
+ version : latest
26
26
- name : setuptools
27
- version : 36.6.0
27
+ version : latest
28
28
29
29
env_variables :
30
30
REDIS_HOST : ' YOUR_REDIS_HOST'
Original file line number Diff line number Diff line change @@ -58,7 +58,8 @@ def log_visitors():
58
58
for task in tasks :
59
59
visitor = task .payload
60
60
tallies [visitor ] = tallies .get (visitor , 0 ) + 1
61
- q .delete_tasks (tasks )
61
+ if tasks :
62
+ q .delete_tasks (tasks )
62
63
63
64
# increment those counts in Datastore and return
64
65
for visitor in tallies :
Original file line number Diff line number Diff line change @@ -70,17 +70,19 @@ def log_visitors():
70
70
acks .add (rcvd_msg .ack_id )
71
71
visitor = rcvd_msg .message .data .decode ('utf-8' )
72
72
tallies [visitor ] = tallies .get (visitor , 0 ) + 1
73
- psc_client .acknowledge (subscription = SUB_PATH , ack_ids = acks )
73
+ if acks :
74
+ psc_client .acknowledge (subscription = SUB_PATH , ack_ids = acks )
74
75
75
76
# increment those counts in Datastore and return
76
- with ds_client .context ():
77
- for visitor in tallies :
78
- counter = VisitorCount .query (VisitorCount .visitor == visitor ).get ()
79
- if not counter :
80
- counter = VisitorCount (visitor = visitor , counter = 0 )
77
+ if tallies :
78
+ with ds_client .context ():
79
+ for visitor in tallies :
80
+ counter = VisitorCount .query (VisitorCount .visitor == visitor ).get ()
81
+ if not counter :
82
+ counter = VisitorCount (visitor = visitor , counter = 0 )
83
+ counter .put ()
84
+ counter .counter += tallies [visitor ]
81
85
counter .put ()
82
- counter .counter += tallies [visitor ]
83
- counter .put ()
84
86
return 'DONE (with %d task[s] logging %d visitor[s])\r \n ' % (len (msgs ), len (tallies ))
85
87
86
88
Original file line number Diff line number Diff line change @@ -22,6 +22,6 @@ handlers:
22
22
23
23
libraries :
24
24
- name : grpcio
25
- version : 1.0.0
25
+ version : latest
26
26
- name : setuptools
27
- version : 36.6.0
27
+ version : latest
Original file line number Diff line number Diff line change @@ -22,6 +22,6 @@ handlers:
22
22
23
23
libraries :
24
24
- name : grpcio
25
- version : 1.0.0
25
+ version : latest
26
26
- name : setuptools
27
- version : 36.6.0
27
+ version : latest
Original file line number Diff line number Diff line change @@ -22,6 +22,6 @@ handlers:
22
22
23
23
libraries :
24
24
- name : grpcio
25
- version : 1.0.0
25
+ version : latest
26
26
- name : setuptools
27
- version : 36.6.0
27
+ version : latest
You can’t perform that action at this time.
0 commit comments