Skip to content

Commit d1a7daf

Browse files
authored
Revise README.md (GoogleCloudPlatform#10334)
This instruction is creating a task queue for an App Engine app. Therefore creating an App Engine App before creating a Task Queue makes more sense.
1 parent 1445d3e commit d1a7daf

1 file changed

Lines changed: 27 additions & 20 deletions

File tree

  • appengine/flexible_python37_and_earlier/tasks

appengine/flexible_python37_and_earlier/tasks/README.md

Lines changed: 27 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -34,66 +34,66 @@ To set up authentication, please refer to our
3434

3535
To install the dependencies for this sample, use the following command:
3636

37-
```
37+
```sh
3838
pip install -r requirements.txt
3939
```
4040

4141
This sample uses the common protos in the [googleapis](https://github.com/googleapis/googleapis)
4242
repository. For more info, see
4343
[Protocol Buffer Basics](https://developers.google.com/protocol-buffers/docs/pythontutorial).
4444

45-
## Creating a queue
46-
47-
To create a queue using the Cloud SDK, use the following gcloud command:
48-
49-
```
50-
gcloud tasks queues create my-appengine-queue
51-
```
52-
53-
Note: A newly created queue will route to the default App Engine service and
54-
version unless configured to do otherwise.
55-
5645
## Deploying the App Engine App
5746

5847
Deploy the App Engine app with gcloud:
5948

6049
* To deploy to the Standard environment:
61-
```
50+
```sh
6251
gcloud app deploy app.yaml
6352
```
6453
* To deploy to the Flexible environment:
65-
```
54+
```sh
6655
gcloud app deploy app.flexible.yaml
6756
```
6857

6958
Verify the index page is serving:
7059

71-
```
60+
```sh
7261
gcloud app browse
7362
```
7463

7564
The App Engine app serves as a target for the push requests. It has an
7665
endpoint `/example_task_handler` that reads the payload (i.e., the request body)
7766
of the HTTP POST request and logs it. The log output can be viewed with:
7867

79-
```
68+
```sh
8069
gcloud app logs read
8170
```
8271

72+
## Creating a queue
73+
74+
To create a queue using the Cloud SDK, use the following gcloud command:
75+
76+
```sh
77+
gcloud tasks queues create my-appengine-queue
78+
```
79+
80+
Note: A newly created queue will route to the default App Engine service and
81+
version unless configured to do otherwise.
82+
8383
## Run the Sample Using the Command Line
8484

8585
Set environment variables:
8686

8787
First, your project ID:
8888

89-
```
89+
```sh
9090
export PROJECT_ID=my-project-id
9191
```
9292

9393
Then the queue ID, as specified at queue creation time. Queue IDs already
9494
created can be listed with `gcloud tasks queues list`.
9595

96-
```
96+
```sh
9797
export QUEUE_ID=my-appengine-queue
9898
```
9999

@@ -103,13 +103,20 @@ the "name" value (for instance, if the name is
103103
"projects/my-project/locations/us-central1/queues/my-appengine-queue", then the
104104
location is "us-central1").
105105

106-
```
106+
```sh
107107
export LOCATION_ID=us-central1
108108
```
109+
109110
### Using App Engine Queues
111+
110112
Running the sample will create a task, targeted at the `/example_task_handler`
111113
endpoint, with a payload specified:
112114

113-
```
115+
> **Note**
116+
> Please update
117+
> [create_app_engine_queue_task.py](./create_app_engine_queue_task.py) before running the following
118+
> command.
119+
120+
```sh
114121
python create_app_engine_queue_task.py --project=$PROJECT_ID --queue=$QUEUE_ID --location=$LOCATION_ID --payload=hello
115122
```

0 commit comments

Comments
 (0)