mirror of
https://github.com/mewtek/i2ME-Legacy.git
synced 2025-05-12 01:10:24 -05:00
Very rudamentary implementation of async tasks in main.py
This commit is contained in:
parent
0af0b8f927
commit
a33ad33678
37
main.py
37
main.py
@ -1,10 +1,35 @@
|
|||||||
import asyncio
|
import asyncio
|
||||||
|
# from re import A
|
||||||
|
from recordGenerators import DailyForecast,CurrentObservations,HourlyForecast,AirQuality,AirportDelays,PollenForecast,Breathing
|
||||||
|
|
||||||
async def main():
|
"""
|
||||||
print("Hello...")
|
CurrentConditions: Every 5 minutes
|
||||||
await asyncio.sleep(1)
|
Daily Forecasts, Hourlies, etc: 60 minutes
|
||||||
print("World!")
|
Alerts: 5 minutes
|
||||||
|
"""
|
||||||
|
|
||||||
|
print("i2MessageEncoder-Python\nDeveloped by mewtek\nData record generators by Floppaa & Goldblaze")
|
||||||
|
|
||||||
|
async def FiveMinUpdaters():
|
||||||
|
CurrentObservations.makeDataFile()
|
||||||
|
await asyncio.sleep(300)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
async def HourUpdaters():
|
||||||
asyncio.run(main())
|
DailyForecast.makeDataFile()
|
||||||
|
HourlyForecast.makeDataFile()
|
||||||
|
AirQuality.writeData()
|
||||||
|
PollenForecast.makeDataFile()
|
||||||
|
AirportDelays.writeData()
|
||||||
|
Breathing.makeDataFile()
|
||||||
|
await asyncio.sleep(3600)
|
||||||
|
|
||||||
|
loop = asyncio.get_event_loop()
|
||||||
|
|
||||||
|
hourtasks = loop.create_task(HourUpdaters())
|
||||||
|
fivemintasks = loop.create_task(FiveMinUpdaters())
|
||||||
|
|
||||||
|
try:
|
||||||
|
loop.run_until_complete(hourtasks)
|
||||||
|
loop.run_until_complete(fivemintasks)
|
||||||
|
except asyncio.CancelledError: pass
|
Loading…
x
Reference in New Issue
Block a user