mirror of
https://github.com/mewtek/i2ME-Legacy.git
synced 2025-05-11 17:00:23 -05:00
Make new tasks for converted record generators
This commit is contained in:
parent
e1432fd464
commit
29420a3a50
@ -1,5 +1,6 @@
|
|||||||
import asyncio
|
import asyncio
|
||||||
from recordGenerators import Alerts,CurrentObservations,HourlyForecast,DailyForecast
|
from recordGenerators import Alerts,CurrentObservations,HourlyForecast,DailyForecast, AirQuality, AirportDelays, AchesAndPains, Breathing, HeatingAndCooling, MosquitoActivity, PollenForecast, TideForecast, WateringNeeds
|
||||||
|
from radar import TWCRadarCollector
|
||||||
|
|
||||||
|
|
||||||
""" This houses the tasks needed to update the data records concurrently
|
""" This houses the tasks needed to update the data records concurrently
|
||||||
@ -16,6 +17,8 @@ async def coTask():
|
|||||||
await CurrentObservations.makeDataFile()
|
await CurrentObservations.makeDataFile()
|
||||||
await asyncio.sleep(5 * 60)
|
await asyncio.sleep(5 * 60)
|
||||||
|
|
||||||
|
# These tasks should be updated every hour
|
||||||
|
|
||||||
async def hfTask():
|
async def hfTask():
|
||||||
while True:
|
while True:
|
||||||
await HourlyForecast.makeDataFile()
|
await HourlyForecast.makeDataFile()
|
||||||
@ -24,4 +27,49 @@ async def hfTask():
|
|||||||
async def dfTask():
|
async def dfTask():
|
||||||
while True:
|
while True:
|
||||||
await DailyForecast.makeDataFile()
|
await DailyForecast.makeDataFile()
|
||||||
|
await asyncio.sleep(60 * 60)
|
||||||
|
|
||||||
|
async def aqTask():
|
||||||
|
while True:
|
||||||
|
await AirQuality.writeData()
|
||||||
|
await asyncio.sleep(60 * 60)
|
||||||
|
|
||||||
|
async def aptTask():
|
||||||
|
while True:
|
||||||
|
await AirportDelays.writeData()
|
||||||
|
await asyncio.sleep(60 * 60)
|
||||||
|
|
||||||
|
async def apTask():
|
||||||
|
while True:
|
||||||
|
await AchesAndPains.makeRecord()
|
||||||
|
await asyncio.sleep(60 * 60)
|
||||||
|
|
||||||
|
async def brTask():
|
||||||
|
while True:
|
||||||
|
await Breathing.makeDataFile()
|
||||||
|
await asyncio.sleep(60 * 60)
|
||||||
|
|
||||||
|
async def hcTask():
|
||||||
|
while True:
|
||||||
|
await HeatingAndCooling.makeRecord()
|
||||||
|
await asyncio.sleep(60 * 60)
|
||||||
|
|
||||||
|
async def maTask():
|
||||||
|
while True:
|
||||||
|
await MosquitoActivity.makeRecord()
|
||||||
|
await asyncio.sleep(60 * 60)
|
||||||
|
|
||||||
|
async def pTask():
|
||||||
|
while True:
|
||||||
|
await PollenForecast.makeDataFile()
|
||||||
|
await asyncio.sleep(60 * 60)
|
||||||
|
|
||||||
|
async def tTask():
|
||||||
|
while True:
|
||||||
|
await TideForecast.makeRecord()
|
||||||
|
await asyncio.sleep(60 * 60)
|
||||||
|
|
||||||
|
async def wnTask():
|
||||||
|
while True:
|
||||||
|
await WateringNeeds.makeRecord()
|
||||||
await asyncio.sleep(60 * 60)
|
await asyncio.sleep(60 * 60)
|
18
main.py
18
main.py
@ -46,12 +46,30 @@ async def main():
|
|||||||
coTask = asyncio.create_task(RecordTasks.coTask())
|
coTask = asyncio.create_task(RecordTasks.coTask())
|
||||||
hfTask = asyncio.create_task(RecordTasks.hfTask())
|
hfTask = asyncio.create_task(RecordTasks.hfTask())
|
||||||
dfTask = asyncio.create_task(RecordTasks.dfTask())
|
dfTask = asyncio.create_task(RecordTasks.dfTask())
|
||||||
|
aqTask = asyncio.create_task(RecordTasks.aqTask())
|
||||||
|
aptTask = asyncio.create_task(RecordTasks.aptTask())
|
||||||
|
apTask = asyncio.create_task(RecordTasks.apTask())
|
||||||
|
brTask = asyncio.create_task(RecordTasks.brTask())
|
||||||
|
hcTask = asyncio.create_task(RecordTasks.hcTask())
|
||||||
|
maTask = asyncio.create_task(RecordTasks.maTask())
|
||||||
|
pTask = asyncio.create_task(RecordTasks.pTask())
|
||||||
|
tTask = asyncio.create_task(RecordTasks.tTask())
|
||||||
|
wnTask = asyncio.create_task(RecordTasks.wnTask())
|
||||||
|
|
||||||
# In theory, these should all run concurrently without problems
|
# In theory, these should all run concurrently without problems
|
||||||
await alertsTask
|
await alertsTask
|
||||||
await coTask
|
await coTask
|
||||||
await hfTask
|
await hfTask
|
||||||
await dfTask
|
await dfTask
|
||||||
|
await aqTask
|
||||||
|
await aptTask
|
||||||
|
await apTask
|
||||||
|
await brTask
|
||||||
|
await hcTask
|
||||||
|
await maTask
|
||||||
|
await pTask
|
||||||
|
await tTask
|
||||||
|
await wnTask
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
asyncio.run(main())
|
asyncio.run(main())
|
Loading…
x
Reference in New Issue
Block a user