python - How to view exceptions when using asyncio and executor pools? -
how can exceptions different processes spit out on stdout when using executor pools asyncio?
for exceptions trapped in ether , can partially dechiper what's going wrong when kill script via ctrl-c....
here's code:
import lib.myfunctions import asyncio import oandapy fmc = lib.myfunctions.fmcmixin() def meatandpotatoes(currency_pair=sys.argv[1], time_compression=sys.argv[2],sleep_time=sys.argv[3]): while true: try: = oanda.get_history() if (something): print("niceeee") else: print("ok cool") except: sleep(sleep_time) if __name__ == "__main__": executor = processpoolexecutor(2) loop = asyncio.get_event_loop() asyncio.async(loop.run_in_executor(executor, meatandpotatoes)) scriptname = str(sys.argv[1] + "/" + sys.argv[2] + "/") asyncio.async(loop.run_in_executor(executor, fmc.heartbeatfunction(scriptname))) loop.run_forever()
when meatandpotatoes has problems can't see errors till ctrl-c, same fmc.heartbeatfunction....
Comments
Post a Comment