Skip to content

Commit d565936

Browse files
update helix debug scripts
1 parent 54b2cce commit d565936

2 files changed

Lines changed: 38 additions & 1 deletion

File tree

plugins/helix/scripts/publisher.py

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
import sys
2+
import json
3+
4+
try:
5+
import redis
6+
except ImportError:
7+
print("Error: Missing Python module. Please install 'redis' before running this script.")
8+
sys.exit(1)
9+
10+
11+
def main() -> None:
12+
sequence_number: int = 0
13+
client: redis.Redis = redis.Redis(host="localhost", port=6379, db=0)
14+
15+
while True:
16+
channels: list[str] = input("Enter channels: ").split()
17+
if not channels:
18+
break
19+
20+
command: str = input("Enter command: ")
21+
identifiers: list[str] = input("Enter identifiers: ").split()
22+
23+
for channel in channels:
24+
client.publish(channel, json.dumps({"sequence_number": sequence_number, "command": command,"instances": identifiers}))
25+
26+
sequence_number += 1
27+
print()
28+
29+
30+
if __name__ == "__main__":
31+
main()

plugins/helix/scripts/subscriber.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
1+
import sys
12
import json
2-
import redis
3+
4+
try:
5+
import redis
6+
except ImportError:
7+
print("Error: Missing Python module. Please install 'redis' before running this script.")
8+
sys.exit(1)
39

410

511
CHANNELS: list[str] = ["hal", "application1", "application2"]

0 commit comments

Comments
 (0)