diff --git a/radar/TWCRadarCollector.py b/radar/TWCRadarCollector.py
index 30a94b4..705fa49 100644
--- a/radar/TWCRadarCollector.py
+++ b/radar/TWCRadarCollector.py
@@ -88,6 +88,7 @@ def getTime(timestamp) -> str:
return str(time)
async def collect(radarType: str):
+ loop = asyncio.get_running_loop()
ts = await getValidTimestamps(radarType)
frames = await downloadRadarFrames(radarType, ts)
@@ -99,4 +100,4 @@ async def collect(radarType: str):
if radarType == "satrad":
commands.append( '' )
- bit.sendFile([frames[i]], [commands[i]], 1, 0)
+ await loop.run_in_executor(bit.sendFile([frames[i]], [commands[i]], 1, 0))
diff --git a/recordGenerators/AchesAndPains.py b/recordGenerators/AchesAndPains.py
index e434125..ff686b1 100644
--- a/recordGenerators/AchesAndPains.py
+++ b/recordGenerators/AchesAndPains.py
@@ -7,7 +7,7 @@ import records.LFRecord as LFR
import gzip
from os import remove
import xml.dom.minidom
-import aiohttp, aiofiles
+import aiohttp, aiofiles, asyncio
l = logging.getLogger(__name__)
coloredlogs.install()
@@ -43,6 +43,7 @@ async def getData(coopId, geocode):
await f.close()
async def makeRecord():
+ loop = asyncio.get_running_loop()
l.info("Writing AchesAndPains record.")
header = ''
@@ -73,7 +74,7 @@ async def makeRecord():
file = "./.temp/AchesAndPains.gz"
command = ''
- bit.sendFile([file], [command], 1, 0)
+ await loop.run_in_executor(bit.sendFile([file], [command], 1, 0))
remove('./.temp/AchesAndPains.i2m')
remove('./.temp/AchesAndPains.gz')
\ No newline at end of file
diff --git a/recordGenerators/AirQuality.py b/recordGenerators/AirQuality.py
index 8334783..94626f9 100644
--- a/recordGenerators/AirQuality.py
+++ b/recordGenerators/AirQuality.py
@@ -4,7 +4,7 @@ import os
import shutil
import xml.dom.minidom
import logging,coloredlogs
-import aiohttp, aiofiles
+import aiohttp, aiofiles, asyncio
l = logging.getLogger(__name__)
coloredlogs.install()
@@ -46,6 +46,7 @@ async def getData(epaId, zipcode):
await f.close()
async def writeData():
+ loop = asyncio.get_running_loop()
useData = False
workingEpaIds = []
@@ -93,7 +94,7 @@ async def writeData():
comand = commands.append('')
numFiles = len(files)
- bit.sendFile(files, commands, numFiles, 0)
+ await loop.run_in_executor(bit.sendFile(files, commands, numFiles, 0))
os.remove("./.temp/AirQuality.i2m")
os.remove("./.temp/AirQuality.gz")
diff --git a/recordGenerators/AirportDelays.py b/recordGenerators/AirportDelays.py
index 3d2678d..e5b8a0d 100644
--- a/recordGenerators/AirportDelays.py
+++ b/recordGenerators/AirportDelays.py
@@ -4,7 +4,7 @@ import os
import shutil
import xml.dom.minidom
import logging,coloredlogs
-import aiohttp, aiofiles
+import aiohttp, aiofiles, asyncio
import sys
sys.path.append("./py2lib")
@@ -48,6 +48,7 @@ async def getData(airport):
await f.close()
async def writeData():
+ loop = asyncio.get_running_loop()
useData = False
airportsWithDelays = []
@@ -93,7 +94,7 @@ async def writeData():
comand = commands.append('')
numFiles = len(files)
- bit.sendFile(files, commands, numFiles, 0)
+ await loop.run_in_executor(bit.sendFile(files, commands, numFiles, 0))
os.remove("./.temp/AirportDelays.i2m")
os.remove("./.temp/AirportDelays.gz")
diff --git a/recordGenerators/Alerts.py b/recordGenerators/Alerts.py
index 2a00f63..4386a84 100644
--- a/recordGenerators/Alerts.py
+++ b/recordGenerators/Alerts.py
@@ -9,7 +9,7 @@ import xml.dom.minidom
import shutil
import gzip
import logging,coloredlogs
-import aiofiles, aiohttp
+import aiohttp, aiofiles, asyncio
import sys
@@ -324,6 +324,7 @@ async def getAlerts(location):
async def makeRecord():
+ loop = asyncio.get_running_loop()
global k
# The BERecord XML doesn't need to be written if there's no alerts.
diff --git a/recordGenerators/Breathing.py b/recordGenerators/Breathing.py
index 37e79b9..d5b6ee8 100644
--- a/recordGenerators/Breathing.py
+++ b/recordGenerators/Breathing.py
@@ -6,7 +6,7 @@ import os
import shutil
import xml.dom.minidom
import logging,coloredlogs
-import aiohttp, aiofiles
+import aiohttp, aiofiles, asyncio
sys.path.append("./py2lib")
sys.path.append("./Util")
@@ -52,6 +52,7 @@ async def getData(coopId, geocode):
async def makeDataFile():
+ loop = asyncio.get_running_loop()
l.info("Writing a Breathing forecast record.")
header = ''
footer = ''
@@ -85,7 +86,7 @@ async def makeDataFile():
command = commands.append('')
numFiles = len(files)
- bit.sendFile(files, commands, numFiles, 0)
+ await loop.run_in_executor(bit.sendFile(files, commands, numFiles, 0))
os.remove("./.temp/Breathing.i2m")
os.remove("./.temp/Breathing.gz")
\ No newline at end of file
diff --git a/recordGenerators/CurrentObservations.py b/recordGenerators/CurrentObservations.py
index f0ca993..ac30fc1 100644
--- a/recordGenerators/CurrentObservations.py
+++ b/recordGenerators/CurrentObservations.py
@@ -6,8 +6,7 @@ import os
import shutil
import xml.dom.minidom
import logging,coloredlogs
-import aiofiles
-import aiohttp
+import aiohttp, aiofiles, asyncio
import sys
sys.path.append("./py2lib")
@@ -55,6 +54,7 @@ async def getData(tecci, zipCode):
async def makeDataFile():
+ loop = asyncio.get_running_loop()
l.info("Writing a CurrentObservations record.")
header = ''
footer = ''
@@ -92,7 +92,7 @@ async def makeDataFile():
command = commands.append('')
numFiles = len(files)
- bit.sendFile(files, commands, numFiles, 0)
+ await loop.run_in_executor(await loop.run_in_executor(bit.sendFile(files, commands, numFiles, 0)))
os.remove("./.temp/CurrentObservations.i2m")
os.remove("./.temp/CurrentObservations.gz")
diff --git a/recordGenerators/DailyForecast.py b/recordGenerators/DailyForecast.py
index 9950f69..0d9ea99 100644
--- a/recordGenerators/DailyForecast.py
+++ b/recordGenerators/DailyForecast.py
@@ -6,7 +6,7 @@ import os
import shutil
import xml.dom.minidom
import logging,coloredlogs
-import aiofiles, aiohttp
+import aiohttp, aiofiles, asyncio
sys.path.append("./py2lib")
sys.path.append("./Util")
@@ -53,6 +53,7 @@ async def getData(tecci, zipCode):
async def makeDataFile():
+ loop = asyncio.get_running_loop()
l.info("Writing a DailyForecast record.")
header = ''
footer = ''
@@ -86,7 +87,7 @@ async def makeDataFile():
command = commands.append('')
numFiles = len(files)
- bit.sendFile(files, commands, numFiles, 0)
+ await loop.run_in_executor(bit.sendFile(files, commands, numFiles, 0))
os.remove("./.temp/DailyForecast.i2m")
os.remove("./.temp/DailyForecast.gz")
\ No newline at end of file
diff --git a/recordGenerators/HeatingAndCooling.py b/recordGenerators/HeatingAndCooling.py
index 787739e..3b07a3b 100644
--- a/recordGenerators/HeatingAndCooling.py
+++ b/recordGenerators/HeatingAndCooling.py
@@ -7,7 +7,7 @@ import records.LFRecord as LFR
import gzip
from os import remove
import xml.dom.minidom
-import aiohttp, aiofiles
+import aiohttp, aiofiles, asyncio
l = logging.getLogger(__name__)
coloredlogs.install()
@@ -43,6 +43,7 @@ async def getData(coopId, geocode):
await f.close()
async def makeRecord():
+ loop = asyncio.get_running_loop()
l.info("Writing HeatingAndCooling record.")
header = ''
@@ -73,7 +74,7 @@ async def makeRecord():
file = "./.temp/HeatingAndCooling.gz"
command = ''
- bit.sendFile([file], [command], 1, 0)
+ await loop.run_in_executor(bit.sendFile([file], [command], 1, 0))
remove('./.temp/HeatingAndCooling.i2m')
remove('./.temp/HeatingAndCooling.gz')
\ No newline at end of file
diff --git a/recordGenerators/HourlyForecast.py b/recordGenerators/HourlyForecast.py
index e6d2870..eaf76d3 100644
--- a/recordGenerators/HourlyForecast.py
+++ b/recordGenerators/HourlyForecast.py
@@ -5,7 +5,7 @@ import os
import shutil
import xml.dom.minidom
import logging,coloredlogs
-import aiofiles, aiohttp, asyncio
+import aiohttp, aiofiles, asyncio, asyncio
import sys
sys.path.append("./py2lib")
@@ -54,6 +54,7 @@ async def getData(tecci, zipCode):
async def makeDataFile():
+ loop = asyncio.get_running_loop()
l.info("Writing an HourlyForecast record.")
header = ''
footer = ''
@@ -88,7 +89,7 @@ async def makeDataFile():
command = commands.append('')
numFiles = len(files)
- bit.sendFile(files, commands, numFiles, 0)
+ await loop.run_in_executor(bit.sendFile(files, commands, numFiles, 0))
os.remove("./.temp/HourlyForecast.i2m")
os.remove("./.temp/HourlyForecast.gz")
\ No newline at end of file
diff --git a/recordGenerators/MosquitoActivity.py b/recordGenerators/MosquitoActivity.py
index cb22f47..d3fa07f 100644
--- a/recordGenerators/MosquitoActivity.py
+++ b/recordGenerators/MosquitoActivity.py
@@ -7,7 +7,7 @@ import records.LFRecord as LFR
import gzip
from os import remove
import xml.dom.minidom
-import aiohttp, aiofiles
+import aiohttp, aiofiles, asyncio
l = logging.getLogger(__name__)
coloredlogs.install()
@@ -43,6 +43,7 @@ async def getData(coopId, geocode):
await f.close()
async def makeRecord():
+ loop = asyncio.get_running_loop()
l.info("Writing MosquitoActivity record.")
header = ''
@@ -73,7 +74,7 @@ async def makeRecord():
file = "./.temp/MosquitoActivity.gz"
command = ''
- bit.sendFile([file], [command], 1, 0)
+ await loop.run_in_executor(bit.sendFile([file], [command], 1, 0))
remove('./.temp/MosquitoActivity.i2m')
remove('./.temp/MosquitoActivity.gz')
\ No newline at end of file
diff --git a/recordGenerators/PollenForecast.py b/recordGenerators/PollenForecast.py
index 7c3f475..4fc90bc 100644
--- a/recordGenerators/PollenForecast.py
+++ b/recordGenerators/PollenForecast.py
@@ -6,7 +6,7 @@ import os
import shutil
import xml.dom.minidom
import logging, coloredlogs
-import aiohttp, aiofiles
+import aiohttp, aiofiles, asyncio
sys.path.append("./py2lib")
sys.path.append("./Util")
@@ -52,6 +52,7 @@ async def getData(pollenId, geocode):
async def makeDataFile():
+ loop = asyncio.get_running_loop()
l.info("Writing a PollenForecast record.")
header = ''
footer = ''
@@ -85,7 +86,7 @@ async def makeDataFile():
command = commands.append('')
numFiles = len(files)
- bit.sendFile(files, commands, numFiles, 0)
+ await loop.run_in_executor(bit.sendFile(files, commands, numFiles, 0))
os.remove("./.temp/PollenForecast.i2m")
os.remove("./.temp/PollenForecast.gz")
\ No newline at end of file
diff --git a/recordGenerators/TideForecast.py b/recordGenerators/TideForecast.py
index bb69863..d358190 100644
--- a/recordGenerators/TideForecast.py
+++ b/recordGenerators/TideForecast.py
@@ -7,7 +7,7 @@ import records.LFRecord as LFR
import gzip
from os import remove
import xml.dom.minidom
-import aiohttp, aiofiles
+import aiohttp, aiofiles, asyncio
l = logging.getLogger(__name__)
coloredlogs.install()
@@ -48,6 +48,7 @@ async def getData(tideStation, geocode):
await f.close()
async def makeRecord():
+ loop = asyncio.get_running_loop()
if len(tideStations) < 1:
l.debug("Skipping TidesForecast -- No locations.")
return
@@ -82,7 +83,7 @@ async def makeRecord():
file = "./.temp/TidesForecast.gz"
command = ''
- bit.sendFile([file], [command], 1, 0)
+ await loop.run_in_executor(bit.sendFile([file], [command], 1, 0))
remove('./.temp/TidesForecast.i2m')
remove('./.temp/TidesForecast.gz')
\ No newline at end of file
diff --git a/recordGenerators/WateringNeeds.py b/recordGenerators/WateringNeeds.py
index 9d58023..e464f0e 100644
--- a/recordGenerators/WateringNeeds.py
+++ b/recordGenerators/WateringNeeds.py
@@ -7,7 +7,7 @@ import records.LFRecord as LFR
import gzip
from os import remove
import xml.dom.minidom
-import aiohttp, aiofiles
+import aiohttp, aiofiles, asyncio
l = logging.getLogger(__name__)
coloredlogs.install()
@@ -42,6 +42,7 @@ async def getData(coopId, geocode):
await f.close()
async def makeRecord():
+ loop = asyncio.get_running_loop()
l.info("Writing WateringNeeds record.")
header = ''
@@ -72,7 +73,7 @@ async def makeRecord():
file = "./.temp/WateringNeeds.gz"
command = ''
- bit.sendFile([file], [command], 1, 0)
+ await loop.run_in_executor(bit.sendFile([file], [command], 1, 0))
remove('./.temp/WateringNeeds.i2m')
remove('./.temp/WateringNeeds.gz')
\ No newline at end of file