Commit f042a4fd authored by Robin Obůrka's avatar Robin Obůrka Committed by Robin Obůrka

dev: Prepare dev environment for msgloop development

parent 44ce1f7b
#!/usr/bin/env python3
import zmq
import sn
def main():
"""Plain lib version"""
ctx = sn.SN(zmq.Context.instance())
socket = ctx.get_socket("in")
while True:
msg = socket.recv_multipart()
mtype, data = sn.parse_msg(msg)
print(mtype, data)
if __name__ == "__main__":
main()
#!/usr/bin/env python3
import zmq
import sn
def main():
"""Plain lib version"""
ctx = sn.SN(zmq.Context.instance())
socket_in = ctx.get_socket("in")
socket_out = ctx.get_socket("out")
while True:
msg = socket_in.recv_multipart()
socket_out.send_multipart(msg)
if __name__ == "__main__":
main()
#!/usr/bin/env python3
import time
import zmq
import sn
def main():
"""Plain lib version"""
ctx = sn.SN(zmq.Context.instance())
socket = ctx.get_socket("out")
while True:
data = {
"foo": "bar",
"ts": int(time.time()),
}
msg = sn.encode_msg("sentinel/dev/sn", data)
socket.send_multipart(msg)
print("PUB", data)
time.sleep(1)
if __name__ == "__main__":
main()
#!/bin/sh
SESSION="snboxes"
# Kill old session if awaiable
if tmux ls | grep -q "$SESSION"; then
tmux kill-session -t "$SESSION"
fi
# Start session
tmux new-session -d -s "$SESSION"
tmux new-window -t "$SESSION":0
tmux split-window -v -p 80
tmux select-pane -t 2
tmux split-window -v -p 50
tmux select-pane -t 1
tmux split-window -h
#
## Run all necessary commands
tmux select-pane -t 0
tmux send-keys "tail -f sentinel.log" C-m
tmux select-pane -t 1
tmux send-keys "workon sentinel" C-m
tmux send-keys "./out_only.py --resource 'out,connect,PUSH,127.0.0.1,8801'" C-m
tmux select-pane -t 2
tmux send-keys "workon sentinel" C-m
tmux send-keys "./in_only.py --resource 'in,bind,PULL,*,8802'" C-m
tmux select-pane -t 3
tmux send-keys "workon sentinel" C-m
tmux send-keys "./in_out.py --resource 'in,bind,PULL,*,8801' --resource 'out,connect,PUSH,127.0.0.1,8802'" C-m
# Attach the session
tmux attach-session -t "$SESSION"
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment