Simulator doesn't refresh with updated deck items

%load_ext autoreload
%autoreload 2

from pylabrobot.liquid_handling import LiquidHandler
from pylabrobot.liquid_handling.backends.simulation.simulator_backend import SimulatorBackend
from pylabrobot.resources.hamilton import STARLetDeck

sb = SimulatorBackend(open_browser=False)
lh = LiquidHandler(backend=sb, deck=STARLetDeck())

await lh.setup()

from pylabrobot.resources import (
    TIP_CAR_480_A00,
    PLT_CAR_L5AC_A00,
    Cos_96_DW_1mL,
    HTF_L
)

tip_car = TIP_CAR_480_A00(name='tip carrier')
tip_car[0] = tips = HTF_L(name='tips_01')
tip_car[1] = HTF_L(name='tips_02')
tip_car[2] = HTF_L(name='tips_03')
tip_car[3] = HTF_L(name='tips_04')
tip_car[4] = HTF_L(name='tips_05')

lh.deck.assign_child_resource(tip_car, rails=15)

plt_car = PLT_CAR_L5AC_A00(name='plate carrier')
plt_car[0] = plate_1 = Cos_96_DW_1mL(name='plate_01')
plt_car[1] = plate_2 = Cos_96_DW_1mL(name='plate_02')
plt_car[2] = plate_3 = Cos_96_DW_1mL(name='plate_03')

lh.deck.assign_child_resource(plt_car, rails=8)

This code doesn’t seem to update the simulator I’m running. I’m SSH’d into a computer running the simulator locally and forwarding the ports 1337 and 2121.

EDIT: When I run the notebook locally it works, so it’s probably some issue with the port forwarding. I notice that the websocket port seems to iterate every time i call llh.setup - perhaps i need to forward every single one of the ports that it opens? Unsure.

Any idea what might be going wrong? Thanks.

Hi and welcome to the forum!

lh.setup starts searching for ports at 1337 for the file server, 2121 for the websocket. If the requested port is not available, then it will increment that port by 1 and try again. This means that if you’re already running another program using these ports (or another instance of the simulator), PLR will use other ports. These will be printed to the console.

In the browser, there is a connection indicator in the top right corner. Does it say connected? You can click on it to try to reconnect.

Ah, thanks! So I’ll need to terminate the other simulator instances if I want to use the same port again - that will be helpful for figuring out what’s happening with my ssh problem. Appreciated!

1 Like