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
|
||||
# from re import A
|
||||
from recordGenerators import DailyForecast,CurrentObservations,HourlyForecast,AirQuality,AirportDelays,PollenForecast,Breathing
|
||||
|
||||
async def main():
|
||||
print("Hello...")
|
||||
await asyncio.sleep(1)
|
||||
print("World!")
|
||||
"""
|
||||
CurrentConditions: Every 5 minutes
|
||||
Daily Forecasts, Hourlies, etc: 60 minutes
|
||||
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__":
|
||||
asyncio.run(main())
|
||||
async def HourUpdaters():
|
||||
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