Chimera-related classes¶
Chimera Server¶
- class simulation.chimera_server.ChimeraServer(chimera_exec_path)¶
Class representing a Chimera REST Server process.
- Uses the Python subprocess module to start Chimera as a REST server, and maintains the localhost
port number the Chimera server is running at.
- port¶
The localhost port number the Chimera server is running at
- process¶
The subprocess object for the Chimera server process
- chimera_exec_path¶
The path to the Chimera program executable to run
- get_port()¶
Get the Chimera server port number
Returns: The port number
- kill()¶
Kill the Chimera server process forcefully (used to escape from an unresponsive server)
- quit()¶
Terminate the Chimera server process
Returns: None
- restart_chimera_server()¶
Restart the Chimera server because it has been deemed unresponsive.
- start_chimera_server()¶
- Start the Chimera REST Server as a subprocess, reading its output to figure out what port it
lies at
Returns: None
Chimera Command Set¶
- class simulation.chimera_server.ChimeraCommandSet(commands, pid, ack_event)¶
Represents a package of Chimera commands to be sent to the Chimera REST Servers.
The object has access to an acknowledge event from the Chimera server process so that it can send the commands off and wait for notification that the commands were received and sent along to the server.
- commands¶
The list of Chimera commands to send along to the server
- pid¶
The process ID of the subprocess requesting the Chimera commands so that the server can notify the proper subprocess upon completion
- ack_event¶
The event which will be set by the Chimera server upon completion of command requests
- send_and_wait(commands_queue)¶
- Sends a list of Chimera commands to the main Chimera server process, which will
eventually pull it from the queue and make the HTTP request to the Chimera REST server. This function will wait until the HTTP request is made before returning.
- Parameters
commands_queue – The multiprocessing queue to put the package of commands into, passed in from the main function which spawned both the Chimera server process and the simulation subprocess.
Returns: None