Skip to content

Commit 3791e31

Browse files
authored
Merge pull request GoogleCloudPlatform#2 from googledrew/master-prakhag1
upgrade to locust 0.11.0, python 3.7
2 parents be11c59 + d2589d4 commit 3791e31

File tree

6 files changed

+73
-64
lines changed

6 files changed

+73
-64
lines changed

docker-image/Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@
1313
# limitations under the License.
1414

1515

16-
# Start with a base Python 2.7.8 image
17-
FROM python:2.7.8
16+
# Start with a base Python 3.7.2 image
17+
FROM python:3.7.2
1818

1919
# Add the licenses for third party software and libraries
2020
ADD licenses /licenses
Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,18 @@
1-
Flask==0.12.3
2-
gevent==1.0.1
3-
greenlet==0.4.5
4-
itsdangerous==0.24
5-
Jinja2==2.7.3
6-
locustio==0.7.2
7-
MarkupSafe==0.23
8-
msgpack-python==0.4.6
9-
pyzmq==14.5.0
10-
requests==2.20.0
11-
Werkzeug==0.10.4
1+
certifi==2019.3.9
2+
chardet==3.0.4
3+
Click==7.0
4+
Flask==1.0.2
5+
gevent==1.4.0
6+
greenlet==0.4.15
7+
idna==2.8
8+
itsdangerous==1.1.0
9+
Jinja2==2.10
10+
locustio==0.11.0
11+
MarkupSafe==1.1.1
12+
msgpack==0.6.1
13+
msgpack-python==0.5.6
14+
pyzmq==18.0.1
15+
requests==2.21.0
16+
six==1.12.0
17+
urllib3==1.24.1
18+
Werkzeug==0.15.1

sample-webapp/app.py

Lines changed: 0 additions & 47 deletions
This file was deleted.

sample-webapp/app.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,10 @@
1313
# limitations under the License.
1414

1515

16-
runtime: python27
17-
api_version: 1
18-
threadsafe: true
16+
runtime: python37
17+
18+
instance_class: F2
1919

2020
handlers:
2121
- url: /.*
22-
script: app.app
22+
script: auto

sample-webapp/main.py

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
#!/usr/bin/env python
2+
3+
# Copyright 2019 Google Inc. All rights reserved.
4+
#
5+
# Licensed under the Apache License, Version 2.0 (the "License");
6+
# you may not use this file except in compliance with the License.
7+
# You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing, software
12+
# distributed under the License is distributed on an "AS IS" BASIS,
13+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
# See the License for the specific language governing permissions and
15+
# limitations under the License.
16+
17+
18+
from flask import Flask, request
19+
20+
app = Flask(__name__)
21+
22+
23+
@app.route('/')
24+
def root():
25+
return 'Welcome to the "Distributed Load Testing Using Kubernetes" sample web app\n'
26+
27+
@app.route('/login', methods=['GET', 'POST'])
28+
def login():
29+
deviceid = request.values.get('deviceid')
30+
return '/login - device: {}\n'.format(deviceid)
31+
32+
@app.route('/metrics', methods=['GET', 'POST'])
33+
def metrics():
34+
deviceid = request.values.get('deviceid')
35+
timestamp = request.values.get('timestamp')
36+
37+
return '/metrics - device: {}, timestamp: {}\n'.format(deviceid, timestamp)
38+
39+
40+
if __name__ == '__main__':
41+
# This is used when running locally only. When deploying to Google App
42+
# Engine, a webserver process such as Gunicorn will serve the app. This
43+
# can be configured by adding an `entrypoint` to app.yaml.
44+
# Flask's development server will automatically serve static files in
45+
# the "static" directory. See:
46+
# http://flask.pocoo.org/docs/1.0/quickstart/#static-files. Once deployed,
47+
# App Engine itself will serve those files as configured in app.yaml.
48+
app.run(host='127.0.0.1', port=8080, debug=True)

sample-webapp/requirements.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Flask>=1.0.2

0 commit comments

Comments
 (0)