Opened 6 years ago

Closed 6 years ago

#2687 closed enhancement (fixed)

Allow REST server to be shut down remotely

Reported by: Tristan Croll Owned by: Conrad Huang
Priority: moderate Milestone:
Component: Input/Output Version:
Keywords: Cc:
Blocked By: Blocking:
Notify when closed: Platform: all
Project: ChimeraX

Description

I'd like to suggest the following patch to bundles/rest_server/src/server.py allowing the server to be gracefully stopped from the client side. As it stands, sending the command:

http://localhost:{port}/run?command=remotecontrol rest stop

hangs both the client and ChimeraX itself, since it shuts down the server *before* returning a response. The patch allows the command:

http://localhost{port}/stop

... which sends an acknowledgement to the client first and then shuts down the server.

The current use case is that the Phenix team want to be able to query ChimeraX to see if ISOLDE is installed/up to date (and bring up a dialog on the Phenix side asking if they want to install/upgrade it) before starting ISOLDE's own REST server. The simplest way I can see to do this right now is to first run ChimeraX's built in server to query the list of installed bundles and do the installation if necessary, then start ISOLDE's server on a new port and shut down the ChimeraX one.

Attachments (1)

server.py.diff (1.2 KB ) - added by Tristan Croll 6 years ago.

Download all attachments as: .zip

Change History (2)

by Tristan Croll, 6 years ago

Attachment: server.py.diff added

comment:1 by Conrad Huang, 6 years ago

Resolution: fixed
Status: assignedclosed

Fixed in 3c9d3446e.

Instead of adding another special URL, I changed the server code so that a stop request will wait until all running requests finish before shutting down the server. So "remotecontrol rest stop" should work as expected rather than hang now.

Note: See TracTickets for help on using tickets.