Skip to content
This repository was archived by the owner on Feb 1, 2024. It is now read-only.

Commit e7e1243

Browse files
authored
[Cloud Tasks] Add task with authentication sample [(#2113)](GoogleCloudPlatform/python-docs-samples#2113)
* Add task with authentication sample * Fix linting * Fix linting * Fix spacing * Update tests with service account * Move samples and update READMEs * Update version and linting
1 parent 052b45a commit e7e1243

File tree

3 files changed

+18
-22
lines changed

3 files changed

+18
-22
lines changed
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# Use the official Python image.
2+
# https://hub.docker.com/_/python
3+
FROM python:3.7
4+
5+
# Copy local code to the container image.
6+
ENV APP_HOME /app
7+
WORKDIR $APP_HOME
8+
COPY . .
9+
10+
# Install production dependencies.
11+
RUN pip install Flask gunicorn
12+
13+
# Run the web service on container startup. Here we use the gunicorn
14+
# webserver, with one worker process and 8 threads.
15+
# For environments with multiple CPU cores, increase the number of workers
16+
# to be equal to the cores available.
17+
CMD exec gunicorn --bind :$PORT --workers 1 --threads 8 main:app

samples/appengine/flexible/tasks/README.md

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -101,24 +101,3 @@ endpoint, with a payload specified:
101101
```
102102
python create_app_engine_queue_task.py --project=$PROJECT_ID --queue=$QUEUE_ID --location=$LOCATION_ID --payload=hello
103103
```
104-
105-
### Using HTTP Push Queues
106-
107-
Set an environment variable for the endpoint to your task handler. This is an
108-
example url to send requests to the App Engine task handler:
109-
```
110-
export URL=https://<project_id>.appspot.com/example_task_handler
111-
```
112-
113-
Running the sample will create a task and send the task to the specific URL
114-
endpoint, with a payload specified:
115-
116-
```
117-
python create_http_task.py --project=$PROJECT_ID --queue=$QUEUE_ID --location=$LOCATION_ID --url=$URL --payload=hello
118-
```
119-
120-
Now view that the payload was received and verify the payload:
121-
122-
```
123-
gcloud app logs read
124-
```
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
Flask==1.0.2
22
gunicorn==19.9.0
3-
google-cloud-tasks==0.6.0
3+
google-cloud-tasks==0.7.0

0 commit comments

Comments
 (0)