Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
sebastian-aranda committed Aug 30, 2021
2 parents 9fde989 + 01e8258 commit f433813
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 43 deletions.
2 changes: 1 addition & 1 deletion manager/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ more-itertools==8.2.0
msgpack==1.0.0
numpy==1.18.1
packaging==20.3
Pillow==8.1.1
Pillow==8.2.0
pip-licenses==2.1.1
pluggy==0.13.1
psycopg2==2.8.4
Expand Down
42 changes: 0 additions & 42 deletions manager/subscription/consumers.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,8 @@
import json

import asyncio
import datetime
from astropy.time import Time

# from channels.db import database_sync_to_async
from channels.generic.websocket import AsyncJsonWebsocketConsumer
from django.conf import settings

Expand Down Expand Up @@ -66,9 +64,6 @@ async def receive_json(self, message):
await self.handle_subscription_message(message)
elif "action" in message:
await self.handle_action_message(message)
# DEPRECATED: now heartbeats are received from event callbacks
elif "heartbeat" in message:
await self.handle_heartbeat_message(message)
else:
await self.handle_data_message(message, manager_rcv)

Expand Down Expand Up @@ -172,31 +167,6 @@ async def handle_action_message(self, message):
time_data = utils.get_times()
await self.send_json({"time_data": time_data, "request_time": request_time})

# DEPRECATED: now heartbeats are handled using SALobj events callbacks
async def handle_heartbeat_message(self, message):
"""Handle a heartbeat message.
Receives a heartbeat message and sets it in the heartbeat manager.
Parameters
----------
message: `dict`
dictionary containing the message parsed as json. The expected format of the message is as follows:
.. code-block:: json
{
"heartbeat": "<component name>",
"timestamp": "<timestamp of the last heartbeat> (optional)"
}
"""
timestamp = (
message["timestamp"]
if "timestamp" in message
else datetime.datetime.now().timestamp()
)
self.heartbeat_manager.set_heartbeat_timestamp(message["heartbeat"], timestamp)

async def handle_data_message(self, message, manager_rcv):
"""Handle a data message.
Expand Down Expand Up @@ -228,18 +198,6 @@ async def handle_data_message(self, message, manager_rcv):
}]
}
"""
# setting heartbeat
if message["data"][0]["csc"] == "Heartbeat":
heartbeat_message = message["data"][0]["data"]["stream"]
timestamp = (
heartbeat_message["last_heartbeat_timestamp"]
if "last_heartbeat_timestamp" in heartbeat_message
else datetime.datetime.now().timestamp()
)
self.heartbeat_manager.set_heartbeat_timestamp(
heartbeat_message["csc"], timestamp
)

data = message["data"]
category = message["category"]
producer_snd = message["producer_snd"] if "producer_snd" in message else None
Expand Down

0 comments on commit f433813

Please sign in to comment.