How to start a flask app from within a python script in a separate thread?

前端 未结 1 1689
孤街浪徒
孤街浪徒 2020-12-22 06:06

I have a script that is extracting data from an internal service and storing the count of data types in memory like this:

metrics = {
   \"new_accounts\": 15         


        
相关标签:
1条回答
  • 2020-12-22 06:29

    Try to put Your metric to Queue:

    https://docs.python.org/2/library/queue.html

    Flask endpoint can read all data from Queue, and expose last value as endpoint data

    Cheers, Fenrir

    0 讨论(0)
提交回复
热议问题