Skip to content

Commit

Permalink
Updated server.py finos#2360
Browse files Browse the repository at this point in the history
Edited Comments
  • Loading branch information
winverma authored Nov 3, 2023
1 parent 6e00849 commit ec77663
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions examples/python-tornado-streaming/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@
# Your data_source() function, IS_MULTI_THREADED, SECURITIES, and CLIENTS remain unchanged.

def perspective_thread(manager):
"""Perspective application thread starts its own tornado IOLoop, and
adds the table with the name "data_source_one", which will be used
in the front-end."""
table = Table(
{
"name": str,
Expand All @@ -36,11 +39,13 @@ def perspective_thread(manager):
"lastUpdate": datetime,
"date": date,
},

limit=2500,
)

# Track the table with the name "data_source_one", which will be used in
# the front-end to access the Table.
manager.host_table("data_source_one", table)

# update with new data every 50ms
def updater():
table.update(data_source())

Expand All @@ -57,7 +62,7 @@ def updater():
callback.start()
psp_loop.start()

# Add this code block to retrieve the hosted table names.
# Added this code block to retrieve the hosted table names.
def retrieve_table_names():
# Get the hosted table names using a future object.
fut = manager.get_hosted_table_names()
Expand Down

0 comments on commit ec77663

Please sign in to comment.