This demonstrates how to create tasks and place them in push queues using Google Cloud Task Queue on Google App Engine Standard Environment.
-
When running locally, you can use the Google Cloud SDK to provide authentication to use Google Cloud APIs:
$ gcloud init
-
Download the Google App Engine Python SDK for your platform.
-
To run this app locally, specify both
.yaml
files todev_appserver.py
:$ dev_appserver.py -A your-app-id app.yaml worker.yaml
-
Visit
http://localhost:8080/stats/
to view your application.
-
Download the Google App Engine Python SDK for your platform.
-
Deploy using gcloud:
Deploy the worker:
gcloud app deploy worker.yaml
Deploy the web app, you will need to specify your Project ID and a version number:
gcloud app deploy --project your-app-id -v your-version
-
Visit
https://your-app-id.appost.com/stats/
to view your application.
To make it simpler to try, I've already published the example so you can test it directly. Use your favorite client to make calls to the API, I leave as an example the calls using cURL.
curl -X GET \
https://pid-rmscm02500.appspot.com/stats/ \
-H 'Cache-Control: no-cache'
curl -X POST \
https://pid-rmscm02500.appspot.com/mutant/ \
-H 'cache-control: no-cache' \
-H 'content-type: application/json' \
-d '{"dna":["ATGCGA","CAGTGC","TTATGT","AGAAGG","CCCCTA","TCACTG"]}'
Install dependencies, preferably with a virtualenv:
$ virtualenv env
$ source env/bin/activate
$ pip install -r requirements.txt
You can run these tests simply by running the script runner.py
python runner.py <path-to-appengine-SDK>