demo_app.demo_server module

This is the “main” file for the demo application. It houses the server and defines some API routes

This server is mainly built using flask. Config values are drawn from global.conf

To run the server use the following command:

python demo_server.py
demo_app.demo_server.OUTPUTS = ['FILE', 'KAFKA', 'HTTP', 'HDFS']

The three different types of outputs from the generator

demo_app.demo_server.dt = None

The object to hold the ThreadedDataGenerator

demo_app.demo_server.get_sample()

Get a sample piece of data from the data generator.

demo_app.demo_server.GET()
Route:
/data-gen/sample
Returns:The JSON data from the generator.
Return type:json
demo_app.demo_server.get_schema()

Get the schema the generator is currently using

demo_app.demo_server.GET()
Route:
GET /data-gen/schema
Returns:The JSON object which represent the generator’s schema
Return type:json
demo_app.demo_server.get_test_queries()
demo_app.demo_server.index()

Return the index to the UI

Returns:The HTML for the app
Return type:html
demo_app.demo_server.push_websockets()

Broadcast a message to all Websocket clients

Route:
POST /websockets/data
Returns:N/A
demo_app.demo_server.start_data()

Start the data generator

Route:
POST /data-gen/start
Returns:A piece of JSON with a key “message” where the user can read the message back from the server
Return type:json
demo_app.demo_server.stop_data()

Stop the threaded data generator

Route:
POST /data-gen/stop
Returns:A JSON message determining whether or not the generator was stopped
Return type:json
demo_app.demo_server.update_data()

Update the data generator schema that will be used for the threaded generator and the temp generator for sample data

Route:
POST /data-gen/update
Returns:A JSON object with a ‘message’ key.
Return type:json
demo_app.demo_server.ws_app = <WSDemoServer(Thread-1, initial daemon)>

The websocket server object. Used to broadcast messages

demo_app.demo_server.ws_port = 7888

The port for the websocket server