Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions serving/communication/azure_command_sender.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
WEB_TOPIC_NAME = os.getenv("COMMAND_TOPIC_NAME", "commandtopic") # topic to send commands
REWARD_TOPIC_NAME = os.getenv("REWARD_TOPIC_NAME", "rewardtopic") # topic to receive results
SUBSCRIPTION_NAME = os.getenv("WEB_SUBSCRIPTION_NAME", "rlcommandbustopic")
REWARD_SUBSCRIPTION_NAME = os.getenv("REWARD_SUBSCRIPTION_NAME")
REWARD_SUBSCRIPTION_NAME = os.getenv("REWARD_SUBSCRIPTION_NAME") or SUBSCRIPTION_NAME


def send_azure_command(payload: Dict[str, Any], timeout_s: int = 10) -> str:
Expand Down Expand Up @@ -47,7 +47,11 @@ def send_azure_command(payload: Dict[str, Any], timeout_s: int = 10) -> str:
async def _wait_for_response():
for _ in range(timeout_s):
try:
reward_topic = ServiceBusTopic(SERVICE_BUS_CONNECTION_STRING, topic_name=REWARD_TOPIC_NAME, subscription_name=REWARD_SUBSCRIPTION_NAME
reward_topic = ServiceBusTopic(
SERVICE_BUS_CONNECTION_STRING,
topic_name=REWARD_TOPIC_NAME,
subscription_name=REWARD_SUBSCRIPTION_NAME,
)
resp = await reward_topic.receive_web_reward_async()
if resp and resp.get("message") not in {"No rewards received", "No messages received"}:
return resp
Expand Down
2 changes: 1 addition & 1 deletion serving/communication/code_command_sender.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
WEB_TOPIC_NAME = os.getenv("COMMAND_TOPIC_NAME", "commandtopic") # topic to send commands
REWARD_TOPIC_NAME = os.getenv("REWARD_TOPIC_NAME", "rewardtopic") # topic to receive results
CODE_SUBSCRIPTION_NAME = os.getenv("CODE_SUBSCRIPTION_NAME", "codesubscription") # command subscription
REWARD_SUBSCRIPTION_NAME = os.getenv("REWARD_SUBSCRIPTION_NAME")
REWARD_SUBSCRIPTION_NAME = os.getenv("REWARD_SUBSCRIPTION_NAME") or CODE_SUBSCRIPTION_NAME


def send_code_command(payload: Dict[str, Any], timeout_s: int = 10) -> str:
Expand Down
2 changes: 1 addition & 1 deletion serving/communication/command_sender.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
WEB_TOPIC_NAME = os.getenv("COMMAND_TOPIC_NAME", "commandtopic") # topic to send commands
REWARD_TOPIC_NAME = os.getenv("REWARD_TOPIC_NAME", "rewardtopic") # topic to receive results
SUBSCRIPTION_NAME = os.getenv("WEB_SUBSCRIPTION_NAME", "rlcommandbustopic") # command subscription (if distinct)
REWARD_SUBSCRIPTION_NAME = os.getenv("REWARD_SUBSCRIPTION_NAME")
REWARD_SUBSCRIPTION_NAME = os.getenv("REWARD_SUBSCRIPTION_NAME") or SUBSCRIPTION_NAME


def send_web_command(payload: Dict[str, Any], timeout_s: int = 10) -> str:
Expand Down