stuff and things

This commit is contained in:
Michaela 2021-04-10 22:04:42 +10:00
parent 4d8fda7441
commit 77673e06b1
2 changed files with 16 additions and 8 deletions

View File

@ -555,7 +555,7 @@ resource "aws_lambda_function" "get_sondes" {
memory_size = 256 memory_size = 256
role = aws_iam_role.IAMRole5.arn role = aws_iam_role.IAMRole5.arn
runtime = "python3.7" runtime = "python3.7"
timeout = 10 timeout = 30
tracing_config { tracing_config {
mode = "Active" mode = "Active"
} }
@ -579,7 +579,7 @@ resource "aws_lambda_function" "listeners" {
memory_size = 256 memory_size = 256
role = aws_iam_role.IAMRole5.arn role = aws_iam_role.IAMRole5.arn
runtime = "python3.7" runtime = "python3.7"
timeout = 10 timeout = 30
tracing_config { tracing_config {
mode = "Active" mode = "Active"
} }
@ -604,7 +604,7 @@ resource "aws_lambda_function" "datanew" {
memory_size = 256 memory_size = 256
role = aws_iam_role.IAMRole5.arn role = aws_iam_role.IAMRole5.arn
runtime = "python3.7" runtime = "python3.7"
timeout = 10 timeout = 30
tracing_config { tracing_config {
mode = "Active" mode = "Active"
} }
@ -628,7 +628,7 @@ resource "aws_lambda_function" "predictions" {
memory_size = 256 memory_size = 256
role = aws_iam_role.IAMRole5.arn role = aws_iam_role.IAMRole5.arn
runtime = "python3.7" runtime = "python3.7"
timeout = 10 timeout = 30
tracing_config { tracing_config {
mode = "Active" mode = "Active"
} }

View File

@ -246,7 +246,7 @@ def datanew(event, context):
"aggs": { "aggs": {
"1": { "1": {
"top_hits": { "top_hits": {
"size": 1, "size": 5,
"sort": [{"datetime": {"order": "desc"}}], "sort": [{"datetime": {"order": "desc"}}],
} }
} }
@ -289,6 +289,13 @@ def datanew(event, context):
for frame in sonde["3"]["buckets"]: for frame in sonde["3"]["buckets"]:
try: try:
frame_data = frame["1"]["hits"]["hits"][0]["_source"] frame_data = frame["1"]["hits"]["hits"][0]["_source"]
uploaders = {
x["_source"]['uploader_callsign'] : {
"snr" : x["_source"]["snr"] if "snr" in x["_source"] else None,
"rssi" : x["_source"]["rssi"] if "rssi" in x["_source"] else None
}
for x in frame["1"]["hits"]["hits"]
}
# Use subtype if it exists, else just use the basic type. # Use subtype if it exists, else just use the basic type.
if "subtype" in frame_data: if "subtype" in frame_data:
@ -344,7 +351,7 @@ def datanew(event, context):
"picture": "", "picture": "",
"temp_inside": "", "temp_inside": "",
"data": data, "data": data,
"callsign": frame_data["uploader_callsign"], "callsign": uploaders,
"sequence": "0", "sequence": "0",
} }
) )
@ -576,7 +583,8 @@ if __name__ == "__main__":
"type" : "positions", "type" : "positions",
"mode": "6hours", "mode": "6hours",
"position_id": "0", "position_id": "0",
"chase_only": "true" "chase_only": "false",
"vehicles": "17008547"
} }
}, },
{}, {},