Skip to content

Commit e06b950

Browse files
authored
Merge branch 'main' into documentai-training-samples
2 parents b7c74ef + 0dd97ad commit e06b950

File tree

13 files changed

+101
-7
lines changed

13 files changed

+101
-7
lines changed

appengine/standard_python3/bundled-services/blobstore/django/main_test.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,15 @@ def version():
6565
result = gcloud_cli(f"app deploy --no-promote --version={uuid.uuid4().hex}")
6666
version_id = result["versions"][0]["id"]
6767
project_id = result["versions"][0]["project"]
68+
version_hostname = f"{version_id}-dot-{project_id}.appspot.com"
69+
70+
# Wait for app to initialize
71+
@backoff.on_exception(backoff.expo, requests.exceptions.HTTPError, max_tries=3)
72+
def wait_for_app(url):
73+
r = requests.get(url)
74+
r.raise_for_status()
75+
76+
wait_for_app(f"https://{version_hostname}/")
6877

6978
yield project_id, version_id
7079

appengine/standard_python3/bundled-services/blobstore/flask/main_test.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,15 @@ def version():
6565
result = gcloud_cli(f"app deploy --no-promote --version={uuid.uuid4().hex}")
6666
version_id = result["versions"][0]["id"]
6767
project_id = result["versions"][0]["project"]
68+
version_hostname = f"{version_id}-dot-{project_id}.appspot.com"
69+
70+
# Wait for app to initialize
71+
@backoff.on_exception(backoff.expo, requests.exceptions.HTTPError, max_tries=3)
72+
def wait_for_app(url):
73+
r = requests.get(url)
74+
r.raise_for_status()
75+
76+
wait_for_app(f"https://{version_hostname}/")
6877

6978
yield project_id, version_id
7079

appengine/standard_python3/bundled-services/blobstore/wsgi/main_test.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
import json
1616
import re
1717
import subprocess
18-
import time
1918
import uuid
2019

2120
import backoff
@@ -66,8 +65,16 @@ def version():
6665
result = gcloud_cli(f"app deploy --no-promote --version={uuid.uuid4().hex}")
6766
version_id = result["versions"][0]["id"]
6867
project_id = result["versions"][0]["project"]
68+
version_hostname = f"{version_id}-dot-{project_id}.appspot.com"
69+
70+
# Wait for app to initialize
71+
@backoff.on_exception(backoff.expo, requests.exceptions.HTTPError, max_tries=3)
72+
def wait_for_app(url):
73+
r = requests.get(url)
74+
r.raise_for_status()
75+
76+
wait_for_app(f"https://{version_hostname}/")
6977

70-
time.sleep(10) # There may be a short delay before responsive
7178
yield project_id, version_id
7279

7380
gcloud_cli(f"app versions delete {version_id}")

appengine/standard_python3/bundled-services/deferred/django/main_test.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,15 @@ def version():
6565
result = gcloud_cli(f"app deploy --no-promote --version={uuid.uuid4().hex}")
6666
version_id = result["versions"][0]["id"]
6767
project_id = result["versions"][0]["project"]
68+
version_hostname = f"{version_id}-dot-{project_id}.appspot.com"
69+
70+
# Wait for app to initialize
71+
@backoff.on_exception(backoff.expo, requests.exceptions.HTTPError, max_tries=3)
72+
def wait_for_app(url):
73+
r = requests.get(url)
74+
r.raise_for_status()
75+
76+
wait_for_app(f"https://{version_hostname}/counter/get")
6877

6978
yield project_id, version_id
7079

appengine/standard_python3/bundled-services/deferred/flask/main_test.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,15 @@ def version():
6565
result = gcloud_cli(f"app deploy --no-promote --version={uuid.uuid4().hex}")
6666
version_id = result["versions"][0]["id"]
6767
project_id = result["versions"][0]["project"]
68+
version_hostname = f"{version_id}-dot-{project_id}.appspot.com"
69+
70+
# Wait for app to initialize
71+
@backoff.on_exception(backoff.expo, requests.exceptions.HTTPError, max_tries=3)
72+
def wait_for_app(url):
73+
r = requests.get(url)
74+
r.raise_for_status()
75+
76+
wait_for_app(f"https://{version_hostname}/counter/get")
6877

6978
yield project_id, version_id
7079

appengine/standard_python3/bundled-services/deferred/wsgi/main_test.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,15 @@ def version():
6565
result = gcloud_cli(f"app deploy --no-promote --version={uuid.uuid4().hex}")
6666
version_id = result["versions"][0]["id"]
6767
project_id = result["versions"][0]["project"]
68+
version_hostname = f"{version_id}-dot-{project_id}.appspot.com"
69+
70+
# Wait for app to initialize
71+
@backoff.on_exception(backoff.expo, requests.exceptions.HTTPError, max_tries=3)
72+
def wait_for_app(url):
73+
r = requests.get(url)
74+
r.raise_for_status()
75+
76+
wait_for_app(f"https://{version_hostname}/counter/get")
6877

6978
yield project_id, version_id
7079

