Custom "runtime(?)" for jupyter?

Hey all!

I’m hoping to get some help. Say I have 2 machines: local and remote. Remote has a server running and I want to use my local to connect and interact with it. How might I go about doing this?

So, the server would have something like

authenticate_client(information)
while True:
    cmd = accept_cmd_from_client()
    bla = cmd_handler(cmd)

and the client would have stuff like

# Cell 1:

server_obj = connect_to_server(auth args)

# Cell 2
import numpy
import blabla

# Cell 3
user_cmd = "Train"
server_obj.send_command(user_cmd)
#   - stuff runs on the server and information gets piped back here

Questions

Server

  1. Receiving commands from client - I imagine that I will receive some payload which I can then extract?

  2. Compute progress - the computations I am doing are slow. Ideally, I’d like to send information back to the client so they know that things are working in the background (cell 3)

  3. Data back to client - how would I go about sending the results of the compute back to the client?

Client

  1. How do I go about accepting a command from a user, parsing it to determine if I should handle it, or let the existing code handle it? (The other side of Q.1 in the server)

  2. How do I make the notebook wait for data to flow in from the server - both streaming, and a single result?(the other side of 2 and 3 respectively)


I’ve done some searching and I found extending the notebook but I don’t think it’s what I want. I’d really appreciate if someone could point me in the right direction? I don’t know what I don’t know here