Revert "[06.10.20] Log timing and amq error handling"
This reverts commit 2f94bac9
This commit is contained in:
parent
2f94bac950
commit
d727655cdf
@ -38,7 +38,7 @@ def averager(type):
|
|||||||
averagePrice = round(averagePrice, 2)
|
averagePrice = round(averagePrice, 2)
|
||||||
|
|
||||||
log("Hourly Price for ({}) is {}".format(timestamp ,averagePrice), 'INFO')
|
log("Hourly Price for ({}) is {}".format(timestamp ,averagePrice), 'INFO')
|
||||||
sleep(0.5)
|
sleep(0.05)
|
||||||
|
|
||||||
return averagePrice, timestamp
|
return averagePrice, timestamp
|
||||||
|
|
||||||
@ -124,9 +124,9 @@ def sentToArtemis(c_type, timestamp, av_price, high, low, vol, o_price, c_price)
|
|||||||
messageJson = json.dumps(message, indent = 4)
|
messageJson = json.dumps(message, indent = 4)
|
||||||
|
|
||||||
log("Sending message to PricingSave queue", 'INFO')
|
log("Sending message to PricingSave queue", 'INFO')
|
||||||
sleep(0.5)
|
sleep(0.05)
|
||||||
log("Message: {}".format(message), 'INFO')
|
log("Message: {}".format(message), 'INFO')
|
||||||
sleep(0.5)
|
sleep(0.05)
|
||||||
|
|
||||||
activeMQSender(messageJson)
|
activeMQSender(messageJson)
|
||||||
|
|
||||||
@ -163,12 +163,12 @@ def collector(c_type):
|
|||||||
schedule.every().hour.at(time).do(collector, c_type).tag("collector")
|
schedule.every().hour.at(time).do(collector, c_type).tag("collector")
|
||||||
|
|
||||||
log("Collection will run again at {} every hour".format(time), 'INFO')
|
log("Collection will run again at {} every hour".format(time), 'INFO')
|
||||||
sleep(0.5)
|
sleep(0.05)
|
||||||
|
|
||||||
# Dynamically Spin up Child process for each type wanting to track
|
# Dynamically Spin up Child process for each type wanting to track
|
||||||
def collectorMain(c_type):
|
def collectorMain(c_type):
|
||||||
log("== Historical Price Collector ==", 'INFO')
|
log("== Historical Price Collector ==", 'INFO')
|
||||||
sleep(0.5)
|
sleep(0.05)
|
||||||
|
|
||||||
collector(c_type)
|
collector(c_type)
|
||||||
|
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
|
|
||||||
import stomp
|
import stomp
|
||||||
import os, sys
|
import os
|
||||||
|
|
||||||
from src.utils.jsonLogger import log
|
from src.utils.jsonLogger import log
|
||||||
from time import sleep
|
from time import sleep
|
||||||
@ -22,19 +22,12 @@ def activeMQSender(message):
|
|||||||
addr, port, mqUser, mqPass = keys().returnKeys()
|
addr, port, mqUser, mqPass = keys().returnKeys()
|
||||||
|
|
||||||
log("Attempting Connection to Artemis...", 'INFO')
|
log("Attempting Connection to Artemis...", 'INFO')
|
||||||
sleep(1)
|
sleep(0.05)
|
||||||
try:
|
|
||||||
con = stomp.Connection([(addr, port)], auto_content_length=False)
|
con = stomp.Connection([(addr, port)], auto_content_length=False)
|
||||||
try:
|
|
||||||
con.connect( mqUser, mqPass, wait=True)
|
con.connect( mqUser, mqPass, wait=True)
|
||||||
|
|
||||||
con.send("PricingSave", message, content_type="application/json", headers={"Content-Type":"application/json"})
|
con.send("PricingSave", message, content_type="application/json", headers={"Content-Type":"application/json"})
|
||||||
|
|
||||||
except:
|
|
||||||
e = sys.exc_info()[0]
|
|
||||||
log("And Error occurred when sending to AMQ :: {}".format(e), 'ERR')
|
|
||||||
con.disconnect()
|
con.disconnect()
|
||||||
con.disconnect()
|
|
||||||
except:
|
|
||||||
e = sys.exc_info()[0]
|
|
||||||
log("And Error occurred when connecting to AMQ :: {}".format(e), 'ERR')
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user