appengine/standard_python3/bundled-services/mail/django/main_test.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,15 @@ def version():
6565
result = gcloud_cli(f"app deploy --no-promote --version={uuid.uuid4().hex}")
6666
version_id = result["versions"][0]["id"]
6767
project_id = result["versions"][0]["project"]
68+
version_hostname = f"{version_id}-dot-{project_id}.appspot.com"
69+
70+
# Wait for app to initialize
71+
@backoff.on_exception(backoff.expo, requests.exceptions.HTTPError, max_tries=3)
72+
def wait_for_app(url):
73+
r = requests.get(url)
74+
r.raise_for_status()
75+
76+
wait_for_app(f"https://{version_hostname}/")
6877

6978
yield project_id, version_id
7079

appengine/standard_python3/bundled-services/mail/flask/main_test.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,15 @@ def version():
6464
result = gcloud_cli(f"app deploy --no-promote --version={uuid.uuid4().hex}")
6565
version_id = result["versions"][0]["id"]
6666
project_id = result["versions"][0]["project"]
67+
version_hostname = f"{version_id}-dot-{project_id}.appspot.com"
68+
69+
# Wait for app to initialize
70+
@backoff.on_exception(backoff.expo, requests.exceptions.HTTPError, max_tries=3)
71+
def wait_for_app(url):
72+
r = requests.get(url)
73+
r.raise_for_status()
74+
75+
wait_for_app(f"https://{version_hostname}/")
6776

6877
yield project_id, version_id
6978

appengine/standard_python3/bundled-services/mail/wsgi/main_test.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,15 @@ def version():
6565
result = gcloud_cli(f"app deploy --no-promote --version={uuid.uuid4().hex}")
6666
version_id = result["versions"][0]["id"]
6767
project_id = result["versions"][0]["project"]
68+
version_hostname = f"{version_id}-dot-{project_id}.appspot.com"
69+
70+
# Wait for app to initialize
71+
@backoff.on_exception(backoff.expo, requests.exceptions.HTTPError, max_tries=3)
72+
def wait_for_app(url):
73+
r = requests.get(url)
74+
r.raise_for_status()
75+
76+
wait_for_app(f"https://{version_hostname}/")
6877

6978
yield project_id, version_id
7079

composer/workflows/requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# see https://airflow.apache.org/docs/apache-airflow/stable/installation/installing-from-pypi.html#constraints-files
33
apache-airflow==2.3.3
44
apache-airflow-providers-apache-beam==4.1.0
5-
apache-airflow-providers-cncf-kubernetes==5.1.0
5+
apache-airflow-providers-cncf-kubernetes==5.0.0
66
apache-airflow-providers-google==8.3.0
77
scipy==1.8.1; python_version > '3.0'
88
apache-airflow-providers-amazon==4.0.0

functions/http/main.py

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,17 @@
2121
import tempfile
2222
# [END functions_http_form_data]
2323

24+
# [START functions_http_cors]
25+
# [START functions_http_cors_auth]
26+
# [START functions_http_xml]
27+
# [START functions_http_form_data]
28+
import functions_framework
29+
30+
# [END functions_http_form_data]
31+
# [END functions_http_xml]
32+
# [END functions_http_cors_auth]
33+
# [END functions_http_cors]
34+
2435
# [START functions_http_form_data]
2536
from werkzeug.utils import secure_filename
2637
# [END functions_http_form_data]
@@ -31,7 +42,7 @@
3142

3243

3344
# [START functions_http_xml]
34-
45+
@functions_framework.http
3546
def parse_xml(request):
3647
""" Parses a document of type 'text/xml'
3748
Args:
@@ -56,6 +67,7 @@ def get_file_path(filename):
5667
return os.path.join(tempfile.gettempdir(), file_name)
5768

5869

70+
@functions_framework.http
5971
def parse_multipart(request):
6072
""" Parses a 'multipart/form-data' upload request
6173
Args:
@@ -92,6 +104,7 @@ def parse_multipart(request):
92104

93105

94106
# [START functions_http_cors]
107+
@functions_framework.http
95108
def cors_enabled_function(request):
96109
# For more information about CORS and CORS preflight requests, see:
97110
# https://developer.mozilla.org/en-US/docs/Glossary/Preflight_request
@@ -119,6 +132,7 @@ def cors_enabled_function(request):
119132

120133

121134
# [START functions_http_cors_auth]
135+
@functions_framework.http
122136
def cors_enabled_function_auth(request):
123137
# For more information about CORS and CORS preflight requests, see
124138
# https://developer.mozilla.org/en-US/docs/Glossary/Preflight_request

functions/http/requirements.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
functions-framework==3.3.0
12
google-cloud-storage==2.0.0; python_version < '3.7'
23
google-cloud-storage==2.1.0; python_version > '3.6'
34
xmltodict==0.13.0

retail/interactive-tutorials/README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
#Retail Search Interactive Tutorials
1+
# Retail Search Interactive Tutorials
22

3-
##Run tutorials in Cloud Shell
3+
## Run tutorials in Cloud Shell
44

55
To advance with the interactive tutorials, use Retail Search step-by-step manuals on the right side of the Cloud Shell IDE:
66
![Interactive tutorials](images/tutorial1.png)
@@ -185,4 +185,4 @@ python product/import_products_gcs.py
185185
Run the sample in a terminal with the following command:
186186
```bash
187187
python search/search_with_boost_spec.py
188-
```
188+
```

0 commit comments

Comments
 (0)