Skip to content

Magneto wants to recruit as many mutants as possible to fight against the X-Men.

Notifications You must be signed in to change notification settings

dvelardez/x-men

Repository files navigation

Python Google Cloud Task Queue sample for Google App Engine Standard Environment

This demonstrates how to create tasks and place them in push queues using Google Cloud Task Queue on Google App Engine Standard Environment.

Running the sample locally

  1. When running locally, you can use the Google Cloud SDK to provide authentication to use Google Cloud APIs:

     $ gcloud init
    
  2. Download the Google App Engine Python SDK for your platform.

  3. To run this app locally, specify both .yaml files to dev_appserver.py:

     $ dev_appserver.py -A your-app-id app.yaml worker.yaml
    
  4. Visit http://localhost:8080/stats/ to view your application.

Deploying the sample

  1. Download the Google App Engine Python SDK for your platform.

  2. 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
    
  3. Visit https://your-app-id.appost.com/stats/ to view your application.

How to test the API

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"]}'    

Local Unit Testing for Python

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>

About

Magneto wants to recruit as many mutants as possible to fight against the X-Men.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages